使用PHP连接到SOAP 1.1

时间:2013-08-08 13:48:25

标签: php web-services soap request

我有一个soap web服务,我需要在PHP中连接并从中获取结果 请求是:

<?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>
    <Booking xmlns="http://tempuri.org/">
      <myOrder>
        <FromDate>dateTime</FromDate>
        <ToDate>dateTime</ToDate>
        <Price>decimal</Price>
        <siteCommission>decimal</siteCommission>
        <HotelPriceIncentive>decimal</HotelPriceIncentive>
        <Count>int</Count>
        <PriceId>int</PriceId>
        <HotelId>int</HotelId>
        <Add_ID>int</Add_ID>
        <Create_net_booking>int</Create_net_booking>
        <OrderRooms>
          <ClOrderRooms>
            <capacityName>string</capacityName>
            <BaseTypeName>string</BaseTypeName>
            <RoomsTypeName>string</RoomsTypeName>
            <SessionId>string</SessionId>
            <AmountBruto>decimal</AmountBruto>
            <AmountNetto>decimal</AmountNetto>
            <Price>decimal</Price>
            <Count>int</Count>
            <BaseTypeId>int</BaseTypeId>
            <RoomTypeId>int</RoomTypeId>
            <Adults>int</Adults>
            <Child>int</Child>
            <Infants>int</Infants>
          </ClOrderRooms>
          <ClOrderRooms>
            <capacityName>string</capacityName>
            <BaseTypeName>string</BaseTypeName>
            <RoomsTypeName>string</RoomsTypeName>
            <SessionId>string</SessionId>
            <AmountBruto>decimal</AmountBruto>
            <AmountNetto>decimal</AmountNetto>
            <Price>decimal</Price>
            <Count>int</Count>
            <BaseTypeId>int</BaseTypeId>
            <RoomTypeId>int</RoomTypeId>
            <Adults>int</Adults>
            <Child>int</Child>
            <Infants>int</Infants>
          </ClOrderRooms>
        </OrderRooms>
        <GeneralAreaName>string</GeneralAreaName>
        <HotelName>string</HotelName>
        <GeneralAreaId>string</GeneralAreaId>
        <CancelBooking_Cancelled>boolean</CancelBooking_Cancelled>
        <CancelBooking_CancellationDays>int</CancelBooking_CancellationDays>
        <CancelBooking_Policy>string</CancelBooking_Policy>
        <SourcePrice>int</SourcePrice>
        <ExternalPriceID>int</ExternalPriceID>
        <CustomerPriceRemark>string</CustomerPriceRemark>
        <DocketId>int</DocketId>
        <FirstName>string</FirstName>
        <LastName>string</LastName>
        <Email>string</Email>
        <Tz>string</Tz>
        <PhoneNum>string</PhoneNum>
        <CellNumber>string</CellNumber>
        <Address>string</Address>
        <CreditCardNum>string</CreditCardNum>
        <Credit_Tashlumim>string</Credit_Tashlumim>
        <Credit_ExpMont>string</Credit_ExpMont>
        <Credit_ExpYear>string</Credit_ExpYear>
        <Credit_CVV>string</Credit_CVV>
        <Comments>string</Comments>
        <Travellers>
          <clTraveller>
            <FirstName>string</FirstName>
            <LastName>string</LastName>
            <Title>string</Title>
            <DateBirthday>string</DateBirthday>
          </clTraveller>
          <clTraveller>
            <FirstName>string</FirstName>
            <LastName>string</LastName>
            <Title>string</Title>
            <DateBirthday>string</DateBirthday>
          </clTraveller>
        </Travellers>
        <ConfigParam>
          <AmountMarkup>string</AmountMarkup>
          <APP_AgencyXmlBaseUrl>string</APP_AgencyXmlBaseUrl>
          <DocketType>string</DocketType>
          <SystemTypeId>int</SystemTypeId>
          <AgencyId>int</AgencyId>
          <UserName>string</UserName>
          <Password>string</Password>
          <SubSite>int</SubSite>
        </ConfigParam>
        <Result>
          <XmlAfterRegistration>string</XmlAfterRegistration>
          <DocketId>int</DocketId>
          <BUNDLE_ID>string</BUNDLE_ID>
          <Reserv_Num>
            <string>string</string>
            <string>string</string>
          </Reserv_Num>
        </Result>
      </myOrder>
    </Booking>
  </soap:Body>
</soap:Envelope>

我尝试使用php soapclient,但我不知道如何做到这一点。 我得到的错误是: 致命错误:未捕获的SoapFault异常:[WSDL] SOAP-ERROR:解析WSDL:无法从“https://web14.agency2000.co.il/bytechws/pricessearch.asmx?WSDL”加载:无法在C:\ xampp \ htdocs \中加载外部实体“https://web14.agency2000.co.il/bytechws/pricessearch.asmx?WSDL” credit2000 \ booking.php:96堆栈跟踪:#0 C:\ xampp \ htdocs \ credit2000 \ booking.php(96):SoapClient-&gt; SoapClient('https://web14.a ...',数组)#1C :\ xampp \ htdocs \ credit2000 \ booking.php(81):第96行的C:\ xampp \ htdocs \ credit2000 \ booking.php中调用的callData('Booking',Object(stdClass))#2 {main} 请帮忙???

1 个答案:

答案 0 :(得分:0)

您使用的WSDL网址不存在。如果没有正确的URL,您将无法成功处理该请求。 PHP需要WSDL来创建适当的数据结构。