WSDL客户端问题,PHP

问题描述:

我想下面的XML请求发送到WSDL Web服务:WSDL客户端问题,PHP


<?xml version="1.0" encoding="utf-8"?> 
<soapenv:Envelope 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 xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="UsernameToken-'.$nonce.'"> 
<wsse:Username>xxxxx</wsse:Username> 
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">xxxxx</wsse:Password> 
</wsse:UsernameToken> 
<wsu:Timestamp wsu:Id="Timestamp-'.$nonce.'" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> 
<wsu:Created>'.$timestamp.'</wsu:Created> 
<wsu:Expires>'.$expiration.'</wsu:Expires> 
</wsu:Timestamp> 
</wsse:Security> 
</soapenv:Header> 
<soapenv:Body> 
<prep:requestListeSeancesCtrlAcces> 
    <codeManifestation>xxxx</codeManifestation> 
    <!--Optional:--> 
    <debutIntervalle/> 
    <!--Optional:--> 
    <finIntervalle/> 
    </prep:requestListeSeancesCtrlAcces> 
</soapenv:Body> 
</soap:Envelope> 

我怎样才能做到这一点?我试着PHP SOAP扩展,并且还的NuSOAP没有成功:(您的帮助

感谢

+0

向我们展示您尝试过的。 – svens 2010-12-12 22:46:46

+0

因此,您确定此SOAP消息符合WSDL,并且您想知道如何将此消息作为请求的主体发送到HTTP端点? – ivy 2010-12-12 22:58:24

你有没有尝试过的HttpRequest ::发送如看到的例子在http://www.php.net/manual/en/function.httprequest-send.php#95734并在自己的数据填:?

<?php 
//set up variables 
$theData = '<?xml version="1.0" encoding="utf-8"?> 
<soapenv:Envelope 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 xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="UsernameToken-'.$nonce.'"> 
<wsse:Username>xxxxx</wsse:Username> 
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">xxxxx</wsse:Password> 
</wsse:UsernameToken> 
<wsu:Timestamp wsu:Id="Timestamp-'.$nonce.'" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> 
<wsu:Created>'.$timestamp.'</wsu:Created> 
<wsu:Expires>'.$expiration.'</wsu:Expires> 
</wsu:Timestamp> 
</wsse:Security> 
</soapenv:Header> 
<soapenv:Body> 
<prep:requestListeSeancesCtrlAcces> 
    <codeManifestation>xxxx</codeManifestation> 
    <!--Optional:--> 
    <debutIntervalle/> 
    <!--Optional:--> 
    <finIntervalle/> 
    </prep:requestListeSeancesCtrlAcces> 
</soapenv:Body> 
</soap:Envelope>'; 

$url = 'http://www.example.com'; 
$options = array(); 

//create the httprequest object     
$httpRequest_OBJ = new httpRequest($url, HTTP_METH_POST, $options); 
//add the content type 
$httpRequest_OBJ->setContentType = 'Content-Type: text/xml'; 
//add the raw post data 
$httpRequest_OBJ->setRawPostData ($theData); 
//send the http request 
$result = $httpRequest_OBJ->send(); 
//print out the result 
echo "<pre>"; print_r($result); echo "</pre>"; 
?> 

当我使用WSDL我使用卷曲

用于修改标头和信封使用此: curl_setopt($ CH,CURLOPT_HTTPHEADER,$头); curl_setopt($ CH,CURLOPT_POSTFIELDS,$ S oapenvelope);