Article View: borland.public.cppbuilder.webservices.soap
Article #101Problem with using MSSOAP
From: Dean Mitchell
Date: Wed, 14 Jul 2004 05:04
Date: Wed, 14 Jul 2004 05:04
89 lines
4251 bytes
4251 bytes
I have built a SOAP client using CppBuilder 6 and the MSSOAP control, and it
works pretty alright apart from the fact that it works for a short period of
time and then return HTTP_NO_RESPONSE.
I believe that this is caused by the fact that after the request has been
sent and the reponse recieved the control is still connected to the HTTP
server. So I end up with an ever growing number of connections until the
program is shutdown. so this is the real problem.
I modified one of Microsofts sample programs to call the service and it
works fine, in fact the programs are almost identical apart from the
differences (WideString opposed to _bstr_t etc), so it doesn't look like the
control, I suspect it is Borlands rubbish implementation of COM and it is
not releasing one of the objects. I have tried calling UnBind on all the
objects as well as reset on the SOAP classes that support it but it made no
difference.
I commented out code and if I comment out the startEnvelope to EndEnvelope
it obviously doesn't work properly but I do not get this issue, although I
suspect it doesn't actually connect properly. If I comment out the code
inside the startBode and endBody, so it is an empty request it eventually
fails with HTTP_NO_RESPONSE.
I am pulling my hair out here, so if someone can help me out that would be
greatly appreciated, below is the relevent code.
Thanks for your time
Dean Mitchell
ISoapSerializerPtr Serializer;
ISoapReaderPtr Reader;
ISoapConnectorPtr Connector;
IStreamPtr Stream;
//Create the connector object
hr = Connector.CreateInstance(CLSID_HttpConnector);
if (FAILED(hr))
throw Exception("Could not create instance of ISoapConnector");
OleCheck(Connector->set_Property(WideString("EndPointURL"),TVariant(Cfg.GetP
rimary().c_str())));
OleCheck(Connector->set_Property(WideString("SoapAction"),TVariant(Cfg.GetUR
I().c_str())));
OleCheck(Connector->BeginMessage());
//Create the serializer
hr = Serializer.CreateInstance(CLSID_SoapSerializer);
if (FAILED(hr))
throw Exception("Could not create instance of ISoapSerializer");
Stream = Connector->InputStream;
OleCheck(Serializer->Init(TVariant((IUnknown*)Stream)));
// Build the SOAP Message.
Serializer->startEnvelope(WideString(""),WideString("NONE"),WideString(""));
Serializer->SoapNamespace(WideString("xsi"),WideString("http://www.w3.org/19
99/XMLSchema-instance"));
Serializer->SoapNamespace(WideString("xsd"),WideString("http://www.w3.org/19
99/XMLSchema"));
Serializer->startBody(WideString("NONE"));
Serializer->startElement(WideString("LocalTimeRetrieve"),WideString(Cfg.GetU
RI().c_str()),WideString("NONE"),WideString("ns1"));
Serializer->startElement(WideString("Argument1"),WideString(""),WideString("
NONE"),WideString(""));
Serializer->SoapAttribute(WideString("xsi:type"),WideString(""),WideString("
xsd:string"),WideString(""));
sprintf(szRequest,"<Runway_LocalTimeRetrieveRQ
xsi:type=\"xsd:string\"><Location
xsi:type=\"xsd:string\">%s</Location></Runway_LocalTimeRetrieveRQ>",szTimeZo
ne);
Serializer->writeString(WideString(szRequest));
Serializer->endElement();
Serializer->endElement();
Serializer->endBody();
Serializer->endEnvelope();
// Send the message to the XML Web service.
OleCheck(Connector->EndMessage());
Technical Details
Message-ID:
<40f4bebd$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 11096a,3cec10b879f4b20d,start X-Google-Attributes: gid11096a,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Dean Mitchell" <not@this.address> Newsgroups: borland.public.cppbuilder.webservices.soap Subject: Problem with using MSSOAP Date: Wed, 14 Jul 2004 17:04:38 +1200 Lines: 93 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 210.54.152.164 Message-ID: <40f4bebd$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1089781437 210.54.152.164 (13 Jul 2004 22:03:57 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail