使用 wsdl2php 的 php Web 服务客户端的 ArrayOf_apachesoap_Element 数据类型
我正在用 PHP 编写一个 Web 服务客户端。 Web服务是使用axis开发的ij java。客户端代理是使用 wsdl2php 工具生成的。代理代码包括以下代码
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 填充 elements 字段。请建议这个 ArrayOf_apachesoap_Element 数据类型是什么以及如何填充此参数。
I am writing a web service client in PHP. web service is developed ij java using axis. Client proxy is generated using wsdl2php tool. Proxy code include the following code
class ValidateDetails {
public $elements; // ArrayOf_apachesoap_Element
public $pipeName; // string
}
and the parameters are set and service is called using the following code
$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);
However the SoapRequest object does not contain the nested xml inside the element node. It looks like this
<?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>
I am unable to understand how to populate the elements field with the correct xml. Please suggest what is this ArrayOf_apachesoap_Element datatype and how can i populate this parameter.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
显然没有针对这种数据类型转换的解决方案,或者至少我不知道这种数据类型。如果您有权访问主机 Web 服务,请尝试使用标准数据类型,例如字符串
Apparently there is no solution for such kind of data type conversions, or at least i am not aware of this datatype. try to use standard data types such as string, if you have access to the host web service