场景描述:使用axis2发布webservice时,传递参数的对象属性包含map,即:

    public  Class AA implements Serializable {

        public Map   B;

     生成的wsdl中包含

                                   

<xs:complexType name= "A">  
     <xs:sequence> 
            <xs:element name="B" type="xs:anyType" nillable="true" minOccurs="0"/>  
    </xs:sequence> 
</xs:complexType>

    生成客户端后调用报错:  Caused by: javax.xml.stream.XMLStreamException: Unknow type can not serialize

过程分析:

    axis2解析wsdl时会将xs:anyType认为是Object类型,但Obejct类型只有序列化才能传输,故解析报错

解决方案:

    将map换成对象数组的形式,

      public  Class AA implements Serializable {

        public B[]   bb;

 

      public Class B   implements Serializable {

          private String key;

          private String value;

 

 

        

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-08
  • 2021-10-20
  • 2021-12-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-09
  • 2022-12-23
  • 2021-08-25
  • 2022-12-23
  • 2021-10-26
  • 2022-12-23
相关资源
相似解决方案