You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by "Tudor, Liviu @Cimage" <Li...@cimage.com> on 2002/07/30 15:52:24 UTC

Problem with serializing/deserializing and .NET

Hi everyone!
 
I've been struggling for quite a while now with this, and don't know where
the problem relies.
I've created some web services clients in Java to access some web services
on a .NET platform. It nearly works, BUT...
1/ Upon receiving a response like
 
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="
<http://schemas.xmlsoap.org/soap/envelope/>
http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="
<http://schemas.xmlsoap.org/soap/encoding/>
http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="
<http://www.cimagenovasoft.com/> http://www.cimagenovasoft.com/"
xmlns:types="  <http://www.cimagenovasoft.com/encodedTypes>
http://www.cimagenovasoft.com/encodedTypes" xmlns:xsi="
<http://www.w3.org/2001/XMLSchema-instance>
http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="
<http://www.w3.org/2001/XMLSchema>
http://www.w3.org/2001/XMLSchema"><soap:Body soap:encodingStyle="
<http://schemas.xmlsoap.org/soap/encoding/>
http://schemas.xmlsoap.org/soap/encoding/"><tns:GetServersResponse><GetServe
rsResult href="#id1" /></tns:GetServersResponse><types:CimageServers
id="id1" xsi:type="types:CimageServers"><servers href="#id2" /><err
href="#id3" /></types:CimageServers><soapenc:Array id="id2"
soapenc:arrayType="types:CimageServer[6]"><Item href="#id4" /><Item
href="#id5" /><Item href="#id6" /><Item href="#id7" /><Item href="#id8"
/><Item href="#id9" /></soapenc:Array><types:CimageError id="id3"
xsi:type="types:CimageError"><ErrorCode
xsi:type="xsd:int">0</ErrorCode></types:CimageError><types:CimageServer
id="id4" xsi:type="types:CimageServer"><ServerName
xsi:type="xsd:string">stan.stancn</ServerName><ServerDesc
xsi:type="xsd:string">Stan</ServerDesc></types:CimageServer><types:CimageSer
ver id="id5" xsi:type="types:CimageServer"><ServerName
xsi:type="xsd:string">brioche.briochecn</ServerName><ServerDesc
xsi:type="xsd:string">Brioche
CN</ServerDesc></types:CimageServer><types:CimageServer id="id6"
xsi:type="types:CimageServer"><ServerName
xsi:type="xsd:string">brioche.briochemt</ServerName><ServerDesc
xsi:type="xsd:string">Brioche
MT</ServerDesc></types:CimageServer><types:CimageServer id="id7"
xsi:type="types:CimageServer"><ServerName
xsi:type="xsd:string">brioche.tunnel</ServerName><ServerDesc
xsi:type="xsd:string">Brioche Via
Tunnel</ServerDesc></types:CimageServer><types:CimageServer id="id8"
xsi:type="types:CimageServer"><ServerName
xsi:type="xsd:string">deacon.spmqs32</ServerName><ServerDesc
xsi:type="xsd:string">SPM Deacon
Server</ServerDesc></types:CimageServer><types:CimageServer id="id9"
xsi:type="types:CimageServer"><ServerName
xsi:type="xsd:string">quality.3001</ServerName><ServerDesc
xsi:type="xsd:string">Quality
Server</ServerDesc></types:CimageServer></soap:Body></soap:Envelope>
 
it comes with an error like : 
Error Message: No Deserializer found to deserialize a ':documents' using
encoding style 'http://schemas.xmlsoap.org/soap/encoding/'.
Error Code: 500
Target Servlet: null
Error Stack: 
[SOAPException: faultCode=SOAP-ENV:Client; msg=No Deserializer found to
deserialize a ':servers' using encoding style
'http://schemas.xmlsoap.org/soap/encoding/'.;
targetException=java.lang.IllegalArgumentException: No Deserializer found to
deserialize a ':documents' using encoding style
'http://schemas.xmlsoap.org/soap/encoding/'.] 

The de/serializers are registered ok
 

{
BeanSerializer ser_1 = new BeanSerializer();
BeanSerializer deSer_1 = new BeanSerializer();
smr.mapTypes( CimageWSConstants.SOAP_ENCODING_URL, 
new QName(CimageWSConstants.CIMAGE_SERVICE_SOAP_NAMESPACE(), "CimageError"),
CimageErrorContentType.class, 
ser_1, deSer_1);
 
BeanSerializer ser_2 = new BeanSerializer();
BeanSerializer deSer_2 = new BeanSerializer();
smr.mapTypes( CimageWSConstants.SOAP_ENCODING_URL, 
new QName(CimageWSConstants.CIMAGE_SERVICE_SOAP_NAMESPACE(),"CimageServer"),
CimageServerContentType.class, 
ser_2, deSer_2);
 
BeanSerializer ser_3 = new BeanSerializer();
BeanSerializer deSer_3 = new BeanSerializer();
smr.mapTypes( CimageWSConstants.SOAP_ENCODING_URL, 
new
QName(CimageWSConstants.CIMAGE_SERVICE_SOAP_NAMESPACE(),"CimageServers"),
CimageServersContentType.class, 
ser_3, deSer_3);
 
BeanSerializer ser_4 = new BeanSerializer();
BeanSerializer deSer_4 = new BeanSerializer();
smr.mapTypes( CimageWSConstants.SOAP_ENCODING_URL, 
new
QName(CimageWSConstants.CIMAGE_SERVICE_SOAP_NAMESPACE(),"CimageVersion"),
CimageVersionContentType.class, 
ser_4, deSer_4);
 
 
ArraySerializer ser_5 = new ArraySerializer();
ArraySerializer deSer_5 = new ArraySerializer();
smr.mapTypes( CimageWSConstants.SOAP_ENCODING_URL,
new QName("","servers"), 
null, 
ser_5, deSer_5 );
}

If I place the last bit in the code as well (ser_5 and deSer_5) it works
fine; however, the same technique doesn't work for other services. I think
the problem relies in the fact that .NET will send an href'd object rather
than placing the objects in the <servers> tag, but I'm not sure. As I said,
if trying to use this technique with other clients, I get problem during
serialization, and it looks like:

Original Exception: 

Error Message: argument is not an array
Error Code: 500
Target Servlet: null
Error Stack: 
[SOAPException: faultCode=SOAP-ENV:Client; msg=argument is not an array;
targetException=java.lang.IllegalArgumentException: argument is not an
array] 

Also, to be noticed is the fact that in only happens with arrays!
Has anyone come accross this before?
Thanks!
 
        Liv
 
 
 

   

Liviu Tudor 

Cimage Novasoft Limited
: www.cimagenovasoft.com <http://www.cimagenovasoft.com/> 
+ liviut@cimage.com <ma...@cimage.com> 
(Fax: +44 (0)1344 767701
(Direct Line: +44 (0)1344 767759 
*Centennial Court, Easthampstead Road, Bracknell, BERKS, RG12 1JZ 

Sun Java Certified Programmer	

"C makes it easy to shoot yourself in the foot; C++ makes it harder, but
when you do, it blows away your whole leg." Bjarne Stroustrup