Board index » cppbuilder » Invoke() BCB 6 problem vs BCB 5

Invoke() BCB 6 problem vs BCB 5

Hi fellows,

I've got the following problem with BCB 6 (std ed. )

The Invoke method doesn't seems to behave normally in BCB 6.
The folowing code works well with BCB 5 (copy pasted as is from BCB 6 proj)
not with BCB 6, it fails on the Invoke (..) call.  It seems to be a major
bug

/*****************************************************************/
         TCOMISOAPClient soapClient;

          WideString httpRequest;
          WideString urlEndpoint;
          WideString service;
          WideString port;
          WideString proxyUser;
          WideString proxyPassword;
          WideString proxyUse;
          WideString proxyServer;
          WideString proxyPort;
          WideString authName;
          WideString authPassword;

          urlEndpoint  = "D:\\Client
Development\\savontest\\ITempConverter.wsdl";
          //'D:\Client Development\savontest\ITempConverter.wsdl
          service      = "ITempConverterservice";
          port         = "ITempConverterPort";

          httpRequest   = "ServerHTTPRequest";
          proxyUse      = "UseProxy";
          proxyServer   = "ProxyServer";
          proxyPort     = "ProxyPort";
          proxyUser     = "ProxyUser";
          proxyPassword = "ProxyPassword";
          authName      = "AuthUser";
          authPassword  = "AuthPassword";

        // remove those setting before post to ng for obvious securuty
reasons :-))
          Variant ahtttp = "True";
          Variant avarin = "**********";
          Variant bvarin = "**********";
          Variant cvarin = "True";
          Variant dvarin = "***********";
          Variant evarin = "8080";
          Variant nvarin = "************";
          Variant pvarin = "***********";

        HRESULT hr =
soapClient.CreateInstance(Mssoaplib_tlb::CLSID_SoapClient);

        if (useProxyCB->Checked)
                hr = soapClient.set_ClientProperty(httpRequest,ahtttp);

        hr = soapClient->mssoapinit(urlEndpoint,service ,port , L"");

        if (useProxyCB->Checked)
        {
        hr = soapClient->set_ConnectorProperty(proxyUse,cvarin);
        hr = soapClient->set_ConnectorProperty(proxyServer,dvarin);
        hr = soapClient->set_ConnectorProperty(proxyPort,evarin);
        hr = soapClient->set_ConnectorProperty(proxyUser,avarin);
        hr = soapClient->set_ConnectorProperty(proxyPassword,bvarin);
        //hr = soapClient->set_ConnectorProperty(authName,nvarin);
        //hr = soapClient->set_ConnectorProperty(authPassword,pvarin);

        }

        DISPID dispid;
        DISPPARAMS dispparams;
        VARIANTARG params[1];
        TVariant result;
//        VARIANT result;
        EXCEPINFO ExceptInfo;

        WCHAR *pMethodName;

        pMethodName =  AnsiToOLESTR("CtoF");

//        pMethodName =  AnsiToOLESTR("NumToWords_English");
//       pMethodName =  AnsiToOLESTR("Add");

        dispid = 0;

        if (soapClient.IsBound())
        {
        // Get dispatch ID corrisponding to method name.
        hr = soapClient->GetIDsOfNames(IID_NULL, &pMethodName, 1,
LOCALE_SYSTEM_DEFAULT, &dispid);
        }
                // Set B parameter.
        VariantInit(&params[0]);
        params[0].vt = VT_INT;
        params[0].intVal = 35;

  /*
        VariantInit(&params[1]);
        params[1].vt = VT_INT;
        params[1].intVal = 25;
   */

        // Initialize DISPPARAMS structure.
        dispparams.cArgs = 1;
        dispparams.cNamedArgs = 0;
        dispparams.rgdispidNamedArgs = NULL;
        dispparams.rgvarg = params;
        // Prepare result variant.
        VariantInit(&result);

