从PHP消费web服务

从PHP消费web服务,php,web-services,soap,biztalk,soapui,Php,Web Services,Soap,Biztalk,Soapui,我正在使用一个来自PHP的服务,并且还使用SOAP UI进行测试 Soap UI和在浏览器中使用服务都可以正常工作,但是我的客户机说,当我们在浏览器中运行此服务时,它不会影响BizTalk。但是,当我们从SOAP UI运行它时,它正在命中BizTalk 我已经隐藏了客户URL 我的代码如下 $xml_data ='<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> &

我正在使用一个来自PHP的服务,并且还使用SOAP UI进行测试


Soap UI和在浏览器中使用服务都可以正常工作,但是我的客户机说,当我们在浏览器中运行此服务时,它不会影响BizTalk。但是,当我们从SOAP UI运行它时,它正在命中BizTalk

我已经隐藏了客户URL

我的代码如下

$xml_data ='<soapenv:Envelope      xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header/>
   <soapenv:Body>
           <ns0:FacilityAndProgramBookings      xmlns:ns0="<<<<<Customer URL>>>>>>">
    <BookingTransactions>
     <Action>A</Action> 
   <Venue>VenueV</Venue> 
   <Event_Type>Event_</Event_Type> 
  <Event_Category>Eve</Event_Category> 
  <StartDateTime>1999-05-31T13:20:00.000-05:00</StartDateTime> 
  <EndDateTime>1999-05-31T13:20:00.000-05:00</EndDateTime> 
  <BookingID>BookingIDBookingIDBo</BookingID> 
  <TransactionID>TransactionIDTransactionIDTransactionIDTransaction</TransactionID> 
  <TransactionDateTime>1999-05-31T13:20:00.000-05:00</TransactionDateTime> 
  <Amount>10.4</Amount> 
  </BookingTransactions>
  </ns0:FacilityAndProgramBookings>
  </soapenv:Body>
  </soapenv:Envelope>';


$URL = "<<<<<URL>>>>>>>";

        $ch = curl_init($URL);
        curl_setopt($ch, CURLOPT_MUTE, 1);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
        curl_setopt($ch, CURLOPT_POSTFIELDS, "$xml_data");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $output = curl_exec($ch);
                    echo"$output";
        curl_close($ch);
$xml\u data=”
A.
维努埃夫
事件
前夕
1999-05-31T13:20:00.000-05:00
1999-05-31T13:20:00.000-05:00
预订
TransactionIDTransactionIDTransactionIDTransaction
1999-05-31T13:20:00.000-05:00
10.4
';
$URL=“>>”;
$ch=curl\u init($URL);
curl_setopt($ch,CURLOPT_MUTE,1);
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,0);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,0);
卷曲设置($ch,卷曲设置桩,1);
curl_setopt($ch,CURLOPT_HTTPHEADER,array('Content-Type:text/xml'));
curl_setopt($ch,CURLOPT_POSTFIELDS,“$xml_data”);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
$output=curl\u exec($ch);
回显“$output”;
卷曲关闭($ch);

“Soap UI和在浏览器中使用服务都可以正常工作,但是我的客户说,当我们在浏览器中运行此服务时,它不会影响BizTalk。”-您能澄清一下这句话吗?我们正在发布数据,当我们通过上面的代码执行此操作时,它不会影响BizTalk。但是,如果我们将xml放入SOAP UI,它就会访问BizTalk Server OHH,因此问题可能在于cURL代码。您使用的模板字符串很奇怪,在您的代码中,
“$output”
。如果您想将某些内容转换为字符串,应该使用
(字符串)$output
由简单变量导出,
var\u export($output,true)
由复杂变量导出(没有uu-toString)。
CURLOPT\u MUTE
无效,因为PHP5.2尝试以下操作:
curl\u setopt($soap\u do,CURLOPT\u HTTPHEADER,array('Content-Type:text/xml;charset=utf-8',Content-Length:'.strlen($xml\u data));curl\u setopt($ch,CURLOPT_USERPWD,$user.:“$password);
如果有错误消息,则
$err=curl_error($ch)
目前我只能发送提示,很难远程调试某些东西……我想答案就在错误消息中……例如,xml数据中没有
,没有内容类型头的字符集,没有SOAPAction头等等……可能有很多事情。