无法在apache轴上反序列化复杂类型 - “anytype”问题

时间:2011-08-04 19:35:04

标签: soap wsdl xsd axis deserialization

我被迫使用看起来非常古老的wsdl来生成Web服务客户端。事实上,jdk的wsimport拒绝解析它。然而,Axis 1.4成功地生成了一个Web服务客户端,该客户端大部分都可以工作。有一个恼人的问题,它无法处理用“anyType”描述的连续复杂类型

这是原始堆栈跟踪:

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)

我想我可以通过注册尝试映射< item>的TypeMapping来解决这个问题。 element(请参阅下面的xml)到其关联的类,但这不起作用:

已添加代码......

_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")));

...产生堆栈跟踪:

Ĵ

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)

这是因为xml有多个嵌套的复杂类型,由anytype [1]和anytype [0]描述,或者我只是偏离标记?我是一个SOAP新手,对xml有基本的了解,对xsd理解不充分,所以可能不太合适了。)

这是传入的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>

任何帮助都非常受欢迎!!!! (即使它本身不是答案。只要指出我正确的方向)

0 个答案:

没有答案