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

Serious problem with NET client and Axis web service

P: n/a
This is a repost, with additional information. I have a Net 2.0 client (C#
Winform) calling an Axis web service. The .NET client can authenticate,
create requested objects, serialize the objects and send. These are received
without issue on the Axis server. The .NET client can also receive responses
from the Axis web service when the response is a single value type (long,
string, etc), or an array of value types.

However if an object is returned, it always appears empty. Looking at
NetMon, the response values appear in the SOAP message, but it seems that
..Net has trouble
deserializing the SOAP message into an object. Any ideas?

Thanks,

Aug 16 '06 #1
Share this Question
Share on Google+
11 Replies


P: n/a
"David R" <Da****@discussions.microsoft.comwrote in message
news:94**********************************@microsof t.com...
This is a repost, with additional information. I have a Net 2.0 client
(C#
Winform) calling an Axis web service. The .NET client can authenticate,
create requested objects, serialize the objects and send. These are
received
without issue on the Axis server. The .NET client can also receive
responses
from the Axis web service when the response is a single value type (long,
string, etc), or an array of value types.

However if an object is returned, it always appears empty. Looking at
NetMon, the response values appear in the SOAP message, but it seems that
.Net has trouble
deserializing the SOAP message into an object. Any ideas?
I've had this happen when there is a namespace mismatch. .NET is expecting
namespace "B", but namespace "A" arrives instead. Since it didn't receive
anything from namespace "B", it returns you what it got from namespace "B" -
nothing!

John
Aug 16 '06 #2

P: n/a
John,

Thanks for the quick response. So the object I am creating, with the
definition of:
public class WorkRequestTO Member of WSClass.s307a68
isn't filled because what comes in on the SOAP message is
xmlns="http://service.external.xxx.xxxsystems.com:>. I this correct? How
can I fix this without adapting the namespace of the Axis service?

Thanks,

David

"John Saunders" wrote:
"David R" <Da****@discussions.microsoft.comwrote in message
news:94**********************************@microsof t.com...
This is a repost, with additional information. I have a Net 2.0 client
(C#
Winform) calling an Axis web service. The .NET client can authenticate,
create requested objects, serialize the objects and send. These are
received
without issue on the Axis server. The .NET client can also receive
responses
from the Axis web service when the response is a single value type (long,
string, etc), or an array of value types.

However if an object is returned, it always appears empty. Looking at
NetMon, the response values appear in the SOAP message, but it seems that
.Net has trouble
deserializing the SOAP message into an object. Any ideas?

I've had this happen when there is a namespace mismatch. .NET is expecting
namespace "B", but namespace "A" arrives instead. Since it didn't receive
anything from namespace "B", it returns you what it got from namespace "B" -
nothing!

John
Aug 16 '06 #3

P: n/a
I found this, which might be helpful.

The SOAP request contains the following:
xmlns="http://service.external.xxx.xxxsystems.com>.

The following was in the reference.cs file:

