简体   繁体   中英

soap request issue

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>

Above is the SOAP request but when i try to post it via my php code i am getting an error that "Couldn't resolve host 'accountapi.internal"...help me 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);
 ?>

Here is my php code ....

I think the url http://accountapi.internal/CardInquiry belongs to some LAN & is publicly not available to use. So when ever you are calling this URL it's not getting any name server register for this address. so you are getting the message "Couldn't resolve host". Try putting IP Address i think it will work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM