By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,313 Members | 2,798 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,313 IT Pros & Developers. It's quick & easy.

problems deserializing response from web service

P: n/a
Hi...

I'm trying to write a web service client and am running into a problem with
getting a response back from the server. I know that a full xml message is
being returned (thanks to a tcp/ip sniffer) but in VS.NET all I get is a null
reference.

The server is a java program running on websphere. The provider of the web
service has gotten a websphere client and an apache axis client to work
correctly, so I don't think it's a problem with the server.

Any suggestions? I can attach the wsdl and the xml that is being returned
if that will help diagnose.

Thanks
Nov 23 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Hello Railinc,
This is probably because the namespaces are not matching in the xml messages

HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com
http://www.geniant.com
Hi...

I'm trying to write a web service client and am running into a problem
with getting a response back from the server. I know that a full xml
message is being returned (thanks to a tcp/ip sniffer) but in VS.NET
all I get is a null reference.

The server is a java program running on websphere. The provider of
the web service has gotten a websphere client and an apache axis
client to work correctly, so I don't think it's a problem with the
server.

Any suggestions? I can attach the wsdl and the xml that is being
returned if that will help diagnose.

Thanks

Nov 23 '05 #2

P: n/a
Dilip,

I'm having what appears to be the same issue but it seems to me that the
namespaces match. I'm using document/literal to invoke an axis web service
from a c# client. I have included the definition from within the web
reference along with the response message. I would really appreciate any
pointers you might have.

Thanks,

Carson
Definition from the web reference:

[System.Web.Services.Protocols.SoapDocumentMethodAt tribute("",
Use=System.Web.Services.Description.SoapBindingUse .Literal,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Bare)]

[return: System.Xml.Serialization.XmlElementAttribute("gene rateReturn",
Namespace="http://ws.eaf.cynergysystems.com")]

public Response
generate([System.Xml.Serialization.XmlElementAttribute(Names pace="http://ws.eaf.cynergysystems.com")] Request in0) {
object[] results = this.Invoke("generate", new object[] {
in0});
return ((Response)(results[0]));
}

Response Message:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<generateReturn xmlns="http://ws.eaf.cynergysystems.com">
<returnCode>0</returnCode>
<messages>blah blah</messages>
<datasets>
<name>customerlist</name>
<data></data>
<arguments></arguments>
<messages>blah blah</messages>
<mimeType>text/html</mimeType>
<isBinary>false</isBinary>
</datasets>
<datasets>
<name>customerlist</name>
<data></data>
<arguments></arguments>
<messages>blah blah</messages>
<mimeType>text/html</mimeType>
<isBinary>false</isBinary>
</datasets>
</generateReturn>
</soapenv:Body>
</soapenv:Envelope>


"Dilip Krishnan" wrote:
Hello Railinc,
This is probably because the namespaces are not matching in the xml messages

HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com
http://www.geniant.com
Hi...

I'm trying to write a web service client and am running into a problem
with getting a response back from the server. I know that a full xml
message is being returned (thanks to a tcp/ip sniffer) but in VS.NET
all I get is a null reference.

The server is a java program running on websphere. The provider of
the web service has gotten a websphere client and an apache axis
client to work correctly, so I don't think it's a problem with the
server.

Any suggestions? I can attach the wsdl and the xml that is being
returned if that will help diagnose.

Thanks


Nov 23 '05 #3

P: n/a
Dilip,

After searching forever trying to find a discrepancy and finding nothing, I
opted to redeploy the axis service as wrapped/literal and it worked
perfectly. Any idea why that would be? Any drawbacks to this approach?
There are none that I can see at least in my limited environment.
Thanks,

Carson
"Carson Hager" wrote:
Dilip,

I'm having what appears to be the same issue but it seems to me that the
namespaces match. I'm using document/literal to invoke an axis web service
from a c# client. I have included the definition from within the web
reference along with the response message. I would really appreciate any
pointers you might have.

Thanks,

Carson
Definition from the web reference:

[System.Web.Services.Protocols.SoapDocumentMethodAt tribute("",
Use=System.Web.Services.Description.SoapBindingUse .Literal,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Bare)]

[return: System.Xml.Serialization.XmlElementAttribute("gene rateReturn",
Namespace="http://ws.eaf.cynergysystems.com")]

