axis2客户端调用时ArrayOf_xsd_string类型的处理

今天在使用axis2调用一个Axis1的webservice时出现了一个如下类型的数据

 

 

<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="xxxxxxx">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="ArrayOf_xsd_string">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
</restriction>
</complexContent>
</complexType>
</schema>
</wsdl:types>

 

 这个类型的数据在,服务端也就是一个string数组,在客户端写的调用代码自然而然的想到也是映射成一个string数组,调用时出现:

Found character data inside an array element while deserializing

 

在网上搜索了半天,无果,也没有找到解决办法。关键时刻还是要靠自己。

 

在使用eclipse里面的web Service Explorer调用时看到请求的SOAP信息如下:

 

 

 <phone q0:arrayType="xsd:string[1]" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="q0:Array">
  <string xsi:type="xsd:string">1592523xxxx</string> 
  </phone>

 

在使用HttpAnalyzer监控java代码的调时发现传递的这样的信息:

  <item0 xmlns="">1592823xxxx</item0> 
  <item0 xmlns="">1338333xxxx</item0> 

 

感觉这个不像是数组,所以我就将java代码中,原先的一维数组变成二维数组试一下

String[] phones = {"1592823xxxx","1338333xxxx"};

 

String[][] phones = {{"15925232137","1837393xxxx"}};

 重新调用测试,发现调用成功

 

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值