[System.Web.Services.Protocols.SoapDocumentMethodAt tribute("",
RequestNamespace="http://service.external.xxx.xxxsystems.com",
ResponseNamespace="http://service.external.xxx.xxxsystems.com",
Use=System.Web.Services.Description.SoapBindingUse .Literal,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Wrapped)]
[return:
System.Xml.Serialization.XmlElementAttribute("getW orkRequestStatusReturn")]
public WorkRequestStatusTO getWorkRequestStatus(long workRequestId) {
object[] results = this.Invoke("getWorkRequestStatus", new
object[] {
workRequestId});
return ((WorkRequestStatusTO)(results[0]));

"David R" wrote:
John,

Thanks for the quick response. So the object I am creating, with the
definition of:
public class WorkRequestTO Member of WSClass.s307a68
isn't filled because what comes in on the SOAP message is
xmlns="http://service.external.xxx.xxxsystems.com:>. I this correct? How
can I fix this without adapting the namespace of the Axis service?

Thanks,

David

"John Saunders" wrote:
"David R" <Da****@discussions.microsoft.comwrote in message
news:94**********************************@microsof t.com...
This is a repost, with additional information. I have a Net 2.0 client
(C#
Winform) calling an Axis web service. The .NET client can authenticate,
create requested objects, serialize the objects and send. These are
received
without issue on the Axis server. The .NET client can also receive
responses
from the Axis web service when the response is a single value type (long,
string, etc), or an array of value types.
>
However if an object is returned, it always appears empty. Looking at
NetMon, the response values appear in the SOAP message, but it seems that
.Net has trouble
deserializing the SOAP message into an object. Any ideas?
I've had this happen when there is a namespace mismatch. .NET is expecting
namespace "B", but namespace "A" arrives instead. Since it didn't receive
anything from namespace "B", it returns you what it got from namespace "B" -
nothing!

John

Aug 16 '06 #4

P: n/a
"David R" <Da****@discussions.microsoft.comwrote in message
news:45**********************************@microsof t.com...
>I found this, which might be helpful.

The SOAP request contains the following:
xmlns="http://service.external.xxx.xxxsystems.com>.

The following was in the reference.cs file:

[System.Web.Services.Protocols.SoapDocumentMethodAt tribute("",
RequestNamespace="http://service.external.xxx.xxxsystems.com",
ResponseNamespace="http://service.external.xxx.xxxsystems.com",
Use=System.Web.Services.Description.SoapBindingUse .Literal,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Wrapped)]
[return:
System.Xml.Serialization.XmlElementAttribute("getW orkRequestStatusReturn")]
public WorkRequestStatusTO getWorkRequestStatus(long workRequestId)
{
object[] results = this.Invoke("getWorkRequestStatus", new
object[] {
workRequestId});
return ((WorkRequestStatusTO)(results[0]));

The problem might be
System.Web.Services.Protocols.SoapParameterStyle.W rapped vs. .Bare. I can't
tell without seeing your response message. Is the
getWorkRequestStatusReturn element immediately within the SOAP:Body element,
or is there something else around (wrapping) it?

John
Aug 17 '06 #5

P: n/a
Every reference I have in the .NET application indicates wrapped.

Here are four items. The first is the first part of the WDSL down to the
getWorkRequestStatus method. The second is the VS2005-generated code that
represents this method (showing that wrapped is used). The third item is the
first part of a successfully returned and read message (an array of strings
of US state names), and the fourth is the SOAP message that I cannot see.

Thanks,

David
ITEM ONE

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:tns2="http://external.aaa.gov/axis/externalInterface"
xmlns:tns1="http://service.external.xxx.xxxsystems.com"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:impl="http://s1fe034.ba.ad.aaa.gov:8100/axis/services/workRequestService"
xmlns:intf="http://s1fe034.ba.ad.aaa.gov:8100/axis/services/workRequestService"
targetNamespace="http://s1fe034.ba.ad.aaa.gov:8100/axis/services/workRequestService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
targetNamespace="http://service.external.xxx.xxxsystems.com">
<xsd:import namespace="http://external.aaa.gov/axis/externalInterface"
/>
<xsd:element name="getDocument">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="documentObjectId" type="xsd:long" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="getDocumentResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="getDocumentReturn"
type="tns2:DocumentDescriptor" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="getWorkRequestStatus">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="workRequestId" type="xsd:long" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="getWorkRequestStatusResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="getWorkRequestStatusReturn"
type="tns2:WorkRequestStatusTO" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>

ITEM TWO - From VS2005

[System.Web.Services.Protocols.SoapDocumentMethodAt tribute("",
RequestNamespace="http://service.external.xxx.xxxsystems.com",
ResponseNamespace="http://service.external.xxx.xxxsystems.com",
Use=System.Web.Services.Description.SoapBindingUse .Literal,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Wrapped)]
[return:
System.Xml.Serialization.XmlElementAttribute("getW orkRequestStatusReturn")]
public WorkRequestStatusTO getWorkRequestStatus(long workRequestId) {
object[] results = this.Invoke("getWorkRequestStatus", new
object[] {
workRequestId});
return ((WorkRequestStatusTO)(results[0]));

ITEM THREE - SOAP envelope
<?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><getUSStatesResponse.xmlns ="http://service.external.xxx.xxxsystems.com"><getUSStatesR eturn>Alabama</getUSStatesReturn><getUSStatesReturn>Alaska</getUSStatesReturn><getUSStatesReturn>Alaska.and.th e.Pacific.Area</getUSStatesReturn><getUSStatesReturn>American.Samo a</getUSStatesReturn><getUSStatesReturn>Arizona</getUSStatesReturn><getUSStatesReturn>Arkansas</getUSStatesReturn><getUSStatesReturn>California</getUSStatesReturn>
xsi:nil="true"/><workRequestFormatCode>16</workRequestFormatCode><workRequestId>1687</workRequestId><workRequestNumber>0608-0001687</workRequestNumber><workRequestOwnerId>2868</workRequestOwnerId><workRequestOwnerName>OC-Controls</workRequestOwnerName><workRequestPriorityCode>75</workRequestPriorityCode><workRequestStatus></workRequestStatus>
xsi:nil="true"/><workRequestStatusCode>79</workRequestStatusCode><workRequestTitle>New
Work Request</workRequestTitle><workRequestType></workRequestType>
xsi:nil="true"/><workRequestTypeCode>116</workRequestTypeCode><workRequestpriority></workRequestpriority>
xsi:nil="true"/></createWorkRequestReturn></createWorkRequestResponse></soapenv:Body></soapenv:Envelope>

ITEM FOUR WorkRequestStatusResponse

<?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>
<getWorkRequestStatusResponse.xmlns="http://service.external.xxx.xxxsystems.com">
<getWorkRequestStatusReturn>
<closeOutDate></closeOutDate>
<closeOutTxt></closeOutTxt>
<createDate>08/17/2006</createDate>
<dueDate>07/17/2007</dueDate>
<principalContactGroupId>4939</principalContactGroupId>
<principalContactGroupName>DCDISP-OHA-Controls</principalContactGroupName>
<principalContactId>4635</principalContactId>
<principalContactName>Adolph.Ramirez</principalContactName>
<receivedDate>07/17/2006</receivedDate>
<restrictedSw>Y</restrictedSw>
<subjectCategoryCode>1</subjectCategoryCode>
<subjectCategoryDesc>800.Number</subjectCategoryDesc>
<subjectIdentifierCode>1</subjectIdentifierCode>
<subjectIdentifierDesc>General</subjectIdentifierDesc>
<workRequestDescription>This.is.a.new.work.request </workRequestDescription>
<workRequestFormat>E-ail</workRequestFormat>
<workRequestFormatCode>16</workRequestFormatCode>
<workRequestId>992</workRequestId>
<workRequestNumber>0608-000992</workRequestNumber>
<workRequestOwnerId>4939</workRequestOwnerId>
<workRequestOwnerName>DCDISP-OHA-ontrols</workRequestOwnerName>
<workRequestPriorityCode>75</workRequestPriorityCode>
<workRequestStatus>Open</workRequestStatus>
<workRequestStatusCode>79</workRequestStatusCode>
<workRequestTitle>New.Work.Request</workRequestTitle>
<workRequestType>Agreement</workRequestType>
<workRequestTypeCode>116</workRequestTypeCode>
<workRequestpriority>5-ay</workRequestpriority>
</getWorkRequestStatusReturn></getWorkRequestStatusResponse>
</soapenv:Body></soapenv:Envelope>

Aug 17 '06 #6

P: n/a
Try either changing the return:
XmlElementAttribute("getWorkRequestStatusResponse" ) or else changing th
style to Bare.

It seems to me that Wrapped is more for the case where you're returning more
than one element and need something to wrap them in. That's just a personal
preference, though.

John
Aug 17 '06 #7

P: n/a
Thanks for the ideas. I tried both, but generated the same results.

One strange thing I noticed. I tried setting a breakpoint on the
auto-generated method getWorkRequestStatus, which is based upon the WSDL.
This method is in the Reference.cs file. The breakpoint was ignored when
debugging. Any idea why this might be?

David
"John Saunders" wrote:
Try either changing the return:
XmlElementAttribute("getWorkRequestStatusResponse" ) or else changing th
style to Bare.

It seems to me that Wrapped is more for the case where you're returning more
than one element and need something to wrap them in. That's just a personal
preference, though.

John
Aug 17 '06 #8

P: n/a
"David R" <Da****@discussions.microsoft.comwrote in message
news:CF**********************************@microsof t.com...
Thanks for the ideas. I tried both, but generated the same results.

One strange thing I noticed. I tried setting a breakpoint on the
auto-generated method getWorkRequestStatus, which is based upon the WSDL.
This method is in the Reference.cs file. The breakpoint was ignored when
debugging. Any idea why this might be?
Is there a [DebuggerStepThrough] attribute on that method?

John
Aug 17 '06 #9

P: n/a
John,

Yes there was. A handy feature, now that I know about it. I commented it
out, and was able to look at the Invoke method, which returns an object.
Sure enough, the object was created, as before, but all the properties were
null.

I also saw a problem I had not noticed before, since it did not throw an
error. On the WDSL, VS2005 is warning on xsd:element (shown below) that
'http://external.aaa.gov/axis/externalInterface:WorkRequestTO' is not
declared. Could this be the cause, and if so, can I declare this, or does it
need to be done on the server side.?

<xsd:sequence>
<xsd:element name="getWorkRequestStatusReturn"
type="tns2:WorkRequestStatusTO" />
</xsd:sequence>

Thanks,

David

"John Saunders" wrote:
"David R" <Da****@discussions.microsoft.comwrote in message
news:CF**********************************@microsof t.com...
Thanks for the ideas. I tried both, but generated the same results.

One strange thing I noticed. I tried setting a breakpoint on the
auto-generated method getWorkRequestStatus, which is based upon the WSDL.
This method is in the Reference.cs file. The breakpoint was ignored when
debugging. Any idea why this might be?

Is there a [DebuggerStepThrough] attribute on that method?

John
Aug 18 '06 #10

P: n/a
John,

Found the problem, which was, as you initially suggested, a namespace
problem. Thanks for all your help!

David

"John Saunders" wrote:
"David R" <Da****@discussions.microsoft.comwrote in message
news:CF**********************************@microsof t.com...
Thanks for the ideas. I tried both, but generated the same results.

One strange thing I noticed. I tried setting a breakpoint on the
auto-generated method getWorkRequestStatus, which is based upon the WSDL.
This method is in the Reference.cs file. The breakpoint was ignored when
debugging. Any idea why this might be?

Is there a [DebuggerStepThrough] attribute on that method?

John
Aug 18 '06 #11

P: n/a
I'm glad my help helped!

John

"David R" <Da****@discussions.microsoft.comwrote in message
news:A6**********************************@microsof t.com...
John,

Found the problem, which was, as you initially suggested, a namespace
problem. Thanks for all your help!

David

"John Saunders" wrote:
>"David R" <Da****@discussions.microsoft.comwrote in message
news:CF**********************************@microso ft.com...
Thanks for the ideas. I tried both, but generated the same results.

One strange thing I noticed. I tried setting a breakpoint on the
auto-generated method getWorkRequestStatus, which is based upon the
WSDL.
This method is in the Reference.cs file. The breakpoint was ignored
when
debugging. Any idea why this might be?

Is there a [DebuggerStepThrough] attribute on that method?

John

Aug 20 '06 #12

This discussion thread is closed

Replies have been disabled for this discussion.