You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Sergio Bossa <se...@gmail.com> on 2005/04/27 16:57:27 UTC
Axis 1.2 RC3 and array deserialization problem
Hi all!
First of all, my web services use doc/literal wrapped style.
When I try to send a simple array of strings with Axis 1.2RC3, I get
the following exception:
org.xml.sax.SAXException: SimpleDeserializer encountered a child
element, which is NOT expected, in something it was trying to
deserialize.
If I do not send the array (leaving the parameter null), all works well.
This is a code snippet of the request SOAP envelope generated by Axis 1.2RC3:
<soapenv:Body>
<query xmlns="http://montag.sourceforge.net/ns/wsdl/local">
<arg0 xsi:type="xsd:string">/resources</arg0>
<arg1 xsi:type="xsd:string"><test> { //resource[@timestamp=$ts]
} </test></arg1>
<arg2 xsi:nil="true"/>
<arg3>
<item xsi:type="xsd:string" xmlns="">ts</item>
<item xsi:type="xsd:string" xmlns="">1113390437052</item>
</arg3>
</query>
</soapenv:Body>
Moreover, if I use Axis 1.2RC2, everything works, the array works
well, but the SOAP envelope slightly changes:
<arg3 xsi:type="soapenc:Array"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<item xsi:type="xsd:string" xmlns="">ts</item>
<item xsi:type="xsd:string" xmlns="">1113390437052</item>
</arg3>
I cannot understand this Axis problem.
Here is the service WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
targetNamespace="http://montag.sourceforge.net/ns/wsdl/local"
xmlns:tns="http://montag.sourceforge.net/ns/wsdl/local"
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"
xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://montag.sourceforge.net/ns/wsdl/local">
<element name="query">
<complexType>
<sequence>
<element name="collection" type="xsd:string"/>
<element name="query" type="xsd:string"/>
<element minOccurs="0" maxOccurs="unbounded" name="namespaces"
type="xsd:string"/>
<element minOccurs="0" maxOccurs="unbounded" name="vars"
type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="queryResponse">
<complexType>
<sequence>
<element name="queryReturn" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="MontagSOAPFault">
<complexType>
<sequence/>
</complexType>
</element>
<element name="soapHeader">
<complexType>
<sequence>
<element name="username" type="xsd:string"/>
<element name="password" type="xsd:string"/>
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
<wsdl:message name="queryRequest">
<wsdl:part element="tns:query" name="parameters"/>
</wsdl:message>
<wsdl:message name="queryResponse">
<wsdl:part element="tns:queryResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="montagHeader">
<wsdl:part element="tns:soapHeader" name="header"/>
</wsdl:message>
<wsdl:message name="MontagSOAPFault">
<wsdl:part element="tns:MontagSOAPFault" name="fault"/>
</wsdl:message>
<wsdl:portType name="XQueryService">
<wsdl:operation name="query">
<wsdl:input message="tns:queryRequest" name="queryRequest"/>
<wsdl:output message="tns:queryResponse" name="queryResponse"/>
<wsdl:fault message="tns:MontagSOAPFault" name="MontagSOAPFault"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="XQueryServiceSoapBinding" type="tns:XQueryService">
<wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="query">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="queryRequest">
<wsdlsoap:body use="literal"/>
<wsdlsoap:header message="tns:montagHeader" part="header"
use="literal"/>
</wsdl:input>
<wsdl:output name="queryResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="MontagSOAPFault">
<wsdlsoap:fault name="MontagSOAPFault" use="literal"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="XQueryServiceService">
<wsdl:port binding="tns:XQueryServiceSoapBinding" name="XQueryService">
<wsdlsoap:address
location="http://localhost:8084/montag/services/XQueryService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Hope someone could help.
Regards,
Sergio B.
--
Sergio Bossa
Author and Developer of:
- Montag, Web Services System for XML Database Interaction:
http://montag.sourceforge.net
- QuickNote:
http://quicknote.sourceforge.net
Re: Axis 1.2 RC3 and array deserialization problem
Posted by Sergio Bossa <se...@gmail.com>.
On 4/28/05, Davanum Srinivas <da...@gmail.com> wrote:
> try latest Nightly / CVS and THEN file a bug :)
I've just done, but nothing works .... so, I'll regress to Axis 1.2
RC2 and I'll file a bug report as soon as I can.
However, there's one thing with RC2 that makes me puzzled ....
Its SOAP envelope:
<arg3 xsi:type="soapenc:Array"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<item xsi:type="xsd:string" xmlns="">ts</item>
<item xsi:type="xsd:string" xmlns="">1113390437052</item>
</arg3>
It uses SOAP encoding, even if my services are in doc/literal wrapped
style (see my first post and the reported code for any doubt)!
--
Sergio Bossa
Author and Developer of:
- Montag, Web Services System for XML Database Interaction:
http://montag.sourceforge.net
- QuickNote:
http://quicknote.sourceforge.net
Re: Axis 1.2 RC3 and array deserialization problem
Posted by Davanum Srinivas <da...@gmail.com>.
try latest Nightly / CVS and THEN file a bug :)
-- dims
On 4/28/05, Sergio Bossa <se...@gmail.com> wrote:
> > You should file a bug about wsdl2java with an attached example if you want it fixed ...
>
> I've just done.
>
> Should I file a bug report also for the array deserialization problem?
>
> It seems to me very absurd that Axis 1.2 RC3 broke array deserialization ...
>
> --
> Sergio Bossa
> Author and Developer of:
> - Montag, Web Services System for XML Database Interaction:
> http://montag.sourceforge.net
> - QuickNote:
> http://quicknote.sourceforge.net
>
--
Davanum Srinivas - http://webservices.apache.org/~dims/
Re: Axis 1.2 RC3 and array deserialization problem
Posted by Sergio Bossa <se...@gmail.com>.
> You should file a bug about wsdl2java with an attached example if you want it fixed ...
I've just done.
Should I file a bug report also for the array deserialization problem?
It seems to me very absurd that Axis 1.2 RC3 broke array deserialization ...
--
Sergio Bossa
Author and Developer of:
- Montag, Web Services System for XML Database Interaction:
http://montag.sourceforge.net
- QuickNote:
http://quicknote.sourceforge.net
Re: Axis 1.2 RC3 and array deserialization problem
Posted by "Tim K. (Gmane)" <tk...@ugcs.net>.
You should file a bug about wsdl2java with an attached example if you
want it fixed ...
Tim
Sergio Bossa wrote:
>>Did you regenerate the client stub using Axis 1.2RC3 wsdl2java?
>>
>>
>
>I do not use wsdl2java stubs: it produces a buggy fault
>implementation, generating a MontagSOAPFault_Element.java class file
>instead of a MontagSOAPFault class, so I have to correct it by hand,
>which is very annoying.
>I posted an help request about this, but nobody answered :-(
>
>So, I use Axis API directly, this is a code snippet:
>
>String wsdl="http://localhost:8084/montag/services/XQueryService?wsdl";
>Service service = new Service(new java.net.URL(wsdl),new
>QName("http://montag.sourceforge.net/ns/wsdl/local","XQueryServiceService"));
>Call call=(Call) service.createCall(new QName("XQueryService"));
>
>SOAPHeaderElement username=new
>SOAPHeaderElement("http://montag.sourceforge.net/ns/wsdl/local","username");
>SOAPHeaderElement password=new
>SOAPHeaderElement("http://montag.sourceforge.net/ns/wsdl/local","password");
>username.addTextNode("");
>password.addTextNode("");
>call.addHeader(username);
>call.addHeader(password);
>
>call.setOperationName(new
>QName("http://montag.sourceforge.net/ns/wsdl/local", "query") );
>
>ret = (String) call.invoke( new Object[] { "/resources", "<test> {
>//resource[@timestamp=$ts] } </test>", null, new
>String[]{"ts","1113390437052"} } );
>
>....
>
>Is there anything wrong?
>I tried rebuilding all, but it's always the same.
>
>
>
>>If so, then I would expect it to send a message that looks something like this:
>>
>>
>
>
>
>><namespaces>ts</namespaces>
>><vars>1113390437052</vars>
>>
>>
>
>No, <namespaces> is the first array, <vars> the second one: 'ts' and
>'1113390437052' are both elements of the second array, and the first
>array is null.
>
>I hope you'll find the solution.
>I run out of ideas.
>
>Thank you.
>Regards,
>
>Sergio B.
>
>
>
Re: Axis 1.2 RC3 and array deserialization problem
Posted by Sergio Bossa <se...@gmail.com>.
> Did you regenerate the client stub using Axis 1.2RC3 wsdl2java?
I do not use wsdl2java stubs: it produces a buggy fault
implementation, generating a MontagSOAPFault_Element.java class file
instead of a MontagSOAPFault class, so I have to correct it by hand,
which is very annoying.
I posted an help request about this, but nobody answered :-(
So, I use Axis API directly, this is a code snippet:
String wsdl="http://localhost:8084/montag/services/XQueryService?wsdl";
Service service = new Service(new java.net.URL(wsdl),new
QName("http://montag.sourceforge.net/ns/wsdl/local","XQueryServiceService"));
Call call=(Call) service.createCall(new QName("XQueryService"));
SOAPHeaderElement username=new
SOAPHeaderElement("http://montag.sourceforge.net/ns/wsdl/local","username");
SOAPHeaderElement password=new
SOAPHeaderElement("http://montag.sourceforge.net/ns/wsdl/local","password");
username.addTextNode("");
password.addTextNode("");
call.addHeader(username);
call.addHeader(password);
call.setOperationName(new
QName("http://montag.sourceforge.net/ns/wsdl/local", "query") );
ret = (String) call.invoke( new Object[] { "/resources", "<test> {
//resource[@timestamp=$ts] } </test>", null, new
String[]{"ts","1113390437052"} } );
....
Is there anything wrong?
I tried rebuilding all, but it's always the same.
> If so, then I would expect it to send a message that looks something like this:
> <namespaces>ts</namespaces>
> <vars>1113390437052</vars>
No, <namespaces> is the first array, <vars> the second one: 'ts' and
'1113390437052' are both elements of the second array, and the first
array is null.
I hope you'll find the solution.
I run out of ideas.
Thank you.
Regards,
Sergio B.
Re: Axis 1.2 RC3 and array deserialization problem
Posted by Anne Thomas Manes <at...@gmail.com>.
Did you regenerate the client stub using Axis 1.2RC3 wsdl2java?
If so, then I would expect it to send a message that looks something like this:
<soapenv:Body>
<query xmlns="http://montag.sourceforge.net/ns/wsdl/local">
<collection>/resources</collection>
<query><test>{ //resource[@timestamp=$ts]} </test><query/>
<namespaces>ts</namespaces>
<vars>1113390437052</vars>
</query>
</soapenv:Body>
Anne
On 4/27/05, Sergio Bossa <se...@gmail.com> wrote:
> Hi all!
>
> First of all, my web services use doc/literal wrapped style.
> When I try to send a simple array of strings with Axis 1.2RC3, I get
> the following exception:
>
> org.xml.sax.SAXException: SimpleDeserializer encountered a child
> element, which is NOT expected, in something it was trying to
> deserialize.
>
> If I do not send the array (leaving the parameter null), all works well.
> This is a code snippet of the request SOAP envelope generated by Axis 1.2RC3:
>
> <soapenv:Body>
> <query xmlns="http://montag.sourceforge.net/ns/wsdl/local">
> <arg0 xsi:type="xsd:string">/resources</arg0>
> <arg1 xsi:type="xsd:string"><test> { //resource[@timestamp=$ts]
> } </test></arg1>
> <arg2 xsi:nil="true"/>
> <arg3>
> <item xsi:type="xsd:string" xmlns="">ts</item>
> <item xsi:type="xsd:string" xmlns="">1113390437052</item>
> </arg3>
> </query>
> </soapenv:Body>
>
> Moreover, if I use Axis 1.2RC2, everything works, the array works
> well, but the SOAP envelope slightly changes:
>
> <arg3 xsi:type="soapenc:Array"
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
> <item xsi:type="xsd:string" xmlns="">ts</item>
> <item xsi:type="xsd:string" xmlns="">1113390437052</item>
> </arg3>
>
> I cannot understand this Axis problem.
> Here is the service WSDL:
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <wsdl:definitions
> targetNamespace="http://montag.sourceforge.net/ns/wsdl/local"
> xmlns:tns="http://montag.sourceforge.net/ns/wsdl/local"
> 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"
> xmlns="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://montag.sourceforge.net/ns/wsdl/local">
>
> <element name="query">
> <complexType>
> <sequence>
> <element name="collection" type="xsd:string"/>
> <element name="query" type="xsd:string"/>
> <element minOccurs="0" maxOccurs="unbounded" name="namespaces"
> type="xsd:string"/>
> <element minOccurs="0" maxOccurs="unbounded" name="vars"
> type="xsd:string"/>
> </sequence>
> </complexType>
> </element>
>
> <element name="queryResponse">
> <complexType>
> <sequence>
> <element name="queryReturn" type="xsd:string"/>
> </sequence>
> </complexType>
> </element>
>
> <element name="MontagSOAPFault">
> <complexType>
> <sequence/>
> </complexType>
> </element>
>
> <element name="soapHeader">
> <complexType>
> <sequence>
> <element name="username" type="xsd:string"/>
> <element name="password" type="xsd:string"/>
> </sequence>
> </complexType>
> </element>
>
> </schema>
>
> </wsdl:types>
>
> <wsdl:message name="queryRequest">
>
> <wsdl:part element="tns:query" name="parameters"/>
>
> </wsdl:message>
>
> <wsdl:message name="queryResponse">
>
> <wsdl:part element="tns:queryResponse" name="parameters"/>
>
> </wsdl:message>
>
> <wsdl:message name="montagHeader">
>
> <wsdl:part element="tns:soapHeader" name="header"/>
>
> </wsdl:message>
>
> <wsdl:message name="MontagSOAPFault">
>
> <wsdl:part element="tns:MontagSOAPFault" name="fault"/>
>
> </wsdl:message>
>
> <wsdl:portType name="XQueryService">
>
> <wsdl:operation name="query">
>
> <wsdl:input message="tns:queryRequest" name="queryRequest"/>
>
> <wsdl:output message="tns:queryResponse" name="queryResponse"/>
>
> <wsdl:fault message="tns:MontagSOAPFault" name="MontagSOAPFault"/>
>
> </wsdl:operation>
>
> </wsdl:portType>
>
> <wsdl:binding name="XQueryServiceSoapBinding" type="tns:XQueryService">
>
> <wsdlsoap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http"/>
>
> <wsdl:operation name="query">
>
> <wsdlsoap:operation soapAction=""/>
>
> <wsdl:input name="queryRequest">
>
> <wsdlsoap:body use="literal"/>
>
> <wsdlsoap:header message="tns:montagHeader" part="header"
> use="literal"/>
>
> </wsdl:input>
>
> <wsdl:output name="queryResponse">
>
> <wsdlsoap:body use="literal"/>
>
> </wsdl:output>
>
> <wsdl:fault name="MontagSOAPFault">
>
> <wsdlsoap:fault name="MontagSOAPFault" use="literal"/>
>
> </wsdl:fault>
>
> </wsdl:operation>
>
> </wsdl:binding>
>
> <wsdl:service name="XQueryServiceService">
>
> <wsdl:port binding="tns:XQueryServiceSoapBinding" name="XQueryService">
>
> <wsdlsoap:address
> location="http://localhost:8084/montag/services/XQueryService"/>
>
> </wsdl:port>
>
> </wsdl:service>
>
> </wsdl:definitions>
>
> Hope someone could help.
>
> Regards,
>
> Sergio B.
>
> --
> Sergio Bossa
> Author and Developer of:
> - Montag, Web Services System for XML Database Interaction:
> http://montag.sourceforge.net
> - QuickNote:
> http://quicknote.sourceforge.net
>