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

problem deserializing return structure from Java/Axis web service

P: n/a
JLJ
I have a very simple webservice written in Java/Axis. It takes in a
complexType with 2 string elements, userid and password. The response is a
complexType containing two complexTypes each having 2 strings

<wsdl:portType name=SecurityLoginService">
<wsdl:operation name="login">
<wsdl:input message="tns:loginRequest" name="loginRequest"/>
<wsdl:output message="tns:loginResponse" name="loginResponse"/>
</wsdl:operation>
</wsdl:portType>

The output parameter, of type loginResponse, is defined thusly:
<element name="loginResponse">
<complexType>
<sequence>
<element name="Status" nillable="false" type="tns:statusType"/>
<element name="SecurityCredentials" nillable=false
type="tns:SecurityCredentialsType"/>
</sequence>
</complexType>
</element>

Both StatusType and SecurityCredentialsType are complexTypes each having 2
elements of type tns:string

The problem
Calling this service from C# yields a successful result. The StatusType
values are correctly returned indicating success, and deserialize correctly.
However both strings in the SecurityCredentialsType appear in C# as null
strings. But if I apply a SOAP traffic monitor on the tranasction, I see the
correct values being returned in the SOAP message to the client. Somehow
those values are not being deserialized correctly.

Calling this service from a Java/Axis client works just fine. The service
is built in Sun Java with Axis. I could really use some pointers where to
look for a solution here.

Thanks in advance

Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Can you please show us the complete WSDL (including all XSDs)?

Thanks,
--
Christian Weyer
thinktecture
http://www.thinktecture.com
In-depth support and consulting for software architects and developers

*Smells like service spirit-Weblog
http://weblogs.asp.net/cweyer

*Independent Microsoft Regional Director
http://www.microsoft.com/rd
"JLJ" <JL*@discussions.microsoft.com> wrote in message
news:46**********************************@microsof t.com...
I have a very simple webservice written in Java/Axis. It takes in a
complexType with 2 string elements, userid and password. The response is
a
complexType containing two complexTypes each having 2 strings

<wsdl:portType name=SecurityLoginService">
<wsdl:operation name="login">
<wsdl:input message="tns:loginRequest" name="loginRequest"/>
<wsdl:output message="tns:loginResponse" name="loginResponse"/>
</wsdl:operation>
</wsdl:portType>

The output parameter, of type loginResponse, is defined thusly:
<element name="loginResponse">
<complexType>
<sequence>
<element name="Status" nillable="false" type="tns:statusType"/>
<element name="SecurityCredentials" nillable=false
type="tns:SecurityCredentialsType"/>
</sequence>
</complexType>
</element>

Both StatusType and SecurityCredentialsType are complexTypes each having 2
elements of type tns:string

The problem
Calling this service from C# yields a successful result. The StatusType
values are correctly returned indicating success, and deserialize
correctly.
However both strings in the SecurityCredentialsType appear in C# as null
strings. But if I apply a SOAP traffic monitor on the tranasction, I see
the
correct values being returned in the SOAP message to the client. Somehow
those values are not being deserialized correctly.

Calling this service from a Java/Axis client works just fine. The service
is built in Sun Java with Axis. I could really use some pointers where to
look for a solution here.

Thanks in advance

Nov 21 '05 #2

P: n/a
JLJ


"JLJ" wrote:
I have a very simple webservice written in Java/Axis. It takes in a
complexType with 2 string elements, userid and password. The response is a
complexType containing two complexTypes each having 2 strings

<wsdl:portType name=SecurityLoginService">
<wsdl:operation name="login">
<wsdl:input message="tns:loginRequest" name="loginRequest"/>
<wsdl:output message="tns:loginResponse" name="loginResponse"/>
</wsdl:operation>
</wsdl:portType>

The output parameter, of type loginResponse, is defined thusly:
<element name="loginResponse">
<complexType>
<sequence>
<element name="Status" nillable="false" type="tns:statusType"/>
<element name="SecurityCredentials" nillable=false
type="tns:SecurityCredentialsType"/>
</sequence>
</complexType>
</element>

Both StatusType and SecurityCredentialsType are complexTypes each having 2
elements of type tns:string

The problem
Calling this service from C# yields a successful result. The StatusType
values are correctly returned indicating success, and deserialize correctly.
However both strings in the SecurityCredentialsType appear in C# as null
strings. But if I apply a SOAP traffic monitor on the tranasction, I see the
correct values being returned in the SOAP message to the client. Somehow
those values are not being deserialized correctly.

Calling this service from a Java/Axis client works just fine. The service
is built in Sun Java with Axis. I could really use some pointers where to
look for a solution here.

