2013-03-12 87 views
0

我有一個問題,以創建一個肥皂呼叫。正如你可以看到第三方客戶端提供的頭沒有頭名稱。我需要通過將用戶名和密碼傳遞給標題中沒有名稱的soap請求來創建soap調用。我嘗試了幾個例子,但沒有成功。下面的調用在soap UI中工作,但是當涉及到php時,我遇到了嚴重的問題。任何幫助,將不勝感激肥皂標題沒有標題名稱php

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:int="http://namespace.example.com/"> 
    <soapenv:Header> 
     <int:password>123</int:password> 
     <int:login>abc</int:login> 
    </soapenv:Header> 
    <soapenv:Body> 
     <int:getEventTree> 
     <!--Optional:--> 
     <lang>en</lang> 
     </int:getEventTree> 
    </soapenv:Body> 
</soapenv:Envelope> 

回答

0

請看看http://php.net/manual/en/soapclient.dorequest.php

您可以使用如下代碼:

$response = $soapClient->__doRequest(
    $request, 
    $endpoint, 
    $soapAction, 
    $soapVersion, 
    $one_way  
); 

$請求可以被定義爲包含XML,如字符串:

$request = 
'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/""xmlns:int="http://namespace.example.com/"> 
    <soapenv:Header> 
     <int:password>123</int:password> 
     <int:login>abc</int:login> 
    </soapenv:Header> 
    <soapenv:Body> 
     <int:getEventTree> 
      <!--Optional:--> 
      <lang>en</lang> 
     </int:getEventTree> 
    </soapenv:Body> 
</soapenv:Envelope>'; 

您可以在__doRequest()ca中定義其餘參數取決於你的配置。