肥皂请求问题

时间:2012-06-19 04:28:10

标签: php soap

POST /accountapi/service.asmx HTTP/1.1
Host: staging.prepaidfinancialservices.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://accountapi.internal/CardInquiry"

<?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>
    <CardInquiry xmlns="http://accountapi.internal/">
      <sClientLogin>string</sClientLogin>
      <sClientPassword>string</sClientPassword>
      <CardNumber>string</CardNumber>
    </CardInquiry>
  </soap:Body>
</soap:Envelope>

上面是SOAP请求但是当我尝试通过我的PHP代码发布它时,我收到一条错误“无法解析主机'accountapi.internal”...帮助我plzz

<?php
ini_set('display_errors', "1");
$a=fopen("test.xml",'r');
$mxml=fread($a,65536);
$url='http://accountapi.internal/CardInquiry';
$yt =curl_init($url);
$header =   "POST /accountapi/service.asmx HTTP/1.1 <br>";
$header .=  "Host: staging.prepaidfinancialservices.com <br>";
$header .=  "Content-Type: application/soap+xml; charset=utf-8 <br>";
$header .=  "Content-Length: ".strlen($mxml)."\r\n <br>";
$header .=  "SOAPAction: 'http://accountapi.internal/CardInquiry' <br>";
echo $header."<br><br>";
//exit; 


$header .=  $mxml;
curl_setopt($yt, CURLOPT_SSL_VERIFYPEER,0);
curl_setopt($yt, CURLOPT_URL, $url);
curl_setopt($yt, CURLOPT_CUSTOMREQUEST, $header);
curl_setopt($yt, CURLOPT_RETURNTRANSFER, true);
$rxml=curl_exec($yt);
echo "sent\n$mxml\n<br>";
echo "received\n$rxml\n"; 
echo curl_error($yt);
 ?>

这是我的PHP代码....

1 个答案:

答案 0 :(得分:0)

我认为网址http://accountapi.internal/CardInquiry属于某些LAN&amp;公开无法使用。因此,当您调用此URL时,没有为此地址获取任何名称服务器注册。所以你收到消息“无法解析主机”。尝试输入IP地址,我认为它会起作用。