public Response
generate([System.Xml.Serialization.XmlElementAttribute(Names pace="http://ws.eaf.cynergysystems.com")] Request in0) {
object[] results = this.Invoke("generate", new object[] {
in0});
return ((Response)(results[0]));
}

Response Message:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<generateReturn xmlns="http://ws.eaf.cynergysystems.com">
<returnCode>0</returnCode>
<messages>blah blah</messages>
<datasets>
<name>customerlist</name>
<data></data>
<arguments></arguments>
<messages>blah blah</messages>
<mimeType>text/html</mimeType>
<isBinary>false</isBinary>
</datasets>
<datasets>
<name>customerlist</name>
<data></data>
<arguments></arguments>
<messages>blah blah</messages>
<mimeType>text/html</mimeType>
<isBinary>false</isBinary>
</datasets>
</generateReturn>
</soapenv:Body>
</soapenv:Envelope>


"Dilip Krishnan" wrote:
Hello Railinc,
This is probably because the namespaces are not matching in the xml messages

HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com
http://www.geniant.com
Hi...

I'm trying to write a web service client and am running into a problem
with getting a response back from the server. I know that a full xml
message is being returned (thanks to a tcp/ip sniffer) but in VS.NET
all I get is a null reference.

The server is a java program running on websphere. The provider of
the web service has gotten a websphere client and an apache axis
client to work correctly, so I don't think it's a problem with the
server.

Any suggestions? I can attach the wsdl and the xml that is being
returned if that will help diagnose.

Thanks


Nov 23 '05 #4

P: n/a
Hello Carson,
if you are looking for interop, document/literal is the way to go. No
drawbacks whatsoever :)

HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com
http://www.geniant.com
Dilip,

After searching forever trying to find a discrepancy and finding
nothing, I opted to redeploy the axis service as wrapped/literal and
it worked perfectly. Any idea why that would be? Any drawbacks to
this approach? There are none that I can see at least in my limited
environment.

Thanks,

Carson

"Carson Hager" wrote:
Dilip,

I'm having what appears to be the same issue but it seems to me that
the namespaces match. I'm using document/literal to invoke an axis
web service from a c# client. I have included the definition from
within the web reference along with the response message. I would
really appreciate any pointers you might have.

Thanks,

Carson

Definition from the web reference:

[System.Web.Services.Protocols.SoapDocumentMethodAt tribute("",
Use=System.Web.Services.Description.SoapBindingUse .Literal,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Bare)
]

[return:
System.Xml.Serialization.XmlElementAttribute("gene rateReturn",
Namespace="http://ws.eaf.cynergysystems.com")]

public Response

