You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Marcus Mosttler (JIRA)" <ax...@ws.apache.org> on 2004/11/09 19:44:25 UTC

[jira] Commented: (AXIS-1569) Problems with Deserialzing Arrays by the Axis Servlet and the Axis Client for a Doc/Literal service

     [ http://nagoya.apache.org/jira/browse/AXIS-1569?page=comments#action_55240 ]
     
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.

(NOTE: I was using WRAPPED/LITERAL)

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 service
> ---------------------------------------------------------------------------------------------------
>
>          Key: AXIS-1569
>          URL: http://nagoya.apache.org/jira/browse/AXIS-1569
>      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: Bean.java, TestService-deploy.wsdd, TestService.java, TestService.wsdl, TestServiceServiceTestCase.java
>
> 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="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.example.com/types">
>       <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" maxOccurs="unbounded"/>
>         </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(SimpleDeserializer.java:149)
>         at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1025)
>         at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:159)
>         at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:845)
>         at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:198)
>         at org.apache.axis.message.RPCElement.getParams(RPCElement.java:323)
>         at org.apache.axis.client.Call.invoke(Call.java:2418)
>         at org.apache.axis.client.Call.invoke(Call.java:2317)
>         at org.apache.axis.client.Call.invoke(Call.java:1774)
>         at com.example.TestServiceSoapBindingStub.hello(TestServiceSoapBindingStub.java:144)
>         at com.example.TestServiceServiceTestCase.test1TestServiceHello(TestServiceServiceTestCase.java:42)
> 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="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>   <soap:Body>
>     <helloInput xmlns="http://www.example.com/wsdl">
>       <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="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>
>     <helloReturn xmlns="http://www.example.com/wsdl">
>       <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:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira