无法在服务器中获取SOAP响应

时间:2019-10-07 05:39:50

标签: php xml api soap

我尝试使用soap API获得响应,但失败。但是它在本地主机上运行,​​而不是在服务器上。我不明白,这是什么问题。请帮助找出问题。 我在下面附加了我的代码。

    $soap_request = '<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <ListAllStyleClassifications xmlns="http://tempuri.org/">
      <APIKey>APIKEY-String</APIKey>
    </ListAllStyleClassifications>
  </soap:Body>
</soap:Envelope>';


  $header = array(
    "Host: bocini.com.au",
    "Content-type: text/xml;charset=utf-8",
    "Accept: text/xml",
    "SOAPAction: http://tempuri.org/ListAllStyleClassifications",
    "Content-length: ".strlen($soap_request),
  );

  $soap_do = curl_init();
  curl_setopt($soap_do, CURLOPT_URL, "https://bocini.com.au:9081/3rdpartyedi/infosvr.asmx?wsdl" );
  curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 10);
  curl_setopt($soap_do, CURLOPT_TIMEOUT,        10);
  curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true );
  curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false);
  curl_setopt($soap_do, CURLOPT_POST,           true );
  curl_setopt($soap_do, CURLOPT_POSTFIELDS,     $soap_request);
  curl_setopt($soap_do, CURLOPT_HTTPHEADER,     $header);

  $result = curl_exec($soap_do);
    curl_close($soap_do);
    //$result = json_decode(json_encode($result), true);
    print_r($result);

0 个答案:

没有答案