generate([System.Xml.Serialization.XmlElementAttribute(Names pace="htt
p://ws.eaf.cynergysystems.com")] Request in0) {

object[] results = this.Invoke("generate", new object[] {

in0});

return ((Response)(results[0]));

}

Response Message:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<generateReturn xmlns="http://ws.eaf.cynergysystems.com">
<returnCode>0</returnCode>
<messages>blah blah</messages>
<datasets>
<name>customerlist</name>
<data></data>
<arguments></arguments>
<messages>blah blah</messages>
<mimeType>text/html</mimeType>
<isBinary>false</isBinary>
</datasets>
<datasets>
<name>customerlist</name>
<data></data>
<arguments></arguments>
<messages>blah blah</messages>
<mimeType>text/html</mimeType>
<isBinary>false</isBinary>
</datasets>
</generateReturn>
</soapenv:Body>
</soapenv:Envelope>
"Dilip Krishnan" wrote:
Hello Railinc,
This is probably because the namespaces are not matching in the xml
messages
HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com
http://www.geniant.com
Hi...

I'm trying to write a web service client and am running into a
problem with getting a response back from the server. I know that
a full xml message is being returned (thanks to a tcp/ip sniffer)
but in VS.NET all I get is a null reference.

The server is a java program running on websphere. The provider of
the web service has gotten a websphere client and an apache axis
client to work correctly, so I don't think it's a problem with the
server.

Any suggestions? I can attach the wsdl and the xml that is being
returned if that will help diagnose.

Thanks

Nov 23 '05 #5

P: n/a
Thanks for getting back to me. I realize that document/literal is the
generally prescribed way to do things but I've seen way too many posts
pointing to unresolved problems with it, at least with Java based web
services and .NET clients. I am fairly certain that there are no namespace
issues. I've traversed the WSDL thoroughly and validated the response from
Axis. It appears to be spot on. The only thing I've seen is that there is a
slight difference in the way .NET and Axis send messages. Within the elements
of the response message, the .NET client includes an empty namespace
attribute, xmlns="". The axis response does not include this. The only
other thing is that axis uses soapenv and .NET uses soap but that's clearly
not the issue. They both point to the same soap namespace. I have no idea
whether not including that attribute would cause the .NET deserialized to
choke. All I can tell you is that it's the only noticeable difference in the
messages.

Thanks again for your feedback. I'd be interested in hearing if anyone has
any additional input here and also if there are any drawbacks to using
wrapped instead of document.
Carson


"Dilip Krishnan" wrote:
Hello Carson,
if you are looking for interop, document/literal is the way to go. No
drawbacks whatsoever :)

HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com
http://www.geniant.com
Dilip,

After searching forever trying to find a discrepancy and finding
nothing, I opted to redeploy the axis service as wrapped/literal and
it worked perfectly. Any idea why that would be? Any drawbacks to
this approach? There are none that I can see at least in my limited
environment.

Thanks,

Carson

"Carson Hager" wrote:
Dilip,

I'm having what appears to be the same issue but it seems to me that
the namespaces match. I'm using document/literal to invoke an axis
web service from a c# client. I have included the definition from
within the web reference along with the response message. I would
really appreciate any pointers you might have.

Thanks,

Carson

Definition from the web reference:

[System.Web.Services.Protocols.SoapDocumentMethodAt tribute("",
Use=System.Web.Services.Description.SoapBindingUse .Literal,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Bare)
]

[return:
System.Xml.Serialization.XmlElementAttribute("gene rateReturn",
Namespace="http://ws.eaf.cynergysystems.com")]

public Response

generate([System.Xml.Serialization.XmlElementAttribute(Names pace="htt
p://ws.eaf.cynergysystems.com")] Request in0) {

object[] results = this.Invoke("generate", new object[] {

in0});

return ((Response)(results[0]));

}

Response Message:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<generateReturn xmlns="http://ws.eaf.cynergysystems.com">
<returnCode>0</returnCode>
<messages>blah blah</messages>
<datasets>
<name>customerlist</name>
<data></data>
<arguments></arguments>
<messages>blah blah</messages>
<mimeType>text/html</mimeType>
<isBinary>false</isBinary>
</datasets>
<datasets>
<name>customerlist</name>
<data></data>
<arguments></arguments>
<messages>blah blah</messages>
<mimeType>text/html</mimeType>
<isBinary>false</isBinary>
</datasets>
</generateReturn>
</soapenv:Body>
</soapenv:Envelope>
"Dilip Krishnan" wrote:

Hello Railinc,
This is probably because the namespaces are not matching in the xml
messages
HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com
http://www.geniant.com
> Hi...
>
> I'm trying to write a web service client and am running into a
> problem with getting a response back from the server. I know that
> a full xml message is being returned (thanks to a tcp/ip sniffer)
> but in VS.NET all I get is a null reference.
>
> The server is a java program running on websphere. The provider of
> the web service has gotten a websphere client and an apache axis
> client to work correctly, so I don't think it's a problem with the
> server.
>
> Any suggestions? I can attach the wsdl and the xml that is being
> returned if that will help diagnose.
>
> Thanks
>


Nov 23 '05 #6

P: n/a
More information on the Wrapped implementation within Axis. It is evidently
directed at .NET integration.

http://marc.theaimsgroup.com/?l=axis...4879902571&w=2
Carson


"Dilip Krishnan" wrote:
Hello Carson,
if you are looking for interop, document/literal is the way to go. No
drawbacks whatsoever :)

HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com
http://www.geniant.com
Dilip,

After searching forever trying to find a discrepancy and finding
nothing, I opted to redeploy the axis service as wrapped/literal and
it worked perfectly. Any idea why that would be? Any drawbacks to
this approach? There are none that I can see at least in my limited
environment.

Thanks,

Carson

"Carson Hager" wrote:
Dilip,

I'm having what appears to be the same issue but it seems to me that
the namespaces match. I'm using document/literal to invoke an axis
web service from a c# client. I have included the definition from
within the web reference along with the response message. I would
really appreciate any pointers you might have.

Thanks,

Carson

Definition from the web reference:

[System.Web.Services.Protocols.SoapDocumentMethodAt tribute("",
Use=System.Web.Services.Description.SoapBindingUse .Literal,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Bare)
]

[return:
System.Xml.Serialization.XmlElementAttribute("gene rateReturn",
Namespace="http://ws.eaf.cynergysystems.com")]

public Response

generate([System.Xml.Serialization.XmlElementAttribute(Names pace="htt
p://ws.eaf.cynergysystems.com")] Request in0) {

object[] results = this.Invoke("generate", new object[] {

in0});

return ((Response)(results[0]));

}

Response Message:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<generateReturn xmlns="http://ws.eaf.cynergysystems.com">
<returnCode>0</returnCode>
<messages>blah blah</messages>
<datasets>
<name>customerlist</name>
<data></data>
<arguments></arguments>
<messages>blah blah</messages>
<mimeType>text/html</mimeType>
<isBinary>false</isBinary>
</datasets>
<datasets>
<name>customerlist</name>
<data></data>
<arguments></arguments>
<messages>blah blah</messages>
<mimeType>text/html</mimeType>
<isBinary>false</isBinary>
</datasets>
</generateReturn>
</soapenv:Body>
</soapenv:Envelope>
"Dilip Krishnan" wrote:

Hello Railinc,
This is probably because the namespaces are not matching in the xml
messages
HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com
http://www.geniant.com
> Hi...
>
> I'm trying to write a web service client and am running into a
> problem with getting a response back from the server. I know that
> a full xml message is being returned (thanks to a tcp/ip sniffer)
> but in VS.NET all I get is a null reference.
>
> The server is a java program running on websphere. The provider of
> the web service has gotten a websphere client and an apache axis
> client to work correctly, so I don't think it's a problem with the
> server.
>
> Any suggestions? I can attach the wsdl and the xml that is being
> returned if that will help diagnose.
>
> Thanks
>


Nov 23 '05 #7

P: n/a
I'm working with a third-party service (they're using Axis and I'm
using .Net for the client) and they switched to literal/wrapped in an
attempt to allow me to consume the service. It solved several
problems, but I'm still experiencing the symptom originally described
in this post - namely that when .Net deserializes the response I end up
with an empty result even though I'm getting a real Soap response.

I'm desperate for any help or suggestions. Here are appropriate
snippets of wsdl, the function call and the soap response the server is
returning. If anyone's willing and able to help I can post more
info/code.

Thanks,

Jennifer

==== Response ====
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"

xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<messageFileResponse xmlns="https://mydomain.org/MyService">
<messageFileReturn>
<pending>1</pending>
<recalled>0</recalled>
</messageFileReturn>
</messageFileResponse>
</soapenv:Body>
</soapenv:Envelope>

The function call generated by wsdl.exe is (in VB.Net)

<System.Web.Services.Protocols.SoapDocumentMethodA ttribute("",
RequestNamespace:="https://https://mydomain.org/MyService",
ResponseNamespace:="https://https://mydomain.org/MyService",
Use:=System.Web.Services.Description.SoapBindingUs e.Literal,
ParameterStyle:=System.Web.Services.Protocols.Soap ParameterStyle.Wrapped)>
_
Public Function messageFile() As
<System.Xml.Serialization.XmlElementAttribute("mes sageFileReturn")>
MessageFileResult

WSDL (just a couple snippets that seem likely to be the issue - didn't
want to drown this topic more than I already am)

---
<element name="messageFileResponse">
<complexType>
<sequence>
<element name="messageFileReturn" type="impl:MessageFileResult"/>
</sequence>
</complexType>
</element>
<complexType name="MessageFileResult">
<sequence>
<element name="pending" type="xsd:int"/>
<element name="recalled" type="xsd:int"/>
</sequence>
</complexType>

.......

<wsdl:message name="messageFileResponse">
<wsdl:part element="impl:messageFileResponse" name="parameters"/>
</wsdl:message>
<wsdl:portType name="MyService">
<wsdl:operation name="messageFile">
<wsdl:input message="impl:messageFileRequest"
name="messageFileRequest"/>
<wsdl:output message="impl:messageFileResponse"
name="messageFileResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="MyServiceSoapBinding" type="impl:MyService">
<wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="messageFile">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="messageFileRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="messageFileResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>

Nov 23 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.