当我使用wsdl和端点url执行我的curl php请求时获得空白响应

问题描述 投票:-1回答:1

请帮助我,当我执行我的curl php请求和wsdl,端点url时得到空白响应。

这是我的代码:

//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);
}
php xml curl soap
1个回答
0
投票

我猜你实际上得到了500错误,但在你的php配置中禁用了错误输出。如果是这样,请检查您的phpinfo()是否已安装curl模块。出于安全原因提出问题时,请避免显示您的真实凭据。

© www.soinside.com 2019 - 2024. All rights reserved.