Hi!
I created a wsdl which contains a attribute/value pair where the
value is definied as xsd:anyType:
<xs:complexType name="ZAttributeValue">
<xs:sequence>
<xs:element name="name" type="xs:string" />
<xs:element name="displayName" nillable="true" type="xs:string" />
<xs:element name="value" nillable="true" type="xs:anyType" />
<xs:element name="className" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
Now I used wsdl2java to create client and server code using adb data binding.
When value is "" (=empty string), the client throws this exception:
Exception in thread "main" org.apache.axis2.AxisFault: Current state
END_ELEMENT is not among the statesCHARACTERS, COMMENT, CDATA, SPACE,
ENTITY_REFERENCE, DTD valid for getText()
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at
de.mypackage.ZederbasicServiceStub.fromOM(ZederbasicServiceStub.java:8846)
at
de.mypackage.ZederbasicServiceStub.getZEDERObjects(ZederbasicServiceStub.java:1028)
at ZederBasicClientTest.main(ZederBasicClientTest.java:36)
Caused by: java.lang.IllegalStateException: Current state END_ELEMENT is not
among the statesCHARACTERS, COMMENT, CDATA, SPACE, ENTITY_REFERENCE, DTD valid
for getText()
at
com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.getText(XMLStreamReaderImpl.java:1052)
at
org.apache.axiom.om.impl.llom.OMStAXWrapper.getText(OMStAXWrapper.java:418)
at
org.apache.axis2.databinding.utils.ConverterUtil.getAnyTypeObject(ConverterUtil.java:1528)
at de.debeka.repository.zws
In this case, the soap message looks like this:
<attributes xmlns="http://model.zws2.boq.debeka.gen/xsd">
<name>HINWEIS</name>
<displayName>Hinweis</displayName>
<value xmlns:s45="http://www.w3.org/2001/XMLSchema-instance"
xmlns:s46="http://www.w3.org/2001/XMLSchema" s45:type="s46:string">
</value>
<className>java.lang.String</className>
</attributes>
When value is set to null, I get this exception:
Exception in thread "main" org.apache.axis2.AxisFault:
org.apache.axis2.databinding.ADBException: Unexpected subelement value
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at
de.mypackage.ZederbasicServiceStub.fromOM(ZederbasicServiceStub.java:8846)
at
de.mypackage.ZederbasicServiceStub.getZEDERObjects(ZederbasicServiceStub.java:1028)
at ZederBasicClientTest.main(ZederBasicClientTest.java:36)
Caused by: java.lang.Exception: org.apache.axis2.databinding.ADBException:
Unexpected subelement value
at
de.mypackage.ZederbasicServiceStub$ZAttributeValue$Factory.parse(ZederbasicServiceStub.java:2583)
at
de.mypackage.ZederbasicServiceStub$ZDataObject$Factory.parse(ZederbasicServiceStub.java:7596)
at
de.mypackage.ZederbasicServiceStub$GetZEDERObjectsResponse$Factory.parse(ZederbasicServiceStub.java:4833)
at
de.mypackage.ZederbasicServiceStub.fromOM(ZederbasicServiceStub.java:8833)
... 2 more
Caused by: org.apache.axis2.databinding.ADBException: Unexpected subelement
value
at
de.mypackage.ZederbasicServiceStub$ZAttributeValue$Factory.parse(ZederbasicServiceStub.java:2569)
... 5 more
The soap message is:
<attributes xmlns="http://model.zws2.boq.debeka.gen/xsd">
<name>KLASSE</name>
<displayName xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:nil="1" />
<value xmlns:s29="http://www.w3.org/2001/XMLSchema-instance"
xmlns:s30="http://www.w3.org/2001/XMLSchema"
s29:type="s30:string">C_Jobplan</value>
<className>java.lang.Integer</className>
</attributes>
I tried Axis2 1.4.1 and the new 1.5 version. The whole problem with nil and
empty string values only exists with anyType, not if the element is declared
as string or something else.
I really need anyType here.
Thank you for your help in advance.
--
Boris Klug, Koblenz, [email protected], Fax: 0261-1334249