Thanks in advance


more information

statusType contains two string elements ("xsd:string") but there is no
nillable="false" directive for these elements

SecurityCredentialsType has two string elements, but both are set to
nillable="false".

I added a SoapExtension to capture the Soap response. In the response, the
elements for the loginResponselook like

<loginResponse xmlns="http://myapp.mydomain.com">
<Status xmlns="http://myapp.mydomain.com">
<Code xmlns="http://myapp.mydomain.com">I-200</Code>
<Message xmlns="http://myapp.mydomain.com">Login Successful</Mesasge>
</Status>
<SecurityCredentials xmlns="http://myapp.mydomain.com">
<SAMLToken xmlns="">
<![CDATA[ blahblahblahblah]]>
</SAMLToken>
<SMSESSION xmlns="">SMSESSION=blhalbhalblhbablhbab</SMSESSION>
</SecurityCredentials>
</loginResponse>

So the two fields that deserialize to null are the two fields in the
SecurityCredentials object and nillable="false" is set. But the xmlns= has
"" instead of "http://myapp.mydomain.com"

Is that sympomatic of something?

Nov 21 '05 #3

P: n/a
JLJ
Sure

"Christian Weyer" wrote:
Can you please show us the complete WSDL (including all XSDs)?

Thanks,
--
Christian Weyer
thinktecture
http://www.thinktecture.com
In-depth support and consulting for software architects and developers
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://myapp.mydomain.com"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:tns="http://myapp.mydomain.com"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<schema elementFormDefault="qualified"
targetNamespace="http://myapp.mydomain.com"
xmlns="http://www.w3.org/2001/XMLSchema">

<complexType name="UserCredentialsType">
<sequence>
<element name="UserName" nillable="false" type="xsd:string"/>
<element name="Password" nillable="false" type="xsd:string"/>
</sequence>
</complexType>

<complexType name="changePasswordRequestType">
<sequence>
<element name="UserName" type="xsd:string"/>
<element name="OldPassword" type="xsd:string"/>
<element name="NewPassword" type="xsd:string"/>
<element name="NewPassword2" type="xsd:string"/>
</sequence>
</complexType>

<complexType name="SecurityCredentialsType">
<sequence>
<element name="SAMLToken" nillable="false" type="xsd:string"/>
<element name="SMSESSION" nillable="false" type="xsd:string"/>
</sequence>
</complexType>

<complexType name="statusType">
<sequence>
<element name="Code" type="xsd:string"/>
<element name="Message" type="xsd:string"/>
</sequence>
</complexType>

<element name="changePassword">
<complexType>
<sequence>
<element name="changePasswordRequest"
type="tns:changePasswordRequestType"/>
</sequence>
</complexType>
</element>

<element name="changePasswordResponse">
<complexType>
<sequence>
<element name="Status" nillable="false" type="tns:statusType"/>
</sequence>
</complexType>
</element>
<element name="logout">
<complexType>
<sequence/>
</complexType>
</element>

<element name="logoutResponse">
<complexType>
<sequence>
<element name="Status" nillable="false" type="tns:statusType"/>
</sequence>
</complexType>
</element>

<element name="login">
<complexType>
<sequence>
<element name="UserCredentials" type="tns:UserCredentialsType"/>
</sequence>
</complexType>
</element>
<element name="loginResponse">
<complexType>
<sequence>
<element name="Status" nillable="false" type="tns:statusType"/>
<element name="SecurityCredentials" nillable="false"
type="tns:SecurityCredentialsType"/>
</sequence>
</complexType>
</element>

</schema>
</wsdl:types>

<wsdl:message name="logoutResponse">

<wsdl:part element="tns:logoutResponse" name="parameters"/>

</wsdl:message>

<wsdl:message name="changePasswordResponse">

<wsdl:part element="tns:changePasswordResponse" name="parameters"/>

</wsdl:message>

<wsdl:message name="loginRequest">

<wsdl:part element="tns:login" name="parameters"/>

</wsdl:message>

<wsdl:message name="loginResponse">

<wsdl:part element="tns:loginResponse" name="parameters"/>

</wsdl:message>

<wsdl:message name="logoutRequest">

<wsdl:part element="tns:logout" name="parameters"/>

</wsdl:message>

<wsdl:message name="changePasswordRequest">

<wsdl:part element="tns:changePassword" name="parameters"/>

</wsdl:message>

<wsdl:portType name="SecurityChgPasswdService">

<wsdl:operation name="changePassword">

<wsdl:input message="tns:changePasswordRequest"
name="changePasswordRequest"/>

