axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marcus Mosttler (JIRA)" <>
Subject [jira] Commented: (AXIS-1569) Problems with Deserialzing Arrays by the Axis Servlet and the Axis Client for a Doc/Literal service
Date Tue, 09 Nov 2004 18:44:25 GMT
     [ ]
Marcus Mosttler commented on AXIS-1569:

I spent some time working through this very issue yesterday.  I was finally able to get the
full property array to be passed back and forth between the Java Axis Server and the Java
Axis Client and a .NET client.


I used a wsdl definition similar to the one in this bug and a bean similar to the one in this
bug.  To get the array to work I had to make the array property an indexed property.  I did
this by adding a setStringArray(String newString, int i) and a getStringArray(int i) : String.

Not only does the array seem to pass through correctly now but I also get the correct wsdl
when running java2wsdl (the ArrayOf_ is no longer generated).

I think there just needs to be some documentation update about indexed properties to complete
this bug.

> Problems with Deserialzing Arrays by the Axis Servlet and the Axis Client for a Doc/Literal
> ---------------------------------------------------------------------------------------------------
>          Key: AXIS-1569
>          URL:
>      Project: Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: beta-3
>  Environment: axis-1_2beta3, Java 1.4.2, Tomcat 5.0.27, WindowsXP(Professional)
>     Reporter: Kachra Patti
>  Attachments:, TestService-deploy.wsdd,, TestService.wsdl,
> Some Background
> ===============
> STEP1: Created a very simple class TestService, which contains a method hello(), that
merely returns the input
> public class TestService {
>     public Bean hello(Bean input) {return input; }
> }
> STEP 2: The input is a Bean instance, that has properties of types String, Integer, Date
and String[]
> public class Bean {
>     private String stringField;
>     private Integer integerField;
>     private java.util.Date dateField;
>     private String[] stringArray;
>     ...
> }
> STEP 3: TestService.wsdl was then created manually, to expose the above method as a webservice.
The following fragment shows the description of the Bean in the WSDL.
>      ...
>     <schema xmlns="" elementFormDefault="qualified"
>       <complexType name="Bean">
>         <sequence>
>           <element name="stringField" nillable="true" type="xsd:string"/>
>           <element name="integerField" nillable="true" type="xsd:int"/>
>           <element name="dateField" nillable="true" type="xsd:dateTime"/>
>           <element name="stringArray" nillable="true" type="xsd:string" minOccurs="0"
>         </sequence>
>       </complexType>
>     </schema>
>     ...
> STEP 4: Used the axis-wsdl2java task to generate deployment descriptors and test stubs
from the WSDL. Used the following code in the test class to invoke the webservice
>         ...
>         Bean input = new Bean();
>         input.setStringField("TEST STRING");
>         input.setIntegerField(new Integer(1001));
>         input.setDateField(new java.util.GregorianCalendar());
>         input.setStringArray(new String[] {"aa", "bb", "cc"});
>         Bean output = binding.hello(input);
>         ...
> Problems
> ========
> 1- Only the last object in the StringArray property is made available to the TestService
by the Axis Servlet. Eg. For the above test code, only the String "cc" is available to the
hello() method
> 2- The client throws the following error, when deserializing the output from the webservice
> org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT
expected, in something it was trying to deserialize.
>         at org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(
>         at org.apache.axis.encoding.DeserializationContext.startElement(
>         at org.apache.axis.message.SAX2EventRecorder.replay(
>         at org.apache.axis.message.MessageElement.publishToHandler(
>         at org.apache.axis.message.RPCElement.deserialize(
>         at org.apache.axis.message.RPCElement.getParams(
>         at org.apache.axis.client.Call.invoke(
>         at org.apache.axis.client.Call.invoke(
>         at org.apache.axis.client.Call.invoke(
>         at com.example.TestServiceSoapBindingStub.hello(
>         at com.example.TestServiceServiceTestCase.test1TestServiceHello(
> 3- Invoked the webservice from the .NET WebService Studio. Again, only the last element
in the StringArray property is made available to the TestService by the Axis Servlet
> Input
> ====
> <?xml version="1.0" encoding="utf-8"?>
> <soap:Envelope xmlns:soap="" xmlns:xsi=""
>   <soap:Body>
>     <helloInput xmlns="">
>       <stringField>TEST STRING</stringField>
>       <integerField>1001</integerField>
>       <dateField>2004-09-22T00:00:00.0000000-07:00</dateField>
>       <stringArray>aa</stringArray>
>       <stringArray>bb</stringArray>
>       <stringArray>cc</stringArray>
>     </helloInput>
>   </soap:Body>
> </soap:Envelope>
> Output
> =====
> <?xml version="1.0" encoding="utf-8"?>
> <soapenv:Envelope xmlns:soapenv="" xmlns:xsd=""
>   <soapenv:Body>
>     <helloReturn xmlns="">
>       <dateField>2004-09-22T07:00:00.000Z</dateField>
>       <integerField>1001</integerField>
>       <stringArray>
>         <item xmlns="">cc</item>
>       </stringArray>
>       <stringField>TEST STRING</stringField>
>     </helloReturn>
>   </soapenv:Body>
> </soapenv:Envelope>

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
If you want more information on JIRA, or have a bug to report see:

View raw message