Board index » cppbuilder » HELP - AV when calling a web-service from inside a web-service

HELP - AV when calling a web-service from inside a web-service


2007-09-21 08:13:16 PM
cppbuilder22
(Re-posted from another group).
BCB6 patched.
I have an ISAPI web-service (MyWebService1) which internally calls another
web-service (MyWebService2) on another server. This call on all machines
(but my own) throws an EAccessViolation.
1) I have implimented the fixes described at QualityCentral that require
some rebuilding of the VCL (for bugs inside xmldoc, wsdlnode and
OpToSoapDomConv). And for years this has been working just fine. Now
however I have had to add the call from inside the ISAPI (MyWebService1) to
a different web-service elsewhere (MyWebService2) and I am having the issue.
2) MyWebService1 is a static build (no runtime packages, no dynamic RTL).
3) On my machine it works every time. (Except in one case - read on). On
other machines it fails every time. The web-app de{*word*81} module version
works every time on all machines.
4) I wrote a simple win32 test application that uses the exact same import
of MyWebService2 to invoke the methods and it works fine every time on all
machines.
5) On other machines an AV is thrown when any method of the interface is
called. The interface pointer is obtained normally and is definitely not
NULL. It doesnt matter which method I call, all methods {*word*88} the same
way.
6) From monitoring the code and communication on the remote machine - the
call is defiinitely not being transmitted.
In trying to trace to the point to where the AV happens, I have been adding
OutputDebugString() to the code into deeper and deeper layers and then
executing it on another machine (which shows the bad behaviour). I do not
have remote debugging unfortunately. Finally I have found myself inside
TRIO.Generic. and TRIO.GenericStub. (Found inside unit RIO.pas) and I still
can not seem to locate it.
First I tried adding a message inside Generic() and found it was too late -
GenericStub seemed to be throwing the Exception. Fine, so I added a message
to GenericStub as the first line. Still it doesnt seem early enough...
where the hell is this thring throwing the AV from? It does not seem to be
any of the units I have rebuilt from the VCL (the only one involved seems to
be OpToSoapDomConv and its methods dont get called before the AV happens).
Why cant I reproduce it on my machine? Every other machine has the problem
(I stinks like a machine config problem - but I cant see it, I have triple
checked everything I can think of). And I am fairly certain it is a static
link - so all the dependencies should be taken care of.... what am I
missing?
Here is some code:
bool __fastcall TMyWebService1::DoStuff(AnsiString & AServerErrorMsg)
{
// get the ws interface pointer (I have tried several combinations
// of UseWSDL and Addr in this call, all with the same results)
_di_IMyWebService2 pIPS = GetIMyWebService2(true);
if (!pIPS)
freak out;
// call a method:
const int InterfaceVer = pIPS->InterfaceVersion();
// ** crashes before the method is actually sent.
}
Any ideas?
HELP!
 
 

Re:HELP - AV when calling a web-service from inside a web-service

Hello const * const char ME,
Quote
bool __fastcall TMyWebService1::DoStuff(AnsiString & AServerErrorMsg)
{
_di_IMyWebService2 pIPS = GetIMyWebService2(true);
Check pIPS - it's obviously not NULL but I don't think your constructor is
working properly. Can you post your constructor code?
 

Re:HELP - AV when calling a web-service from inside a web-service

"Brian" < XXXX@XXXXX.COM >wrote
Quote
Check pIPS - it's obviously not NULL but I don't think your constructor is
working properly. Can you post your constructor code?
It is the auto generated one that the IDE creates when you import a
web-service. This kind of constructor I have used for years on several
web-services with no issue.... Hmmm
//
_di_IMyWebService2 GetIMyWebService2 (bool useWSDL, AnsiString addr)
{
static const char* defWSDL=
"changed.for.privacy.reasons/isapimodule.dll/wsdl/IMyWebService2";
static const char* defURL =
"changed.for.privacy.reasons/isapimodule.dll/soap/IMyWebService2";
static const char* defSvc = "IMyWebService2";
static const char* defPrt = "IMyWebService2";
if (addr=="")
addr = useWSDL ? defWSDL : defURL;
THTTPRIO* rio = new THTTPRIO(0);
if (useWSDL) {
rio->WSDLLocation = addr;
rio->Service = defSvc;
rio->Port = defPrt;
} else {
rio->URL = addr;
}
_di_ISSPartnerSecurity service;
rio->QueryInterface(service);
if (!service)
delete rio;
return service;
}
 

{smallsort}

Re:HELP - AV when calling a web-service from inside a web-service

Hello const * const char ME,
Quote
>
It is the auto generated one that the IDE creates when you import a
web-service. This kind of constructor I have used for years on
several web-services with no issue.... Hmmm
_di_IMyWebService2 GetIMyWebService2 (bool useWSDL, AnsiString addr)
_di_ISSPartnerSecurity service;
return service;
You are calling a method with a return of cast '_di_IMyWebService2' but you
are returning a value with a cast of '_di_ISSPartnerSecurity'. Change one
to the other (I not sure which class is the one you are needing) and your
problems should be solved.
 

Re:HELP - AV when calling a web-service from inside a web-service

Sorry - my apologies. The code I posted was manually edited to match the
identifiers in the OP. (Which were modified). And, I made a mistake.
In fact _di_IMyWebService2 is the manually edited version of
_di_ISSPartnerSecurity.
here is a copy of the ACTUAL code (with the exception of the URL's which I
modified for privacy reasons):
//
_di_ISSPartnerSecurity GetISSPartnerSecurity(bool useWSDL, AnsiString addr)
{
static const char* defWSDL=
"changed.com/partnersecurity/partnersecurity.dll/wsdl/ISSPartnerSecurity";
static const char* defURL =
"changed.com/partnersecurity/partnersecurity.dll/soap/ISSPartnerSecurity";
static const char* defSvc = "ISSPartnerSecurityservice";
static const char* defPrt = "ISSPartnerSecurityPort";
if (addr=="")
addr = useWSDL ? defWSDL : defURL;
THTTPRIO* rio = new THTTPRIO(0);
if (useWSDL) {
rio->WSDLLocation = addr;
rio->Service = defSvc;
rio->Port = defPrt;
} else {
rio->URL = addr;
}
_di_ISSPartnerSecurity service;
rio->QueryInterface(service);
if (!service)
delete rio;
return service;
}
"Brian" < XXXX@XXXXX.COM >wrote in message
Quote
Hello const * const char ME,

>>
>It is the auto generated one that the IDE creates when you import a
>web-service. This kind of constructor I have used for years on
>several web-services with no issue.... Hmmm

>_di_IMyWebService2 GetIMyWebService2 (bool useWSDL, AnsiString addr)

>_di_ISSPartnerSecurity service;

>return service;

You are calling a method with a return of cast '_di_IMyWebService2' but
you are returning a value with a cast of '_di_ISSPartnerSecurity'. Change
one to the other (I not sure which class is the one you are needing) and
your problems should be solved.