Ask a Question related to ASP.NET Web Services, Design and Development.
-
Jared #1
Proxy class not reading data returned in SOAP response
I'm trying to create a .NET client to consume a Java web service. The
company that owns the web service does not publish a WSDL, but they do
publish an API document with examples of each supported request and
its corresponding response.
I've manually created a WSDL file based on their examples, and
generated a proxy class using WSDL.EXE. The proxy class appears to
send a valid request because I can see a valid response coming back
using a network sniffer. However, when the proxy class calls
Invoke(), it returns an object[] of the correct length, but with each
element null.
------------------------------------------------------
Here's the SOAP response I'm getting from the server (some data
changed to protect the innocent):
<?xml version="1.0" encoding="UTF-8"?>
<?Some_Company_API version="1.0"?>
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body>
<m:TheResponse xmlns:m="Some API">
<element1 xsi:type="xsd:string">some data</element1>
<element2 xsi:type="xsd:string">some more data</element2>
</m:TheResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
------------------------------------------------------
------------------------------------------------------
Here's the method of the proxy class I'm calling:
[System.Web.Services.Protocols.SoapDocumentMethodAt tribute("http://tempuri.org/Login",
RequestNamespace="http://tempuri.org/",
ResponseNamespace="http://tempuri.org/",
Use=System.Web.Services.Description.SoapBindingUse .Literal,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Wrapped)]
[return: System.Xml.Serialization.XmlElementAttribute("elem ent1")]
public string Login(string param1, string param2, string param3, out
string element2) {
object[] results = this.Invoke("Login", new object[] {
param1,
param2,
param3});
element2 = ((string)(results[1]));
return ((string)(results[0]));
}
------------------------------------------------------
If I analyze results[] in breakmode, it has a length of 2, but each
element is null.
Is there something special I need to do to the proxy class to get it
to read the returned data?
TIA
Jared
Jared Guest
-
How to log raw SOAP response msg?
The .NET web service proxy class is great for transparent app process via SOAP calls. I have a need to log the raw SOAP response messages. Is... -
extract the soap message from the proxy class
Hi Is there a way to extract the soap message from the proxy class before its being sent to the web service? Thanks -
SOAP Response
I cannot get the Trace to work for my Web Service application or client. I need to be able to see the entire SOAP message (for documentation and... -
Typed dataset returned from webservice incorrectly defined in proxy - null value problem
I have a web service that has a xsd defined for a dataset. The xsd has all of the proper tables/elements, constraints, relations, etc. and works... -
How to write c# proxy class to get at this data?
Hi, I'm trying to use a wdsl generated proxy class to Invoke a web services method which outputs a soap envelope shown below. The response... -
Dino Chiesa [Microsoft] #2
Re: Proxy class not reading data returned in SOAP response
yes, I think you need to set your RequestNamespace and ResponseNamespace to
"Some API"
not [url]http://tempuri.org[/url].
-Dino
"Jared" <jaredljensen@hotmail.com> wrote in message
news:3264d672.0404271944.1e39ec79@posting.google.c om...SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> I'm trying to create a .NET client to consume a Java web service. The
> company that owns the web service does not publish a WSDL, but they do
> publish an API document with examples of each supported request and
> its corresponding response.
>
> I've manually created a WSDL file based on their examples, and
> generated a proxy class using WSDL.EXE. The proxy class appears to
> send a valid request because I can see a valid response coming back
> using a network sniffer. However, when the proxy class calls
> Invoke(), it returns an object[] of the correct length, but with each
> element null.
>
> ------------------------------------------------------
> Here's the SOAP response I'm getting from the server (some data
> changed to protect the innocent):
>
> <?xml version="1.0" encoding="UTF-8"?>
> <?Some_Company_API version="1.0"?>
> <SOAP-ENV:Envelope[System.Web.Services.Protocols.SoapDocumentMethodAt tribute("http://tempuri.o> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/1999/XMLSchema">
> <SOAP-ENV:Body>
> <m:TheResponse xmlns:m="Some API">
> <element1 xsi:type="xsd:string">some data</element1>
> <element2 xsi:type="xsd:string">some more data</element2>
> </m:TheResponse>
> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
> ------------------------------------------------------
>
> ------------------------------------------------------
> Here's the method of the proxy class I'm calling:
>
>
rg/Login",> RequestNamespace="http://tempuri.org/",
> ResponseNamespace="http://tempuri.org/",
> Use=System.Web.Services.Description.SoapBindingUse .Literal,
> ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Wrapped)]
> [return: System.Xml.Serialization.XmlElementAttribute("elem ent1")]
> public string Login(string param1, string param2, string param3, out
> string element2) {
> object[] results = this.Invoke("Login", new object[] {
> param1,
> param2,
> param3});
> element2 = ((string)(results[1]));
> return ((string)(results[0]));
> }
> ------------------------------------------------------
>
> If I analyze results[] in breakmode, it has a length of 2, but each
> element is null.
>
> Is there something special I need to do to the proxy class to get it
> to read the returned data?
>
> TIA
>
> Jared
Dino Chiesa [Microsoft] Guest
-
Jared #3
Re: Proxy class not reading data returned in SOAP response
"Dino Chiesa [Microsoft]" <dinoch@online.microsoft.com> wrote in message news:<#ApeU7OLEHA.1120@TK2MSFTNGP11.phx.gbl>...
Dino,> yes, I think you need to set your RequestNamespace and ResponseNamespace to
> "Some API"
> not [url]http://tempuri.org[/url].
>
> -Dino
>
I've updated the method attributes as shown below. I tried it with
and without setting the "ResponseElementName" param. It still fails
to populate results[], even though I'm still seeing a valid response
with my network sniffer.
----------------------------------------------------
[System.Web.Services.Protocols.SoapDocumentMethodAt tribute("http://tempuri.org/Login",
ResponseElementName="LoginResponse",
RequestNamespace="Some API",
ResponseNamespace="Some API",
Use=System.Web.Services.Description.SoapBindingUse .Literal,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Wrapped)]
[return: System.Xml.Serialization.XmlElementAttribute("elem ent1")]
public string Login(string param1, string param2, string param3, out
string element2) {
object[] results = this.Invoke("Login", new object[] {
param1,
param2,
param3});
element2 = ((string)(results[1]));
return ((string)(results[0]));
}
----------------------------------------------------
----------------------------------------------------
Is there anything wrong with my class attributes?
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Web.Services.WebServiceBindingAttribute(Nam e="SomeApiSoap",
Namespace="http://tempuri.org/")]
public class SomeApi :
System.Web.Services.Protocols.SoapHttpClientProtoc ol {
...
}
----------------------------------------------------
Thanks again,
Jared
Jared Guest
-
Jared Jensen #4
Re: Proxy class not reading data returned in SOAP response
[email]jaredljensen@hotmail.com[/email] (Jared) wrote in
news:3264d672.0404281117.2936771b@posting.google.c om:
("http://temp> "Dino Chiesa [Microsoft]" <dinoch@online.microsoft.com> wrote in
> message news:<#ApeU7OLEHA.1120@TK2MSFTNGP11.phx.gbl>...>>> yes, I think you need to set your RequestNamespace and
>> ResponseNamespace to "Some API"
>> not [url]http://tempuri.org[/url].
>>
>> -Dino
>>
> Dino,
>
> I've updated the method attributes as shown below. I tried it with
> and without setting the "ResponseElementName" param. It still fails
> to populate results[], even though I'm still seeing a valid response
> with my network sniffer.
>
> ----------------------------------------------------
> [System.Web.Services.Protocols.SoapDocumentMethodAt tributep> uri.org/Login",
> ResponseElementName="LoginResponse",
> RequestNamespace="Some API",
> ResponseNamespace="Some API",
> Use=System.Web.Services.Description.SoapBindingUse .Literal,
> ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.WrapHere's my own answer based on the following post:> ed)]
> [return: System.Xml.Serialization.XmlElementAttribute("elem ent1")]
> public string Login(string param1, string param2, string param3, out
> string element2) {
> object[] results = this.Invoke("Login", new object[] {
> param1,
> param2,
> param3});
> element2 = ((string)(results[1]));
> return ((string)(results[0]));
> }
> ----------------------------------------------------
>
>
> ----------------------------------------------------
> Is there anything wrong with my class attributes?
>
> [System.Diagnostics.DebuggerStepThroughAttribute()]
> [System.ComponentModel.DesignerCategoryAttribute("c ode")]
> [System.Web.Services.WebServiceBindingAttribute(Nam e="SomeApiSoap",
> Namespace="http://tempuri.org/")]
> public class SomeApi :
> System.Web.Services.Protocols.SoapHttpClientProtoc ol {
> ...
> }
> ----------------------------------------------------
>
>
> Thanks again,
>
> Jared
[url]http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8[/url]
&safe=off&threadm=avmXa.5874%24Ye.5664%40fed1read0 2&rnum=4&prev=/groups%
3Fq%3Dnull%2520%2522SOAP%253A%253ALite%2522%26num% 3D30%26hl%3Den%26lr%
3D%26ie%3DUTF-8%26oe%3DUTF-8%26safe%3Doff%26sa%3DN%26tab%3Dwg
(Note that the web service is Perl SOAP::Lite)
-----------------------------------------------------------------
[System.Web.Services.Protocols.SoapDocumentMethodAt tribute
("http://tempuri.org/Login",
ResponseElementName="LoginResponse",
RequestNamespace="Some API",
ResponseNamespace="Some API",
Use=System.Web.Services.Description.SoapBindingUse .Encoded,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Wrapped)
]
[return: System.Xml.Serialization.SoapElementAttribute("ele ment1")]
public string Login(string param1, string param2, string param3, out
string element2) {
....
}
The fixes were:
1) Use SoapBindingUse.Encoded instead of Literal
2) Use Serialization.SoapElementAttribute("element1") instead of
XmlElementAttribute("element1")
-----------------------------------------------------------------
Jared Jensen Guest
-
Dino Chiesa [Microsoft] #5
Re: Proxy class not reading data returned in SOAP response
Great, glad you were able to solve it. sorry I couldn't be more helpful.
SOAP::Lite is nice but I think its lack of WSDL support means that
development is trickier.
ps: that URL was:
[url]http://tinyurl.com/3ao5b[/url]
-Dino
"Jared Jensen" <jaredljensen@hotmail.com> wrote in message
news:Xns94D98EAA821AEjaredljensenhotmailc@207.46.2 48.16...> [email]jaredljensen@hotmail.com[/email] (Jared) wrote in
> news:3264d672.0404281117.2936771b@posting.google.c om:
>> ("http://temp> > "Dino Chiesa [Microsoft]" <dinoch@online.microsoft.com> wrote in
> > message news:<#ApeU7OLEHA.1120@TK2MSFTNGP11.phx.gbl>...> >> >> yes, I think you need to set your RequestNamespace and
> >> ResponseNamespace to "Some API"
> >> not [url]http://tempuri.org[/url].
> >>
> >> -Dino
> >>
> > Dino,
> >
> > I've updated the method attributes as shown below. I tried it with
> > and without setting the "ResponseElementName" param. It still fails
> > to populate results[], even though I'm still seeing a valid response
> > with my network sniffer.
> >
> > ----------------------------------------------------
> > [System.Web.Services.Protocols.SoapDocumentMethodAt tribute> p> > uri.org/Login",
> > ResponseElementName="LoginResponse",
> > RequestNamespace="Some API",
> > ResponseNamespace="Some API",
> > Use=System.Web.Services.Description.SoapBindingUse .Literal,
> > ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Wrap>> > ed)]
> > [return: System.Xml.Serialization.XmlElementAttribute("elem ent1")]
> > public string Login(string param1, string param2, string param3, out
> > string element2) {
> > object[] results = this.Invoke("Login", new object[] {
> > param1,
> > param2,
> > param3});
> > element2 = ((string)(results[1]));
> > return ((string)(results[0]));
> > }
> > ----------------------------------------------------
> >
> >
> > ----------------------------------------------------
> > Is there anything wrong with my class attributes?
> >
> > [System.Diagnostics.DebuggerStepThroughAttribute()]
> > [System.ComponentModel.DesignerCategoryAttribute("c ode")]
> > [System.Web.Services.WebServiceBindingAttribute(Nam e="SomeApiSoap",
> > Namespace="http://tempuri.org/")]
> > public class SomeApi :
> > System.Web.Services.Protocols.SoapHttpClientProtoc ol {
> > ...
> > }
> > ----------------------------------------------------
> >
> >
> > Thanks again,
> >
> > Jared
> Here's my own answer based on the following post:
>
> [url]http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8[/url]
> &safe=off&threadm=avmXa.5874%24Ye.5664%40fed1read0 2&rnum=4&prev=/groups%
> 3Fq%3Dnull%2520%2522SOAP%253A%253ALite%2522%26num% 3D30%26hl%3Den%26lr%
> 3D%26ie%3DUTF-8%26oe%3DUTF-8%26safe%3Doff%26sa%3DN%26tab%3Dwg
>
> (Note that the web service is Perl SOAP::Lite)
>
> -----------------------------------------------------------------
> [System.Web.Services.Protocols.SoapDocumentMethodAt tribute
> ("http://tempuri.org/Login",
> ResponseElementName="LoginResponse",
> RequestNamespace="Some API",
> ResponseNamespace="Some API",
> Use=System.Web.Services.Description.SoapBindingUse .Encoded,
> ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Wrapped)
> ]
> [return: System.Xml.Serialization.SoapElementAttribute("ele ment1")]
> public string Login(string param1, string param2, string param3, out
> string element2) {
> ...
> }
>
> The fixes were:
>
> 1) Use SoapBindingUse.Encoded instead of Literal
> 2) Use Serialization.SoapElementAttribute("element1") instead of
> XmlElementAttribute("element1")
> -----------------------------------------------------------------
Dino Chiesa [Microsoft] Guest
-
Unregistered #6
Re: Proxy class not reading data returned in SOAP response
It works for me.
Thanks
AshuUnregistered Guest



Reply With Quote

