PHP Soap标题

时间:2012-03-12 14:00:21

标签: php soap soapheader

我正在尝试为WSDL设置Soap标头,并想知道以下代码是否正确。

我尝试将所有3个变量传递给Soap标头。

任何指针都会非常感激。

由于

PHP代码:

try{
            $soap_client = new SoapClient('https://mywebservice.com/ws.php?wsdl');

            //Body of the Soap Header.       
            $soapheader = $this->getMRSoapHeader("PortalOnlineInventorySearch");
            $headerbody = array('Timestamp' => $soapheader['Timestamp'],
                                'Signature' => $soapheader['Signature'],
                                'AccessID'  => $soapheader['AccessID']);

            //Create Soap Header.       
            $header = new SOAPHeader($this->ns, 'WebServiceSoapHeader', $headerbody);       

            //set the Headers of Soap Client.
            $soap_client->__setSoapHeaders($header); 

            $searchResult = $soap_client->PortalOnlineInventorySearch($meetingRoomOnlineSearchCriteria);
        }catch (Exception  $e){
             error_log("Error getting Search Results from Titan" + $e->getMessage());            
             var_dump("Error performing criteria search" . $e->getMessage());
        }

WSDL:

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Header>
    <WebServiceSoapHeader xmlns="https://mywebservice.com/ws.php?wsdl">
      <Signature>string</Signature>
      <AccessID>string</AccessID>
      <Timestamp>string</Timestamp>
    </WebServiceSoapHeader>
  </soap12:Header>
  <soap12:Body>
    <PortalOnlineInventorySearch xmlns="https://mywebservice.com/ws.php">
      <searchCriteria>            
        <keyword>int</keyword>
        <ReturnServices>boolean</ReturnServices>            
      </searchCriteria>
    </PortalOnlineInventorySearch>
  </soap12:Body>
</soap12:Envelope>

0 个答案:

没有答案