我正在从 PHP NuSoap 实现中检索数据,它返回的数据如下所示:
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:getHashCodeAllTablesResponse xmlns:ns1="urn:getSchemaForRhythms">
<return xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType=":[121]">
<item xsi:type="xsd:">
<md5Hash xsi:type="xsd:string">e294967afe9834bf8477252ac0c3686e</md5Hash>
<tableName xsi:type="xsd:string">SYSCONGLOMERATES</tableName>
<isView xsi:type="xsd:string">false</isView>
<viewDefinition xsi:type="xsd:string">null</viewDefinition>
</item>
我认为这是问题所在:<return xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType=":[121]">
当我将我的 Axis2 soap 客户端指向该服务时,出现此错误:
org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unsupported type http://schemas.xmlsoap.org/soap/encoding/ Array
这是我正在尝试做的一个非常简单的 Java 示例:
public static void main(String[] args) {
// TODO code application logic here
try{
GetSchemaForRhythmsStub stub = new GetSchemaForRhythmsStub(null,"http://test.test.com/sqlSchemaService/schemaBuilder.php" );
GetSchemaForRhythmsStub.GetHashCodeAllTablesE response2= new GetSchemaForRhythmsStub.GetHashCodeAllTablesE();
stub.getHashCodeAllTables(response2);
}catch(Exception ex)
{
System.out.println(ex.toString());
}
}
我找不到任何与 Array 数据类型和 Axis 相关的文档。我错过了什么吗?
谢谢,
最佳答案
您缺少的是 SOAP 编码数组类型真的很老套(即它们在 XML 架构出现之前使用的类型),而 Axis2 不喜欢它。您可以尝试将数据绑定(bind)从 ADB(默认)切换到 XMLBeans。如何执行此操作取决于您解析 WSDL 的方式。这是我找到的一些引用资料:
Axis2's wsdl2java fails on RPC/Encoded style web services
通常,查找“soap encoded array axis2”以查找有关您正在做的事情的信息。
关于java - 如何让 Axis2 处理数组?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11561194/