I am working on new project, for this project i have to use SOAP. I am new to this SOAP. I red my project documentation. In that documentation it has WSDL and XML request. By using boath WSDL and XML request how can i send XML request. Bellow i am writing WSDL and XML request. Please help me.

我正在开发新项目,对于这个项目,我必须使用SOAP。我是这个SOAP的新手。我重写了我的项目文档。在该文档中,它具有WSDL和XML请求。通过使用boath WSDL和XML请求,我如何发送XML请求。 Bellow我正在编写WSDL和XML请求。请帮帮我。

Thankyou.


WSDL:

http://acceptance.travelstreet.com/hotelsv3/components/hotels_ws.cfc?wsdl

XML REQUEST:

<?xml version="1.0" encoding="utf-8"?>
<OTA_HotelAvailRQ Version="1.0">
   <POS>
    <Source>
     <UniqueId Id="username:password" />
    </Source>
   </POS>
   <AvailRequestSegments>
    <AvailRequestSegment>
     <StayDateRange End="2011-08-15" Start="2011-08-14" />
     <RoomStayCandidates>
      <RoomStayCandidate Quantity="1">
       <GuestCounts>
        <GuestCount AgeQualifyingCode="10" Count="1" />
       </GuestCounts>
      </RoomStayCandidate>
     </RoomStayCandidates>
     <HotelSearchCriteria>
      <Criterion>
       <HotelRef Destination="East London, South Africa" CityCode="" CountryCode="" HotelName="" MinHotelRating="1"/>
       <SearchCurrency>EUR</SearchCurrency>
       <AdditionalInfo Value="1" />
       <Language>EN</Language>
      </Criterion>
     </HotelSearchCriteria>
    </AvailRequestSegment>
   </AvailRequestSegments>
  </OTA_HotelAvailRQ>

2 个解决方案

#1


9

I suggest you read up about PHP's SoapClient. There are lots of good examples in the PHP manual.

我建议你阅读有关PHP的SoapClient的信息。 PHP手册中有很多很好的例子。

To get you started, create the object:

为了帮助您入门,请创建对象:

$client = new SoapClient('http://www.example.com/end_point.wsdl');

Then call the method:

然后调用方法:

$result = $client->SomeFunction($data);

where SomeFunction is the method name you want to call on the service, and $data is a PHP array representing the XML data structure you want to send.

其中SomeFunction是您要在服务上调用的方法名称,$ data是表示您要发送的XML数据结构的PHP数组。

Hope that helps.

希望有所帮助。

[EDIT] Just to clarify in light of the OP's further questions:

[编辑]只是为了澄清OP的进一步问题:

You don't need to create the actual XML code when using PHP SOAPClient. You need to put the data into a PHP array, and SOAPClient will convert it to XML for you. The array keys should be named for the XML element names, and the array values are the element values. Use nested arrays for nested XML elements.

使用PHP SOAPClient时,无需创建实际的XML代码。您需要将数据放入PHP数组中,SOAPClient会将它转换为XML。应为XML元素名称命名数组键,并且数组值是元素值。将嵌套数组用于嵌套XML元素。

更多相关文章

  1. PHP数组值进入第二个数组[重复]
  2. 如何在php数组中插入新的键值对?
  3. mysql_fetch_array返回一个数组,数字为“1”
  4. PHP-从多维数组中删除重复值
  5. 更改数组键而不更改顺序
  6. 在PHP中更改关联数组索引的位置
  7. 如何在数组中存储产品数量
  8. php吧字符串直接转换成数组处理
  9. 使用 PHP usort() 通过用户自定义的比较函数对数组进行排序

随机推荐

  1. 使用PHP读取特定XML节点上特定数组的值
  2. Mac自带Apache和Php
  3. 广场上的空间和空间有不同的意义吗?
  4. PHP学习笔记-00
  5. PHP trait 特性在 Laravel 中的使用个人
  6. PHP获取服务器端的相关信息
  7. IIS 8.5 伪静态去掉index.php thinkphp 3
  8. 如何使用Ajax或Jquery填充文本框中的值?
  9. PHP在PC端实现微信扫码支付模式二
  10. WS-Trust没有使用PHP进行身份验证