-->> here we got in to problems :-(((

        hr = soapClient->Invoke(dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT,
DISPATCH_METHOD,
                                                &dispparams, &result,
&ExceptInfo, 0);
        if(FAILED(hr))
        {
              // DisplayFault(_T("Invoke of calc method failed."));
        }
        else
        {
                // Convert result to a string.
                VariantChangeType(&result, &result, 0, VT_BSTR);

                // Display result.
                AnsiString astring = result;
                ResultEdit->Text = astring ;
        }
/**********************************************************************/
Anyone else having this problem with Invoke method

dave

 

Re:Invoke() BCB 6 problem vs BCB 5


Hi Dave,

Someone else posted a few weeks ago that he was having problems in the
enterprise trial with Invoke(). When I got his project sure enough his
project had problems, but I couldn't recreate the problem so I don't
know how he got there. If you have steps to reproduce this please let me
know what they are.

The previous thread can be found at:

http://groups.google.com/groups?q=%22Early+Ehlinger%22+Invoke&hl=en&s...

Chris

Quote
dave wrote:
> Hi fellows,

> I've got the following problem with BCB 6 (std ed. )

> The Invoke method doesn't seems to behave normally in BCB 6.
> The folowing code works well with BCB 5 (copy pasted as is from BCB 6 proj)
> not with BCB 6, it fails on the Invoke (..) call.  It seems to be a major
> bug

> /*****************************************************************/
>          TCOMISOAPClient soapClient;

>           WideString httpRequest;
>           WideString urlEndpoint;
>           WideString service;
>           WideString port;
>           WideString proxyUser;
>           WideString proxyPassword;
>           WideString proxyUse;
>           WideString proxyServer;
>           WideString proxyPort;
>           WideString authName;
>           WideString authPassword;

>           urlEndpoint  = "D:\\Client
> Development\\savontest\\ITempConverter.wsdl";
>           //'D:\Client Development\savontest\ITempConverter.wsdl
>           service      = "ITempConverterservice";
>           port         = "ITempConverterPort";

>           httpRequest   = "ServerHTTPRequest";
>           proxyUse      = "UseProxy";
>           proxyServer   = "ProxyServer";
>           proxyPort     = "ProxyPort";
>           proxyUser     = "ProxyUser";
>           proxyPassword = "ProxyPassword";
>           authName      = "AuthUser";
>           authPassword  = "AuthPassword";

>         // remove those setting before post to ng for obvious securuty
> reasons :-))
>           Variant ahtttp = "True";
>           Variant avarin = "**********";
>           Variant bvarin = "**********";
>           Variant cvarin = "True";
>           Variant dvarin = "***********";
>           Variant evarin = "8080";
>           Variant nvarin = "************";
>           Variant pvarin = "***********";

>         HRESULT hr =
> soapClient.CreateInstance(Mssoaplib_tlb::CLSID_SoapClient);

>         if (useProxyCB->Checked)
>                 hr = soapClient.set_ClientProperty(httpRequest,ahtttp);

>         hr = soapClient->mssoapinit(urlEndpoint,service ,port , L"");

>         if (useProxyCB->Checked)
>         {
>         hr = soapClient->set_ConnectorProperty(proxyUse,cvarin);
>         hr = soapClient->set_ConnectorProperty(proxyServer,dvarin);
>         hr = soapClient->set_ConnectorProperty(proxyPort,evarin);
>         hr = soapClient->set_ConnectorProperty(proxyUser,avarin);
>         hr = soapClient->set_ConnectorProperty(proxyPassword,bvarin);
>         //hr = soapClient->set_ConnectorProperty(authName,nvarin);
>         //hr = soapClient->set_ConnectorProperty(authPassword,pvarin);

>         }

>         DISPID dispid;
>         DISPPARAMS dispparams;
>         VARIANTARG params[1];
>         TVariant result;
> //        VARIANT result;
>         EXCEPINFO ExceptInfo;

>         WCHAR *pMethodName;

>         pMethodName =  AnsiToOLESTR("CtoF");

> //        pMethodName =  AnsiToOLESTR("NumToWords_English");
> //       pMethodName =  AnsiToOLESTR("Add");

>         dispid = 0;

>         if (soapClient.IsBound())
>         {
>         // Get dispatch ID corrisponding to method name.
>         hr = soapClient->GetIDsOfNames(IID_NULL, &pMethodName, 1,
> LOCALE_SYSTEM_DEFAULT, &dispid);
>         }
>                 // Set B parameter.
>         VariantInit(&params[0]);
>         params[0].vt = VT_INT;
>         params[0].intVal = 35;

>   /*
>         VariantInit(&params[1]);
>         params[1].vt = VT_INT;
>         params[1].intVal = 25;
>    */

>         // Initialize DISPPARAMS structure.
>         dispparams.cArgs = 1;
>         dispparams.cNamedArgs = 0;
>         dispparams.rgdispidNamedArgs = NULL;
>         dispparams.rgvarg = params;
>         // Prepare result variant.
>         VariantInit(&result);

> -->> here we got in to problems :-(((

>         hr = soapClient->Invoke(dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT,
> DISPATCH_METHOD,
>                                                 &dispparams, &result,
> &ExceptInfo, 0);
>         if(FAILED(hr))
>         {
>               // DisplayFault(_T("Invoke of calc method failed."));
>         }
>         else
>         {
>                 // Convert result to a string.
>                 VariantChangeType(&result, &result, 0, VT_BSTR);

>                 // Display result.
>                 AnsiString astring = result;
>                 ResultEdit->Text = astring ;
>         }
> /**********************************************************************/
> Anyone else having this problem with Invoke method

> dave

Re:Invoke() BCB 6 problem vs BCB 5


Yes I saw that post but it was a com object created with BCB6 which failed
when invoked from a VB client.
So since it's not 'my' com object I think I can't create my own Invoke()
method.

My problem (could be related to the Builder implem of Invoke()) occurs with
the MSSOAP toolkit v2.
I tried the 'same' code from different types of clients (excell, VBScript,
Delphi, BCB5) all worked fine except BCB 6.
Unfortunatly my copy of BCB 6 is the standard one so I could not do a big
debug session since I have no
source code with that edition (our bosses doesn't seem to want to upgrade
BCB anymore so I bought the std
edtion from my pocket  ;-((  )

As stated in my previous post the exact same code (just copy and paste)
worked like a charm in BCB 5 Ent. ed.

Maybe I wil try it with the BCB 6 Entreprise trial if I find some time (and
a non prod machine) to install it and try it.
Does the trial come with source code ? if not it will not change anything.

Quote
"Chris Bensen" <nom...@borland.com> wrote in message

news:3CC6CCD1.6000208@borland.com...
Quote
> Hi Dave,

> Someone else posted a few weeks ago that he was having problems in the
> enterprise trial with Invoke(). When I got his project sure enough his
> project had problems, but I couldn't recreate the problem so I don't
> know how he got there. If you have steps to reproduce this please let me
> know what they are.

> The previous thread can be found at:

http://groups.google.com/groups?q=%22Early+Ehlinger%22+Invoke&hl=en&s...
e2899_1%40dnews&rnum=1
Quote

> Chris

> dave wrote:

> > Hi fellows,

> > I've got the following problem with BCB 6 (std ed. )

> > The Invoke method doesn't seems to behave normally in BCB 6.
> > The folowing code works well with BCB 5 (copy pasted as is from BCB 6
proj)
> > not with BCB 6, it fails on the Invoke (..) call.  It seems to be a
major
> > bug

> > /*****************************************************************/
> >          TCOMISOAPClient soapClient;

> >           WideString httpRequest;
> >           WideString urlEndpoint;
> >           WideString service;
> >           WideString port;
> >           WideString proxyUser;
> >           WideString proxyPassword;
> >           WideString proxyUse;
> >           WideString proxyServer;
> >           WideString proxyPort;
> >           WideString authName;
> >           WideString authPassword;

> >           urlEndpoint  = "D:\\Client
> > Development\\savontest\\ITempConverter.wsdl";
> >           //'D:\Client Development\savontest\ITempConverter.wsdl
> >           service      = "ITempConverterservice";
> >           port         = "ITempConverterPort";

> >           httpRequest   = "ServerHTTPRequest";
> >           proxyUse      = "UseProxy";
> >           proxyServer   = "ProxyServer";
> >           proxyPort     = "ProxyPort";
> >           proxyUser     = "ProxyUser";
> >           proxyPassword = "ProxyPassword";
> >           authName      = "AuthUser";
> >           authPassword  = "AuthPassword";

> >         // remove those setting before post to ng for obvious securuty
> > reasons :-))
> >           Variant ahtttp = "True";
> >           Variant avarin = "**********";
> >           Variant bvarin = "**********";
> >           Variant cvarin = "True";
> >           Variant dvarin = "***********";
> >           Variant evarin = "8080";
> >           Variant nvarin = "************";
> >           Variant pvarin = "***********";

> >         HRESULT hr =
> > soapClient.CreateInstance(Mssoaplib_tlb::CLSID_SoapClient);

> >         if (useProxyCB->Checked)
> >                 hr = soapClient.set_ClientProperty(httpRequest,ahtttp);

> >         hr = soapClient->mssoapinit(urlEndpoint,service ,port , L"");

> >         if (useProxyCB->Checked)
> >         {
> >         hr = soapClient->set_ConnectorProperty(proxyUse,cvarin);
> >         hr = soapClient->set_ConnectorProperty(proxyServer,dvarin);
> >         hr = soapClient->set_ConnectorProperty(proxyPort,evarin);
> >         hr = soapClient->set_ConnectorProperty(proxyUser,avarin);
> >         hr = soapClient->set_ConnectorProperty(proxyPassword,bvarin);
> >         //hr = soapClient->set_ConnectorProperty(authName,nvarin);
> >         //hr = soapClient->set_ConnectorProperty(authPassword,pvarin);

> >         }

> >         DISPID dispid;
> >         DISPPARAMS dispparams;
> >         VARIANTARG params[1];
> >         TVariant result;
> > //        VARIANT result;
> >         EXCEPINFO ExceptInfo;

> >         WCHAR *pMethodName;

> >         pMethodName =  AnsiToOLESTR("CtoF");

> > //        pMethodName =  AnsiToOLESTR("NumToWords_English");
> > //       pMethodName =  AnsiToOLESTR("Add");

> >         dispid = 0;

> >         if (soapClient.IsBound())
> >         {
> >         // Get dispatch ID corrisponding to method name.
> >         hr = soapClient->GetIDsOfNames(IID_NULL, &pMethodName, 1,
> > LOCALE_SYSTEM_DEFAULT, &dispid);
> >         }
> >                 // Set B parameter.
> >         VariantInit(&params[0]);
> >         params[0].vt = VT_INT;
> >         params[0].intVal = 35;

> >   /*
> >         VariantInit(&params[1]);
> >         params[1].vt = VT_INT;
> >         params[1].intVal = 25;
> >    */

> >         // Initialize DISPPARAMS structure.
> >         dispparams.cArgs = 1;
> >         dispparams.cNamedArgs = 0;
> >         dispparams.rgdispidNamedArgs = NULL;
> >         dispparams.rgvarg = params;
> >         // Prepare result variant.
> >         VariantInit(&result);

> > -->> here we got in to problems :-(((

> >         hr = soapClient->Invoke(dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT,
> > DISPATCH_METHOD,
> >                                                 &dispparams, &result,
> > &ExceptInfo, 0);
> >         if(FAILED(hr))
> >         {
> >               // DisplayFault(_T("Invoke of calc method failed."));
> >         }
> >         else
> >         {
> >                 // Convert result to a string.
> >                 VariantChangeType(&result, &result, 0, VT_BSTR);

> >                 // Display result.
> >                 AnsiString astring = result;
> >                 ResultEdit->Text = astring ;
> >         }
> > /**********************************************************************/
> > Anyone else having this problem with Invoke method

> > dave

Re:Invoke() BCB 6 problem vs BCB 5


What are your steps? I want to recreate this problem but I need the steps.

 > Does the trial come with source code ?

I don't know.

Chris

Re:Invoke() BCB 6 problem vs BCB 5


Ok Chris I wil try to go through step by step on what I did.

Download the MS SOAP toolkit , installed (register and so on) .
I imported the latest SOAP toolkit typelib in BCB 6. That went fine without
any conflict.

Then I just tried to copy some part of the MS Soap samples. I made some
minor changes just to adapt to different types tha MS and Borland use. The
code I used was in my first post but I am going to post a verry small test
app wich worked well in BCB 5 and not in BCB 6.

The Web service is one wich converts temperatures from Centigrades to
Fahreneits (and reverse) it's one wich was implented with Delphi.This web
service is to be found at Xmethods,   but I will post the wsdl file with the
sample since the test app looks for it locally.

any way thanks for looking after it.

David

Quote
"Chris Bensen" <nom...@borland.com> wrote in message

news:3CC993F6.2050700@borland.com...
Quote
> What are your steps? I want to recreate this problem but I need the steps.

>  > Does the trial come with source code ?

> I don't know.

> Chris

Re:Invoke() BCB 6 problem vs BCB 5


Excellent. Thank you! I'll let you know what I find.

Chris

Quote
dave wrote:
> Ok Chris I wil try to go through step by step on what I did.

> Download the MS SOAP toolkit , installed (register and so on) .
> I imported the latest SOAP toolkit typelib in BCB 6. That went fine without
> any conflict.

> Then I just tried to copy some part of the MS Soap samples. I made some
> minor changes just to adapt to different types tha MS and Borland use. The
> code I used was in my first post but I am going to post a verry small test
> app wich worked well in BCB 5 and not in BCB 6.

> The Web service is one wich converts temperatures from Centigrades to
> Fahreneits (and reverse) it's one wich was implented with Delphi.This web
> service is to be found at Xmethods,   but I will post the wsdl file with the
> sample since the test app looks for it locally.

> any way thanks for looking after it.

> David

> "Chris Bensen" <nom...@borland.com> wrote in message
> news:3CC993F6.2050700@borland.com...

>>What are your steps? I want to recreate this problem but I need the steps.

>> > Does the trial come with source code ?

>>I don't know.

>>Chris

Re:Invoke() BCB 6 problem vs BCB 5


Dave,

Here is something to try. In sysvari.h comment out TAutoArgsBase through
TAutoArgs. Right now it is wraped in a preprocessor directive of
__AUTOARGS_DEFINED, just commented from line 1260:

#if !defined(__AUTOARGS_DEFINED)

to line 1134:

#endif

then include utlcls.h after vcl.h and let me know if things changed.

Chris

Re:Invoke() BCB 6 problem vs BCB 5


thanks Chris, halas commenting lines 1260 to 1334 didn't help, the
SoapClient->Invoke() call still fails.

Quote
"Chris Bensen" <nom...@borland.com> wrote in message

news:3CCDDD73.4000701@borland.com...
Quote
> Dave,

> Here is something to try. In sysvari.h comment out TAutoArgsBase through
> TAutoArgs. Right now it is wraped in a preprocessor directive of
> __AUTOARGS_DEFINED, just commented from line 1260:

> #if !defined(__AUTOARGS_DEFINED)

> to line 1134:

> #endif

> then include utlcls.h after vcl.h and let me know if things changed.

> Chris

Re:Invoke() BCB 6 problem vs BCB 5


What was it suppose to change Chris ?

Quote
"Chris Bensen" <nom...@borland.com> wrote in message

news:3CCDDD73.4000701@borland.com...
Quote
> Dave,

> Here is something to try. In sysvari.h comment out TAutoArgsBase through
> TAutoArgs. Right now it is wraped in a preprocessor directive of
> __AUTOARGS_DEFINED, just commented from line 1260:

> #if !defined(__AUTOARGS_DEFINED)

> to line 1134:

> #endif

> then include utlcls.h after vcl.h and let me know if things changed.

> Chris

Re:Invoke() BCB 6 problem vs BCB 5


Stranger and stranger ...

I stated in my earlier post that the sample I posted worked fine with BCB 5.
(except that I included the wrong wsdl file with the sample, ;-(( )
It was indeed, BUT with the imported TLB's from BCB 6.
If I try the same with the imported TLB from BCB 5. it fails the same way.
Losing my poor C++ on it :-((

Well I guess I will have to stay with BCB 5 and use the typelib importer
from BCB 6. :-?

Quote
"Chris Bensen" <nom...@borland.com> wrote in message

news:3CCDDD73.4000701@borland.com...
Quote
> Dave,

> Here is something to try. In sysvari.h comment out TAutoArgsBase through
> TAutoArgs. Right now it is wraped in a preprocessor directive of
> __AUTOARGS_DEFINED, just commented from line 1260:

> #if !defined(__AUTOARGS_DEFINED)

> to line 1134:

> #endif

> then include utlcls.h after vcl.h and let me know if things changed.

> Chris

Re:Invoke() BCB 6 problem vs BCB 5


You don't want to use the TAutoArgsBase in sysvari since it uses the
Delphi Variant.

Chris

Quote
dave wrote:
> What was it suppose to change Chris ?

> "Chris Bensen" <nom...@borland.com> wrote in message
> news:3CCDDD73.4000701@borland.com...

>>Dave,

>>Here is something to try. In sysvari.h comment out TAutoArgsBase through
>>TAutoArgs. Right now it is wraped in a preprocessor directive of
>>__AUTOARGS_DEFINED, just commented from line 1260:

>>#if !defined(__AUTOARGS_DEFINED)

>>to line 1134:

>>#endif

>>then include utlcls.h after vcl.h and let me know if things changed.

>>Chris

Other Threads