2013-11-22 3 views
1

PHP SOAP 호출의 본문을 설정하는 데 문제가 있습니다. 나는 내가 올바른 형식으로 그것을 얻는 방법을 모른다는 것을 알고있다. 여기 PHP SOAP 호출을 만드는 방법

내가 지금까지 PHP에서 무엇을 가지고

다음
$client = new SoapClient('http://url'); 
    $username='username'; 
    $password='password'; 

    $headers=' 
     '.$username.' 
     '.$password.' 
    '; 

    $securityTags = new SoapVar($headers, XSD_ANYXML); 

    $header=new SoapHeader("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", "Security",$securityTags,true); 

    $client->__setSoapHeaders(array($header)); 

    //HOW DO I SET THE BODY???? 
    $params = array('deal'=>'PT10M', 'StoreIds'=>64); 
    return $client->__soapCall("PullDeals", array('searchCriteria'=>$params)); 

는에 'trace' => true를 추가 같은 요청이 보여야 요청이 귀하의 요청을 비교할

<soapenv:Envelope xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:deal="http://url.com" xmlns:ns="http://url" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> 
    <soapenv:Header> 
     <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> 
     <wsse:UsernameToken wsu:Id="UsernameToken-145" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> 
      <wsse:Username>YOUR_USERNAME</wsse:Username> 
      <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">YOUR_PASSWORD</wsse:Password> 
      <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">JQT6P7Zd3COZerXkREww2g==</wsse:Nonce> 
      <wsu:Created>2013-11-19T22:18:54.122Z</wsu:Created> 
     </wsse:UsernameToken> 
     </wsse:Security> 
    </soapenv:Header> 
    <soapenv:Body> 
     <ns:PullDeals> 
     <ns:searchCriteria> 
      <deal:MaxElapsedSinceUpdate>PT10M</deal:MaxElapsedSinceUpdate>   
      <deal:StoreIds><arr:long>64</arr:long></deal:StoreIds> 
     </ns:searchCriteria> 
     </ns:PullDeals> 
    </soapenv:Body> 
</soapenv:Envelope> 

답변

관련 문제