场景描述:使用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;

 

 

        

posted on 2013-05-31 16:35  NeverGiveUp_ZONE  阅读(3846)  评论(0编辑  收藏  举报