2013-01-04 28 views
0

我搜索了更多示例,但它不起作用。我不知道如何爲我的xml消息創建一段「POST代碼」。我想我需要一個soapclient,但我不完全知道我如何使用它。無法弄清楚如何在PHP中創建XML SOAP Post

WSDL文件地址:https://secure.intelly.nl/webservices/intellymodule001.asmx?WSDL

這是我創建的XML消息:

<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" 
     xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
     xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" 
     xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
     xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
     xmlns:tns="http://extranet.intelly.nl/module001/" 
     xmlns:s="http://www.w3.org/2001/XMLSchema" 
    xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 
    xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" > 
<SOAP-ENV:Body> 
    <tns:GetDomains xmlns:tns="http://extranet.intelly.nl/module001/"> 
     <tns:credentials> 
      <ExternalProgramFunction>***</ExternalProgramFunction> 
      <ExternalProgramID>***</ExternalProgramID> 
      <Domain>***</Domain> 
      <Username>***</Username> 
      <Password>***</Password> 
     </tns:credentials> 
     <tns:message> 
     </tns:message> 
     <tns:message> 
     </tns:message> 
     <tns:searchParameters> 
      <OnlyActive>True</OnlyActive> 
     </tns:searchParameters> 
    </tns:GetDomains> 
</SOAP-ENV:Body> 

回答

0

PHP有一個本地SoapClient,下面是一個例子使用輸入結構:

$client = new SoapClient('https://secure.intelly.nl/webservices/intellymodule001.asmx?WSDL'); 

$params = array(
    'credentials' => array(
     'ExternalProgramFunction' => 'xxx', 
     'ExternalProgramID' => 'xxx', 
     'Domain' => 'xxx', 
     'UserName' => 'xxx', 
     'Password' => 'xxx' 
    ), 
    'message' => array(), 
    'searchParameters' => array(
     'OnlyActive' => true 
    ) 
); 

$response = $client->GetDomains($params); 

print_r($response); 
+0

好的,謝謝你的例子!但是,如果使用此,則響應是: stdClass的對象( [GetDomainsResult] => stdClass的對象() [消息] => stdClass的對象( [信息] => stdClass的對象() [警告] => stdClass Object() [Errors] => stdClass Object( [string] =>指定用戶名) [ErrorCode] =>) 因爲某些原因,它不會得到用戶名我填寫...當然,我用優良的價值取代了所有的x) 任何想法? – user1947863

+0

看我的編輯。 '用戶名'參數需要大寫N. – MrCode

+0

對不起。有用!!謝謝! – user1947863