2012-06-19 147 views
0
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」 ......幫我plzzSOAP請求問題

<?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

請添加您的PHP代碼。否則你的問題不清楚。 – hakre

回答

0

我覺得URL http://accountapi.internal/CardInquiry屬於某個LAN &是公衆無法使用。所以當你打電話給這個URL時,它沒有得到這個地址的任何名字服務器註冊。因此您收到消息「無法解析主機」。嘗試把IP地址,我認爲它會工作。

+0

這裏是「http://accountapi.internal/CardInquiry」API的鏈接..https://staging.prepaidfinancialservices.com/accountapi/service.asmx?op = CardInquiry –

+0

其實我試圖實現'prepaidfinancialservices.com '付款方式在我的網站,而不是paypall付款方式.....我試圖使用'prepaidfinancialservices.com' API 和卡查詢我想發佈SOAP請求像這樣....'https:/ /staging.prepaidfinancialservices.com/accountapi/service.asmx?OP = CardInquiry' –