繁体   English   中英

SOAP请求未返回响应

[英]SOAP request not returning a response

我正在请求一个查找HIV专家的搜索目录。 以下是他们提供的文档: http : //mobile.aahivm.org/getinfo.asmx?op=GetProviders

我使用PHP的cUrl发出请求。 知道为什么什么都不退货吗?

<?php

$curlData = '<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <GetProviders xmlns="http://localhost">
      <fname></fname>
      <lname></lname>
      <locationzip></locationzip>
      <locationcity></locationcity>
      <locationstate>New York</locationstate>
      <locationcountry></locationcountry>
      <primaryservicesid></primaryservicesid>
      <credentials></credentials>
      <specialty></specialty>
      <specialtycare></specialtycare>
      <support></support>
      <paymentoptions></paymentoptions>
      <member></member>
    </GetProviders>
  </soap12:Body>
</soap12:Envelope>'; 

$url='http://mobile.aahivm.org/getinfo.asmx?op=GetProviders';


$curl = curl_init();
$length = strlen($curlData);
curl_setopt ($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_VERBOSE, true);

curl_setopt($curl,CURLOPT_HTTPHEADER,array (

    'POST /getinfo.asmx HTTP/1.1',
    'Host: mobile.aahivm.org',
    'Content-Type: application/soap+xml; charset=utf-8',
     'Content-Length:'=>$length,
    'SOAPAction: "http://localhost/GetProviders"' 

));

curl_setopt ($curl, CURLOPT_POST, 1);
curl_setopt ($curl, CURLOPT_POSTFIELDS, $curlData);

//$result = substr(curl_exec($curl), 285, -72); ///remove SOAP envelope!


$result = curl_exec($curl); 
print_r("Curl result: ".$result."<br><br><hr>");


curl_close ($curl);


$arr2 = array();
$arr2[] = json_decode($result, true);


////

 foreach ($arr2 as $key=>$value) {
    //echo $value;
    $next[] = $value;
        foreach ($next as $key=>$value) {
        //echo $value;
        $next[] = $value;
            foreach ($next as $key=>$value) {
            echo $key."=".$value."<br />";
            }
            echo "--<br /><br />";
        }   

 }

 /////
 ?>

您是否要检索响应中的所有提供程序? 在他们的文档( http://mobile.aahivm.org/getinfo.asmx?op=GetProviders )中,它显示“显示的占位符需要替换为实际值”。 因此,我假设您将需要随请求一起发送,以搜索某种值。

希望这个对你有帮助

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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