如何在PHP中编写SOAP XML web服务
我是PHP中SOAP API web服务的新手,我必须接受XML输入并以XML返回。请推荐一些代码示例。事实上,我正在为我的酒店做渠道经理 输入XML如何在PHP中编写SOAP XML web服务,php,xml,web-services,soap,Php,Xml,Web Services,Soap,我是PHP中SOAP API web服务的新手,我必须接受XML输入并以XML返回。请推荐一些代码示例。事实上,我正在为我的酒店做渠道经理 输入XML <ns3:OTA_HotelResNotifRQ ResStatus="Commit" EchoToken="dsh0a" xmlns:ns2="http://www.example.com/hotels/channelmgr/" xmlns:ns3="http://www.example.org/OTA/2003/05/beta">
<ns3:OTA_HotelResNotifRQ ResStatus="Commit" EchoToken="dsh0a"
xmlns:ns2="http://www.example.com/hotels/channelmgr/"
xmlns:ns3="http://www.example.org/OTA/2003/05/beta">
<ns3:POS>
<ns3:Source>
<ns3:BookingChannel>
<ns3:CompanyName CompanyShortName="MMYT" Code="MMYT"
CountryCode="IN">Make My Trip</ns3:CompanyName>
</ns3:BookingChannel>
</ns3:Source>
</ns3:POS>
<ns3:HotelReservations>
<ns3:HotelReservation ResStatus="Commit" CreateDateTime="2014-05-19">
<ns3:UniqueID ID="AB123456789012"/>
<ns3:RoomStays>
<ns3:RoomStay>
<ns3:RoomTypes>
<ns3:RoomType NumberOfUnits="1" RoomTypeCode="Float"/>
</ns3:RoomTypes>
<ns3:RatePlans>
<ns3:RatePlan>
Make My Trip CONFIDENTIAL 7
<ns3:MealsIncluded MealPlanCodes="CP"/>
</ns3:RatePlan>
</ns3:RatePlans>
<ns3:RoomRates>
<ns3:RoomRate EffectiveDate="2014-05-20" ExpireDate="2014-05-21"
RatePlanCode="1234567891234"/>
<ns3:RoomRate EffectiveDate="2014-05-21" ExpireDate="2014-05-22"
RatePlanCode="98765437291739"/>
</ns3:RoomRates>
</ns3:RoomStay>
<ns3:RoomStay>
<ns3:RoomTypes>
<ns3:RoomType NumberOfUnits="1" RoomTypeCode="Float"/>
</ns3:RoomTypes>
<ns3:RatePlans>
<ns3:RatePlan>
<ns3:MealsIncluded MealPlanCodes="CP"/>
</ns3:RatePlan>
</ns3:RatePlans>
<ns3:RoomRates>
<ns3:RoomRate EffectiveDate="2014-05-20" ExpireDate="2014-05-21"
RatePlanCode="1234567891234"/>
Make My Trip CONFIDENTIAL 8
<ns3:RoomRate EffectiveDate="2014-05-21" ExpireDate="2014-05-22"
RatePlanCode="98765437291739"/>
</ns3:RoomRates>
</ns3:RoomStay>
<ns3:RoomStay>
<ns3:RoomTypes>
<ns3:RoomType NumberOfUnits="1" RoomTypeCode="Float"/>
</ns3:RoomTypes>
<ns3:RatePlans>
<ns3:RatePlan>
<ns3:MealsIncluded MealPlanCodes="CP"/>
</ns3:RatePlan>
</ns3:RatePlans>
<ns3:RoomRates>
<ns3:RoomRate EffectiveDate="2014-05-20" ExpireDate="2014-05-21"
RatePlanCode="1234567891234"/>
<ns3:RoomRate EffectiveDate="2014-05-21" ExpireDate="2014-05-22"
RatePlanCode="98765437291739"/>
</ns3:RoomRates>
</ns3:RoomStay>
</ns3:RoomStays>
<ns3:Services>
<ns3:Service>
<ns3:Price>
Make My Trip CONFIDENTIAL 9
<ns3:AdditionalGuestAmounts AmountBeforeTax="362.00"
CurrencyCode="INR" DecimalPlaces="2"/>
<ns3:Total AmountAfterTax="4249.98" CurrencyCode="INR"
DecimalPlaces="2">
<ns3:Taxes>
<ns3:Tax Amount="947.98" CurrencyCode="INR" DecimalPlaces="2">
<ns3:TaxDescription Name="Hotelier Tax"/>
</ns3:Tax>
<ns3:Tax Amount="126.00" CurrencyCode="INR" DecimalPlaces="2">
<ns3:TaxDescription Name="TDS"/>
</ns3:Tax>
</ns3:Taxes>
</ns3:Total>
</ns3:Price>
<ns3:ServiceDetails>
<ns3:GuestCounts>
<ns3:GuestCount AgeQualifyingCode="10" Count="6"/>
<ns3:GuestCount AgeQualifyingCode="8" Count="2"/>
</ns3:GuestCounts>
</ns3:ServiceDetails>
</ns3:Service>
</ns3:Services>
<ns3:ResGuests>
<ns3:ResGuest PrimaryIndicator="true">
Make My Trip CONFIDENTIAL 10
<ns3:Profiles>
<ns3:ProfileInfo>
<ns3:Profile>
<ns3:Customer>
<ns3:PersonName>
<ns3:GivenName>Test</ns3:GivenName>
</ns3:PersonName>
</ns3:Customer>
</ns3:Profile>
</ns3:ProfileInfo>
</ns3:Profiles>
</ns3:ResGuest>
</ns3:ResGuests>
<ns3:ResGlobalInfo>
<ns3:TimeSpan Start="2014-05-20" End="2014-05-22"/>
<ns3:CancelPenalties>
<ns3:CancelPenalty>
<ns3:PenaltyDescription>
<ns3:Text># More than 2 days before check-in date: FREE CANCELLATION; 2
days before check-in date: 1 night cost will be charged as
cancellation fee; In case of no show: no refund; An additional
MakeMyTrip service charge of INR 250 will apply
</ns3:Text>
</ns3:PenaltyDescription>
Make My Trip CONFIDENTIAL 11
</ns3:CancelPenalty>
</ns3:CancelPenalties>
<ns3:HotelReservationIDs>
<ns3:HotelReservationID ResID_Type="14" ResID_Value="AB123456789012"
ResID_Date="2014-05-19"/>
</ns3:HotelReservationIDs>
<ns3:BasicPropertyInfo HotelCode="987654321987654321" HotelName="The
test test"/>
</ns3:ResGlobalInfo>
</ns3:HotelReservation>
</ns3:HotelReservations>
</ns3:OTA_HotelResNotifRQ>
<OTA_HotelResNotifRS
xmlns="http://www.opentravel.org/OTA/2003/05/beta" Version="1.0"
TimeStamp="2012-04-27T10:56:34" EchoToken="UUicg">
<Success />
<HotelReservations>
<HotelReservation>
<UniqueID Type="14" ID="AB123456789" />
<ResGlobalInfo>
<HotelReservationIDs>
<HotelReservationID ResID_Type="14"
ResID_Value=" YourConfirmationNo " />
</HotelReservationIDs>
</ResGlobalInfo>
</HotelReservation>
</HotelReservations>
</OTA_HotelResNotifRS>
去旅行吧
把我的旅行保密
把我的旅行保密
把我的旅行保密
把我的旅行保密
试验
#入住日前2天以上:免费取消;2.
入住日期前天:1晚费用按
取消费;如未到场:不退款;额外的
MakeMyTrip服务费为250卢比
把我的旅行保密
输出XML
<ns3:OTA_HotelResNotifRQ ResStatus="Commit" EchoToken="dsh0a"
xmlns:ns2="http://www.example.com/hotels/channelmgr/"
xmlns:ns3="http://www.example.org/OTA/2003/05/beta">
<ns3:POS>
<ns3:Source>
<ns3:BookingChannel>
<ns3:CompanyName CompanyShortName="MMYT" Code="MMYT"
CountryCode="IN">Make My Trip</ns3:CompanyName>
</ns3:BookingChannel>
</ns3:Source>
</ns3:POS>
<ns3:HotelReservations>
<ns3:HotelReservation ResStatus="Commit" CreateDateTime="2014-05-19">
<ns3:UniqueID ID="AB123456789012"/>
<ns3:RoomStays>
<ns3:RoomStay>
<ns3:RoomTypes>
<ns3:RoomType NumberOfUnits="1" RoomTypeCode="Float"/>
</ns3:RoomTypes>
<ns3:RatePlans>
<ns3:RatePlan>
Make My Trip CONFIDENTIAL 7
<ns3:MealsIncluded MealPlanCodes="CP"/>
</ns3:RatePlan>
</ns3:RatePlans>
<ns3:RoomRates>
<ns3:RoomRate EffectiveDate="2014-05-20" ExpireDate="2014-05-21"
RatePlanCode="1234567891234"/>
<ns3:RoomRate EffectiveDate="2014-05-21" ExpireDate="2014-05-22"
RatePlanCode="98765437291739"/>
</ns3:RoomRates>
</ns3:RoomStay>
<ns3:RoomStay>
<ns3:RoomTypes>
<ns3:RoomType NumberOfUnits="1" RoomTypeCode="Float"/>
</ns3:RoomTypes>
<ns3:RatePlans>
<ns3:RatePlan>
<ns3:MealsIncluded MealPlanCodes="CP"/>
</ns3:RatePlan>
</ns3:RatePlans>
<ns3:RoomRates>
<ns3:RoomRate EffectiveDate="2014-05-20" ExpireDate="2014-05-21"
RatePlanCode="1234567891234"/>
Make My Trip CONFIDENTIAL 8
<ns3:RoomRate EffectiveDate="2014-05-21" ExpireDate="2014-05-22"
RatePlanCode="98765437291739"/>
</ns3:RoomRates>
</ns3:RoomStay>
<ns3:RoomStay>
<ns3:RoomTypes>
<ns3:RoomType NumberOfUnits="1" RoomTypeCode="Float"/>
</ns3:RoomTypes>
<ns3:RatePlans>
<ns3:RatePlan>
<ns3:MealsIncluded MealPlanCodes="CP"/>
</ns3:RatePlan>
</ns3:RatePlans>
<ns3:RoomRates>
<ns3:RoomRate EffectiveDate="2014-05-20" ExpireDate="2014-05-21"
RatePlanCode="1234567891234"/>
<ns3:RoomRate EffectiveDate="2014-05-21" ExpireDate="2014-05-22"
RatePlanCode="98765437291739"/>
</ns3:RoomRates>
</ns3:RoomStay>
</ns3:RoomStays>
<ns3:Services>
<ns3:Service>
<ns3:Price>
Make My Trip CONFIDENTIAL 9
<ns3:AdditionalGuestAmounts AmountBeforeTax="362.00"
CurrencyCode="INR" DecimalPlaces="2"/>
<ns3:Total AmountAfterTax="4249.98" CurrencyCode="INR"
DecimalPlaces="2">
<ns3:Taxes>
<ns3:Tax Amount="947.98" CurrencyCode="INR" DecimalPlaces="2">
<ns3:TaxDescription Name="Hotelier Tax"/>
</ns3:Tax>
<ns3:Tax Amount="126.00" CurrencyCode="INR" DecimalPlaces="2">
<ns3:TaxDescription Name="TDS"/>
</ns3:Tax>
</ns3:Taxes>
</ns3:Total>
</ns3:Price>
<ns3:ServiceDetails>
<ns3:GuestCounts>
<ns3:GuestCount AgeQualifyingCode="10" Count="6"/>
<ns3:GuestCount AgeQualifyingCode="8" Count="2"/>
</ns3:GuestCounts>
</ns3:ServiceDetails>
</ns3:Service>
</ns3:Services>
<ns3:ResGuests>
<ns3:ResGuest PrimaryIndicator="true">
Make My Trip CONFIDENTIAL 10
<ns3:Profiles>
<ns3:ProfileInfo>
<ns3:Profile>
<ns3:Customer>
<ns3:PersonName>
<ns3:GivenName>Test</ns3:GivenName>
</ns3:PersonName>
</ns3:Customer>
</ns3:Profile>
</ns3:ProfileInfo>
</ns3:Profiles>
</ns3:ResGuest>
</ns3:ResGuests>
<ns3:ResGlobalInfo>
<ns3:TimeSpan Start="2014-05-20" End="2014-05-22"/>
<ns3:CancelPenalties>
<ns3:CancelPenalty>
<ns3:PenaltyDescription>
<ns3:Text># More than 2 days before check-in date: FREE CANCELLATION; 2
days before check-in date: 1 night cost will be charged as
cancellation fee; In case of no show: no refund; An additional
MakeMyTrip service charge of INR 250 will apply
</ns3:Text>
</ns3:PenaltyDescription>
Make My Trip CONFIDENTIAL 11
</ns3:CancelPenalty>
</ns3:CancelPenalties>
<ns3:HotelReservationIDs>
<ns3:HotelReservationID ResID_Type="14" ResID_Value="AB123456789012"
ResID_Date="2014-05-19"/>
</ns3:HotelReservationIDs>
<ns3:BasicPropertyInfo HotelCode="987654321987654321" HotelName="The
test test"/>
</ns3:ResGlobalInfo>
</ns3:HotelReservation>
</ns3:HotelReservations>
</ns3:OTA_HotelResNotifRQ>
<OTA_HotelResNotifRS
xmlns="http://www.opentravel.org/OTA/2003/05/beta" Version="1.0"
TimeStamp="2012-04-27T10:56:34" EchoToken="UUicg">
<Success />
<HotelReservations>
<HotelReservation>
<UniqueID Type="14" ID="AB123456789" />
<ResGlobalInfo>
<HotelReservationIDs>
<HotelReservationID ResID_Type="14"
ResID_Value=" YourConfirmationNo " />
</HotelReservationIDs>
</ResGlobalInfo>
</HotelReservation>
</HotelReservations>
</OTA_HotelResNotifRS>
这是一个新的应用程序,您可以选择任何您想要的技术,或者它已经启动,并且基于某种框架?如果是的话,哪一个呢?亲爱的Michal,这是一个SOAP(简单对象访问协议),我想用PHP编写。你对PHP有什么想法吗?您是否使用SOAP编写过任何web服务?PHP以SOAP客户端和SOAP服务器的形式提供了内置的SOAP支持,您可以在这里找到它:。有些框架有包装器,所以如果您正在使用包装器,那么您应该检查您的框架是否有包装器。但如果你有一个新的应用程序,那么你就不必担心这个问题。它是一个新的应用程序,你可以使用任何你想要的技术,或者它已经启动了,并且基于某种框架?如果是的话,哪一个呢?亲爱的Michal,这是一个SOAP(简单对象访问协议),我想用PHP编写。你对PHP有什么想法吗?您是否使用SOAP编写过任何web服务?PHP以SOAP客户端和SOAP服务器的形式提供了内置的SOAP支持,您可以在这里找到它:。有些框架有包装器,所以如果您正在使用包装器,那么您应该检查您的框架是否有包装器。但若你们有新的申请,那个么你们就不必担心了。