[英]Getting Blank response when i am executing my curl php with request with wsdl and endpoint url
请帮助我,当我使用请求和 wsdl,端点 url 执行我的 curl php 时得到空白响应。
这是我的代码:
//end point url
$e_url="https://tmcrmportal.inservices.tatamotors.com/home/B2C/com.eibus.web.soa
p.Gateway.wcp?organization=o=B2C;cn=cordys,cn=cbop,o=tatamotors.com";
//wsdl
$wsdl="WSDL";
//$curl = curl_init($e_url);
//request
$xml_post_string = '<?xml version="1.0"?>
<SOAP:Envelope xmlns:SOAP=\\"http://schemas.xmlsoap.org/soap/envelope/\\">
<SOAP:Header>
<wsse:Security xmlns:wsse=\\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\\">
<wsse:UsernameToken xmlns:wsse=\\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\\">
<wsse:Username>username</wsse:Username>
<wsse:Password>pwd</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</SOAP:Header>
<SOAP:Body>
<samlp:Request IssueInstant=\\"2004-12-05T09:21:59Z\\" MajorVersion=\\"1\\" MinorVersion=\\"1\\" RequestID=\\"456789\\" xmlns:samlp=\\"urn:oasis:names:tc:SAML:1.0:protocol\\">
<samlp:AuthenticationQuery>
<saml:Subject xmlns:saml=\\"urn:oasis:names:tc:SAML:1.0:assertion\\">
<saml:NameIdentifier Format=\\"urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified\\">username</saml:NameIdentifier>
</saml:Subject>
</samlp:AuthenticationQuery>
</samlp:Request>
</SOAP:Body>
</SOAP:Envelope>';
$headers = array(
"Content-type: text/xml;charset=\"utf-8\"",
"Accept: text/xml",
"Cache-Control: no-cache",
"Pragma: no-cache",
"SOAPAction: \"run\"",
"Content-length: ".strlen($xml_post_string),
);
$ch = curl_init("ENDPOINTURL");
curl_setopt($ch, CURLOPT_URL, $wsdl);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_post_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
if(curl_exec($ch) === false) {
$err = 'Curl error: ' . curl_error($ch);
print $err;
curl_close($ch);
} else {
$response = curl_exec($ch);
print $response.'Operation completed without any errors';
curl_close($ch);
}
我猜您实际上收到了 500 错误,但是在您的 php 配置中禁用了错误输出。 如果是这样,请检查您的 phpinfo() 是否安装了 curl 模块。 出于安全原因,在提问时请避免显示您的真实凭据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.