使用wsdl2php的php web服务客户端的ArrayOf_apachesoap_Element数据类型
问题描述:
我正在使用PHP编写Web服务客户端。 Web服务是使用轴开发的ij java。客户端代理使用wsdl2php工具生成。代理代码包括如下代码使用wsdl2php的php web服务客户端的ArrayOf_apachesoap_Element数据类型
class ValidateDetails {
public $elements; // ArrayOf_apachesoap_Element
public $pipeName; // string
}
和参数被设置和服务被称为使用以下代码
$xml = '<elements> <some xml here /> </elements>';
$xmlElement = new DOMElement('elements', $xml, '');
$details = new ValidateDetails();
$details->elements[0] = $xmlElement;
$details->pipeName = 'mypipe';
$response = new ValidationResult();
$response = $client->validate($details);
然而SoapRequest对象不包含该元素节点内的嵌套的XML。它看起来像这样
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://build.nomos.com" xmlns:ns2="http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns3="urn:CompilationService" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:validate>
<details xsi:type="ns3:ValidateDetails">
<elements SOAP-ENC:arrayType="ns2:Element[1]" xsi:type="ns3:ArrayOf_apachesoap_Element">
<item xsi:type="SOAP-ENC:Struct"/>
</elements>
<pipeName xsi:type="xsd:string">mypipe</pipeName>
</details></ns1:validate></SOAP-ENV:Body></SOAP-ENV:Envelope>
我无法理解如何使用正确的xml填充元素字段。请建议这是什么ArrayOf_apachesoap_Element数据类型以及如何填充此参数。
答
显然这种类型的数据类型转换没有解决方案,或者至少我不知道这种数据类型。尝试使用标准数据类型,如字符串,如果您有权访问主机Web服务
是的,我已经要求将数据类型更改为字符串值,这似乎是最合适的解决方案。 –