开发者

unable to deserialize complex types on apache axis - the "anytype" problem

开发者 https://www.devze.com 2023-03-25 03:52 出处:网络
I am forced to use what looks to be a very old wsdl to generate web service clients. So old in fact that the jdk\'s wsimport refuses to parse it. Axis 1.4 however succedes in generating a web-service

I am forced to use what looks to be a very old wsdl to generate web service clients. So old in fact that the jdk's wsimport refuses to parse it. Axis 1.4 however succedes in generating a web-service client that for the most part works. There is one annoying problem, it cannot handle consecutive complex types described with "anyType"

Here is the original stack trace:

java.lang.RuntimeException: org.xml.sax.SAXException: No deserializer for {http://www.w3.org/2001/XMLSchema}anyType
Caused by: org.xml.sax.SAXException: No deserializer for {http://www.w3.org/2001/XMLSchema}anyType
    at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
    at org.apache.axis.client.Call.invoke(Call.java:2470)
    at org.apache.axis.client.Call.invoke(Call.java:2366)
    at org.apache.axis.client.Call.invoke(Call.java:1812)

I thought I could solve this by registering a TypeMapping that attempts to map the <item> element (see xml below) to its associated class but this does not work:

code added...

_call.registerTypeMapping(VoipAccountSubscriberRead.class, new QName("http://www.w3.org/2001/XMLSchema", "anyType"), null, new BeanDeserializerFactory(VoipAccountSubscriberRead.class, new QName("http://www.w3.org/2001/XMLSchema", "anyType")));

...resulting stack-trace:

j

Caused by: 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.ser.ArrayDeserializer.valueComplete(ArrayDeserializer.java:583)
    at org.apache.axis.encoding.DeserializerImpl.endElement(DeserializerImpl.java:509)

Is this due to the fact that the xml has more than one nested complex type described by anytype[1] and anytype[0] or am I just way off the mark? I am a SOAP newbie, with a basic understanding of xml and an inadequate understanding of xsd so probably am way off the mark :)

Here is the incoming xml:

<?xml version="1.0"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <get_voip_account_by_external_idResponse xmlns="urn:/SOAP/Provisioning">
      <data>
        <create_timestamp xsi:type="xsd:string">2011-08-04 13:55:58</create_timestamp>
        <开发者_运维问答;status xsi:type="xsd:string">active</status>
        <billing_profile xsi:type="xsd:string">default</billing_profile>
        <terminate_timestamp xsi:nil="true" xsi:type="xsd:string"/>
        <activate_timestamp xsi:type="xsd:string">2011-08-04 13:55:58</activate_timestamp>
        <modify_timestamp xsi:type="xsd:string">2011-08-04 13:55:58</modify_timestamp>
        <external_id xsi:type="xsd:string">CID_472486001</external_id>
        <id xsi:type="xsd:int">121</id>
        <subscribers soapenc:arrayType="xsd:anyType[1]" xsi:type="soapenc:Array">
          <item>
            <admin xsi:type="xsd:boolean">false</admin>
            <alias_numbers soapenc:arrayType="xsd:anyType[0]" xsi:type="soapenc:Array"/>
            <webpassword xsi:nil="true" xsi:type="xsd:string"/>
            <status xsi:type="xsd:string">active</status>
            <ac xsi:nil="true" xsi:type="xsd:int"/>
            <webusername xsi:nil="true" xsi:type="xsd:string"/>
            <uuid xsi:type="xsd:string">5cad2cac-cc03-45bd-9ea9-189e22fdd406</uuid>
            <account_id xsi:nil="true" xsi:type="xsd:int"/>
            <username xsi:type="xsd:string">c734106b8e563edebc3098a991402566</username>
            <domain xsi:type="xsd:string">labzip-snc01.somedomain.com</domain>
            <password xsi:type="xsd:string">4daac6c07b33c76c2d5ff9bb710f4ab7</password>
            <external_id xsi:type="xsd:string">CID_472486001</external_id>
            <cc xsi:nil="true" xsi:type="xsd:int"/>
            <subscriber_id xsi:type="xsd:int">127</subscriber_id>
            <sn xsi:nil="true" xsi:type="xsd:string"/>
          </item>
        </subscribers>
      </data>
    </get_voip_account_by_external_idResponse>
  </soap:Body>
</soap:Envelope>

ANY HELP GREATLY APPRECIATED !!!! (even if its not an answer per se. Just point me in the right direction)

0

精彩评论

暂无评论...
验证码 换一张
取 消