从PHP使用Web服务

时间:2014-06-04 18:53:07

标签: php web-services soap biztalk soapui

我正在使用PHP的服务,并且还使用SOAP UI进行测试。

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

我隐藏了客户网址

我的代码如下。

$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);

0 个答案:

没有答案