Objectmix
Tags Register Mark Forums Read

SOAP Toolkit 3.0. Problem passing arguments : XML SOAP

This is a discussion on SOAP Toolkit 3.0. Problem passing arguments within the XML SOAP forums in Framework and Interface Programming category; I've got a web service written in .net that I'm trying to pass arguments to from a C++ 6.0 application using the MS Soap Toolkit 3.0. I've tried several different methods of connecting and passing the arguments, and when the request gets to the .net service, the argument values are either blank or null. I can receive data back from the service, but it doesn't receive the arguments I'm passing to it. I've included the pseudo-code for two methods that I've tried: ISoapClientPtr spSoapClient(); spClient.CreateInstance(__uuidof(SoapClient30)); spClient->MSSoapInit(""http://localhost/MyService/MyService.asmx?WSDL", L"", L"", L""); WCHAR* pwcMethodName = L"MyTestMethod"; DISPID dispidFn = 0; hr = spClient->GetIDsOfNames(IID_NULL, ...


Object Mix > Framework and Interface Programming > XML SOAP > SOAP Toolkit 3.0. Problem passing arguments

Reply

 

LinkBack Thread Tools
  #1  
Old 10-02-2004, 03:37 PM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default SOAP Toolkit 3.0. Problem passing arguments

I've got a web service written in .net that I'm trying to pass arguments to
from a C++ 6.0 application using the MS Soap Toolkit 3.0. I've tried
several different methods of connecting and passing the arguments, and when
the request gets to the .net service, the argument values are either blank
or null. I can receive data back from the service, but it doesn't receive
the arguments I'm passing to it. I've included the pseudo-code for two
methods that I've tried:

ISoapClientPtr spSoapClient();
spClient.CreateInstance(__uuidof(SoapClient30));
spClient->MSSoapInit(""http://localhost/MyService/MyService.asmx?WSDL", L"",
L"", L"");

WCHAR* pwcMethodName = L"MyTestMethod";
DISPID dispidFn = 0;
hr = spClient->GetIDsOfNames(IID_NULL, &pwcMethodName, 1,
LOCALE_SYSTEM_DEFAULT, &dispidFn);
unsigned int uArgErr;

VARIANT varg[4];
varg[0].vt = VT_BSTR;
varg[0].bstrVal = "arg1text";
varg[1].vt = VT_BSTR;
varg[1].bstrVal = L"arg2text";
varg[2].vt = VT_BSTR;
varg[2].bstrVal = L"arg3text";
varg[3].vt = VT_BSTR;
varg[3].bstrVal = L"Body Shop"; // Body Shop

DISPPARAMS params;
params.cArgs = 4;
params.rgvarg = varg;
params.cNamedArgs = 0;
params.rgdispidNamedArgs = NULL;
_variant_t result;
uArgErr = -1;
EXCEPINFO excepInfo;
ZeroMemory(&excepInfo, sizeof(excepInfo));

hr = m_spClient->Invoke(
dispidFn,
IID_NULL,
LOCALE_SYSTEM_DEFAULT,
DISPATCH_METHOD,
&params,
&result,
&excepInfo,
&uArgErr);


When I invoke my web service method using this code, the arguments come
through the server as blanks. When running it through the XML Trace
program, I get the following in the request:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<SOAP-ENV:Envelope xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema"
xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<MyTestMethod xmlns="http://tempuri.org/">
<arg1 xmlns:SOAPSDK4="http://tempuri.org/" />
<arg2 xmlns:SOAPSDK5="http://tempuri.org/" />
<arg3 xmlns:SOAPSDK6="http://tempuri.org/" />
<arg4 xmlns:SOAPSDK7="http://tempuri.org/" />
</MyTestMethod>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

I can see from the trace that the argument values I've passed to the
"Invoke" function are not getting encoded into the XML request. It makes
sense that when I debug the .NET server, that the values come through as
blank. I am at a loss for why the argument values are not getting encoded.
From the samples I've found, I can't see a problem with what I'm doing.

The second method I've tried is as follows:

