2012-12-11 26 views
1

生成SOAP請求XML我有性病對象:PHP - 如何從對象

$args = new stdClass(); 
$args->userName = 'username'; 
$args->password = 'password'; 
$args->criteria->customer->customerId = '0002003'; 

我想創建SoapRequest XML:

<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="wsclient.dms.tecsys.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <SOAP-ENV:Body> 
     <mns1:search xmlns:mns1="wsclient.dms.tecsys.com"> 
      <arg0> 
       <userName>username</userName> 
       <password>password</password> 
       <criteria> 
        <customer> 
         <customerId>0002003</customerId> 
        </customer> 
       </criteria> 
      </arg0> 
     </mns1:search> 
    </SOAP-ENV:Body> 
</SOAP-ENV:Envelope> 

但我不能找到解決辦法。誰能幫我。 問候

回答

1

通過使用SoapClient類,你可以創建一個SOAP請求容易

看看這個

SoapClient的:__doRequest - 執行SOAP請求