<wsdl:output message="tns:changePasswordResponse"
name="changePasswordResponse"/>

</wsdl:operation>

</wsdl:portType>

<wsdl:portType name="SecurityLogoutService">
<wsdl:operation name="logout">

<wsdl:input message="tns:logoutRequest" name="logoutRequest"/>

<wsdl:output message="tns:logoutResponse" name="logoutResponse"/>

</wsdl:operation>
</wsdl:portType>

<wsdl:portType name="SecurityLoginService">
<wsdl:operation name="login">

<wsdl:input message="tns:loginRequest" name="loginRequest"/>

<wsdl:output message="tns:loginResponse" name="loginResponse"/>

</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SecurityServiceSoapChgPasswdBinding"
type="tns:SecurityChgPasswdService">

<wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>

<wsdl:operation name="changePassword">

<wsdlsoap:operation soapAction=""/>

<wsdl:input name="changePasswordRequest">

<wsdlsoap:body use="literal"/>

</wsdl:input>

<wsdl:output name="changePasswordResponse">

<wsdlsoap:body use="literal"/>

</wsdl:output>

</wsdl:operation>

</wsdl:binding>

<wsdl:binding name="SecurityServiceSoapLogoutBinding"
type="tns:SecurityLogoutService">

<wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>

<wsdl:operation name="logout">

<wsdlsoap:operation soapAction=""/>

<wsdl:input name="logoutRequest">

<wsdlsoap:body use="literal"/>

</wsdl:input>

<wsdl:output name="logoutResponse">

<wsdlsoap:body use="literal"/>

</wsdl:output>

</wsdl:operation>

</wsdl:binding>

<wsdl:binding name="SecurityServiceSoapLoginBinding"
type="tns:SecurityLoginService">

<wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>

<wsdl:operation name="login">

<wsdlsoap:operation soapAction=""/>

<wsdl:input name="loginRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>

<wsdl:output name="loginResponse">

<wsdlsoap:body use="literal"/>

</wsdl:output>

</wsdl:operation>

</wsdl:binding>
<wsdl:service name="SecurityServiceService">

<wsdl:port binding="tns:SecurityServiceSoapLoginBinding"
name="SecurityLoginService">

<wsdlsoap:address
location="https://myapp.mydomain.com/blahblah/login"/>

</wsdl:port>

<wsdl:port binding="tns:SecurityServiceSoapLogoutBinding"
name="SecurityLogoutService">

<wsdlsoap:address location="https://
myapp.mydomain.com/blahblah/login /logout"/>

</wsdl:port>

<wsdl:port binding="tns:SecurityServiceSoapChgPasswdBinding"
name="SecurityChgPasswdService">

<wsdlsoap:address location="https://
myapp.mydomain.com/blahblah/login /chgPasswdService"/>

</wsdl:port>
</wsdl:service>

</wsdl:definitions>

Nov 21 '05 #4

P: n/a
Did you ever resolve this issue? I am having the same problem. My web
service call returns successfully, but most of the fields in the return
object are null. I copied the SOAP response body into a file and wrote code
to read and deserialize it, and that worked fine. It just doesn't work in a
web service client proxy.

Is there any way to debug xml deserialization in a web service proxy?

Thanks,
Dennis

"JLJ" wrote:
I have a very simple webservice written in Java/Axis. It takes in a
complexType with 2 string elements, userid and password. The response is a
complexType containing two complexTypes each having 2 strings

<wsdl:portType name=SecurityLoginService">
<wsdl:operation name="login">
<wsdl:input message="tns:loginRequest" name="loginRequest"/>
<wsdl:output message="tns:loginResponse" name="loginResponse"/>
</wsdl:operation>
</wsdl:portType>

The output parameter, of type loginResponse, is defined thusly:
<element name="loginResponse">
<complexType>
<sequence>
<element name="Status" nillable="false" type="tns:statusType"/>
<element name="SecurityCredentials" nillable=false
type="tns:SecurityCredentialsType"/>
</sequence>
</complexType>
</element>

Both StatusType and SecurityCredentialsType are complexTypes each having 2
elements of type tns:string

The problem
Calling this service from C# yields a successful result. The StatusType
values are correctly returned indicating success, and deserialize correctly.
However both strings in the SecurityCredentialsType appear in C# as null
strings. But if I apply a SOAP traffic monitor on the tranasction, I see the
correct values being returned in the SOAP message to the client. Somehow
those values are not being deserialized correctly.

Calling this service from a Java/Axis client works just fine. The service
is built in Sun Java with Axis. I could really use some pointers where to
look for a solution here.

Thanks in advance

Nov 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.