_bstr_t bstrURL = http://localhost/MyTestService/MyTestService.asmx;
ISoapConnectorPtr spConnector(__uuidof(HttpConnector30));
spConnector->Property[L"EndPointURL"] = bstrURL;
spConnector->Connect();
ISoapSerializerPtr spSerializer(__uuidof(SoapSerializer30));
spSerializer->Init(IUnknown*)spConnector->InputStream);
spConnector->BeginMessage();
spSerializer->StartEnvelope(L"",
L"http://schemas.xmlsoap.org/soap/encoding/", L"");
spSerializer->SoapAttribute(L"xsi", L"",
L"http://www.w3.org/2001/XMLSchema-instance", L"xmlns");
spSerializer->SoapAttribute(L"xsd", L"",
L"http://www.w3.org/2001/XMLSchema", L"xmlns");
spSerializer->StartBody(L"NONE");
spSerializer->StartElement("MyTestMethod", L"", L"NONE", L"");
spSerializer->StartElement(L"arg1", L"", L"NONE", L"");
spSerializer->SoapAttribute(L"xsi:type", L"", L"xsd:string", L"");
spSerializer->WriteString((_bstr_t) (_variant_t)"arg1text");
spSerializer->EndElement();
spSerializer->StartElement(L"arg2", L"", L"NONE", L"");
spSerializer->SoapAttribute(L"xsi:type", L"", L"xsd:string", L"");
spSerializer->WriteString((_bstr_t) (_variant_t)"arg2text");
spSerializer->EndElement();
..
..
..
spSerializer->EndElement();
spSerializer->EndBody();
spSerializer->EndEnvelope();
spConnector->EndMessage();

When I execute the above code, the arguments come through as null. Running
the XML Trace, I get the following:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema"
xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<SOAPSDK4:MyTestMethod xmlns:SOAPSDK4="http://tempuri.org/">
<arg1 xsi:type="xsd:string">arg1text</arg1>
<arg2 xsi:type="xsd:string">arg2text</arg2>
<arg3 xsi:type="xsd:string">arg3text</arg3>
<arg4 xsi:type="xsd:string">arg4</arg4>
</SOAPSDK4:MyTestMethod>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

In this case, the arguments are being encoded into the XLM, but the .net
service appears to not be able to extract them. The arguments come through
as null, as though they aren't being passed at all.

In either case, I've referenced a lot of sample code, and it looks like what
I'm doing is correct. It's apparently not, but I can't find anything that
would suggest what I'm missing here. If anyone has any insight into what
might be going on here, I'd appreciate it. Thank you.


  #2  
Old 10-06-2004, 02:10 PM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default RE: SOAP Toolkit 3.0. Problem passing arguments


I have seen this issue before if the encoding binding-style is mismatched
between the webservice client and the server. Soap Toolkit 3.0 uses
RPC-encoded however .Net uses Document-Literal. If you have control over
the webservice please try adding tthe [SoapRpcMethod] attribute to the web
service. For example,

[WebMethod]
[SoapRpcMethod]
public string HelloWorld()
{
return "Hello World";
}

The above would make the HelloWorld webmethod to use RPC-Encoded
binding-style.

Hope that helps,
Engels Rajangam
Microsoft Developer Support - Internet

Please do not send email directly to this alias. This is our online account
name for newsgroup participation only.

This posting is provided “AS IS” with no warranties, and confers no rights.
You assume all risk for your use. © 2001 Microsoft Corporation. All rights
reserved.


  #3  
Old 10-06-2004, 03:43 PM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: SOAP Toolkit 3.0. Problem passing arguments

Thank you for the information, I'll give it a try and let you know how it
works out. Thanks again.

"Engels Rajangam" <engelsronline@microsoft.com> wrote in message
news8uHwg9qEHA.3636@cpmsftngxa06.phx.gbl...
>
> I have seen this issue before if the encoding binding-style is mismatched
> between the webservice client and the server. Soap Toolkit 3.0 uses
> RPC-encoded however .Net uses Document-Literal. If you have control over
> the webservice please try adding tthe [SoapRpcMethod] attribute to the web
> service. For example,
>
> [WebMethod]
> [SoapRpcMethod]
> public string HelloWorld()
> {
> return "Hello World";
> }
>
> The above would make the HelloWorld webmethod to use RPC-Encoded
> binding-style.
>
> Hope that helps,
> Engels Rajangam
> Microsoft Developer Support - Internet
>
> Please do not send email directly to this alias. This is our online

account
> name for newsgroup participation only.
>
> This posting is provided "AS IS" with no warranties, and confers no

rights.
> You assume all risk for your use. © 2001 Microsoft Corporation. All rights
> reserved.
>
>



  #4  
Old 10-26-2004, 05:54 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: SOAP Toolkit 3.0. Problem passing arguments

Hi,

I have had the same problem. Can you tell me please if you have fixed
the problem and how?

Thank you in advance



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Reply

Thread Tools


Similar Threads

Thread Thread Starter Forum Replies Last Post
PLEASE HELP - Odd problem passing function arguments usenet C 8 10-05-2007 05:30 PM
strange arguments passing problem (from vba to fortran dll) usenet Fortran 0 05-28-2007 05:01 PM
Passing arguments through SOAP to a webservice usenet XML SOAP 2 03-05-2006 02:18 AM
Passing array parameter in VB with low level SOAP Toolkit 3.0 usenet XML SOAP 3 03-18-2005 12:40 PM


All times are GMT -5. The time now is 08:43 AM.

Managed by Infnx Pvt Ltd.