XML Deserialzation problem with Union of SimpleTypes
----------------------------------------------------
Key: AXIS-2444
URL: http://issues.apache.org/jira/browse/AXIS-2444
Project: Apache Axis
Type: Bug
Components: Serialization/Deserialization
Versions: 1.2.1
Environment: Windows XP, Sun JDK 1.4.2_06
Reporter: Subba Ayyagari
I've a WebService whose WSDL is View.wsdl. The result returned adheres to the
View.xsd (which is flattened into the View.wsdl for ease of use). The
WebService returns "FlexElementResult__Type" which is defined as given below.
On the client side, I use Axis 1.2.1 (I tried 1.2 as well as 1.1) with proxies
generated using WSDL2Java tool.
<xs:complexType name="FlexElementResult__Type">
<xs:sequence>
<xs:element name="Value" type="Value_Type" nillable="true"/>
</xs:sequence>
<xs:attribute name="Name" type="xs:string" use="required"/>
</xs:complexType>
<xs:simpleType name="Value_Type">
<xs:union memberTypes="xs:boolean xs:date xs:string xs:decimal xs:gYearMonth
xs:int xs:integer xs:long xs:float LoanType__Type"/>
</xs:simpleType>
The WebService returns the following payload. I've a small PHP file setup on my
hosting site that returns this following response for testing purposes at
http://72.3.135.4/EMCAxisBug.php
<fnf:ViewReadResponse xmlns:fnf="http://example.test.com/services/View/1.01">
<Element Name="BorrowerName" xmlns:fnf1="http://example.test.com/services">
<Value xsi:type="xs:string">TEST,NAME</Value>
</Element>
<Element Name="OriginalMortgageAmount"
xmlns:fnf1="http://example.test.com/services">
<Value xsi:type="xs:decimal">99888.00</Value>
</Element>
<Element Name="LoanType" xmlns:fnf1="http://example.test.com/services">
<Value xsi:type="fnf:LoanType__Type">ConventionalWithoutPMI</Value>
</Element>
</fnf:ViewReadResponse>
This XML reponse is valid per schema View.xsd.
But, when I use my test case with the generated axis client proxy, I get the
following exception:
- Could not convert java.lang.String to bean field 'value', type
com.test.example.services.View._1_01.Value_Type
- Exception:
java.lang.IllegalArgumentException: argument type mismatch
at
org.apache.axis.encoding.ser.BeanPropertyTarget.set(BeanPropertyTarget.java:157)
at
org.apache.axis.encoding.DeserializerImpl.valueComplete(DeserializerImpl.java:249)
at
org.apache.axis.encoding.DeserializerImpl.endElement(DeserializerImpl.java:509)
at
org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:171)
at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
at org.apache.axis.client.Call.invoke(Call.java:2448)
at org.apache.axis.client.Call.invoke(Call.java:2347)
at org.apache.axis.client.Call.invoke(Call.java:1804)
at
com.test.example.services.View._1_01.ViewSOAPHttpsBindingStub.viewRead(ViewSOAPHttpsBindingStub.java:178)
at com.test.TestMain.main(TestMain.java:17)
I don't see anything wrong with the response XML. I've a build.xml attached
that generate the proxy classes and runs my test against my hosted hard-coded
webservice php file. I also attached a hard-coded JSP webserivce simulator
EMCAxisBug.jsp for your local testing.
I went through the mailing archives and googled for this, but nothing really
solved this problem and it looks to me like a bug in the deseriazation and
handling of union types.
I am attaching the eclipse project am using along with all the sample response,
wsdl, xsd etc etc.
Please let me know if you need anything else.
Thanks
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira