帮助在 PHP 中创建肥皂请求

发布于 2024-11-09 00:08:28 字数 3499 浏览 0 评论 0原文

我将如何为这样的结构创建一个数组

抱歉,但我知道如何发送肥皂请求[php.net]..我只是想确认我需要使用自定义属性产生这样的请求的数组结构

<?xml version="1.0" encoding="utf-8"?>

   <SOAP-ENV:Header>

          <m:AuthenticationInfo xmlns:m="https://xml.hotelclub.net/xmlws/services/v2/">

                 <m:AffiliateID>xxx</m:AffiliateID>

                 <m:Password>xxx</m:Password>

                 <m:ClientIP>xxx</m:ClientIP>

          </m:AuthenticationInfo>

   </SOAP-ENV:Header>

   <SOAP-ENV:Body>

          <m:HotelBookingRequest xmlns:m="https://xml.hotelclub.net/xmlws/services/v2/" Version="2" LanguageCode="EN" CurrencyCode="AUD" AffiliateUniqueID="Rodel9">

                 <m:StayDateRange CheckIn="2011-03-28" CheckOut="2011-03-29" ArrivalTime="12"/>

                 <m:Hotel ID="54"></m:Hotel>

                 <m:ItemsRequest>

                       <m:ItemRequest Type="Room" QuantityRequired="1"

                                                   NumberOfAdults="1"

                                                   NumberOfChildren="0"

                                                   Code="117;54;45877">

                              <m:Guests>

                                     <m:Guest IsChild="false">

                                            <m:FirstName>Rodel</m:FirstName>

                                            <m:LastName>Surat</m:LastName>

                                     </m:Guest>

                              </m:Guests>

                       </m:ItemRequest>

                 </m:ItemsRequest>

                 <m:GuestRequest SmokingPreference="NoPreference" BabyCot="false" LateCheckIn="false"></m:GuestRequest>

                 <m:MainGuest IsMainGuest="true" IsChild="false">

                       <m:FirstName>Rodel</m:FirstName>

                       <m:LastName>Surat</m:LastName>

                       <m:Address>

                              <m:Country ID="3"/>

                              <m:Telephone>123456789</m:Telephone>

                       </m:Address>

                       <m:EmailAddress>[email protected]</m:EmailAddress>

                 </m:MainGuest>

                 <m:PaymentDetail ItineraryTotalAmount="520">

                       <m:CreditCardDetail SerialCode="XXX" CardType="VSA" CardNumber=" XXXXXXXXXXXXXXXX" ExpiryDate="0811">

                              <m:CardHolderName>Rodel Surat</m:CardHolderName>

                              <m:Address>

                                     <m:AddressLine>680 George St</m:AddressLine>

                    <m:City Name="Sydney" />

                                     <m:State>NSW</m:State>

                    <m:Country ID="3" />

                    <m:Postcode>2000</m:Postcode>

                              </m:Address>

                       </m:CreditCardDetail>

                 </m:PaymentDetail>

  </m:HotelBookingRequest>

   </SOAP-ENV:Body>

然后将其作为肥皂请求发送。我对 PHP 中的 SOAP 完全陌生

how will i create an array for such a structure

Sorry but I know how to send a soap request [php.net].. I just want to confirm the array structure that I need to result in such a request with custom attributes

<?xml version="1.0" encoding="utf-8"?>

   <SOAP-ENV:Header>

          <m:AuthenticationInfo xmlns:m="https://xml.hotelclub.net/xmlws/services/v2/">

                 <m:AffiliateID>xxx</m:AffiliateID>

                 <m:Password>xxx</m:Password>

                 <m:ClientIP>xxx</m:ClientIP>

          </m:AuthenticationInfo>

   </SOAP-ENV:Header>

   <SOAP-ENV:Body>

          <m:HotelBookingRequest xmlns:m="https://xml.hotelclub.net/xmlws/services/v2/" Version="2" LanguageCode="EN" CurrencyCode="AUD" AffiliateUniqueID="Rodel9">

                 <m:StayDateRange CheckIn="2011-03-28" CheckOut="2011-03-29" ArrivalTime="12"/>

                 <m:Hotel ID="54"></m:Hotel>

                 <m:ItemsRequest>

                       <m:ItemRequest Type="Room" QuantityRequired="1"

                                                   NumberOfAdults="1"

                                                   NumberOfChildren="0"

                                                   Code="117;54;45877">

                              <m:Guests>

                                     <m:Guest IsChild="false">

                                            <m:FirstName>Rodel</m:FirstName>

                                            <m:LastName>Surat</m:LastName>

                                     </m:Guest>

                              </m:Guests>

                       </m:ItemRequest>

                 </m:ItemsRequest>

                 <m:GuestRequest SmokingPreference="NoPreference" BabyCot="false" LateCheckIn="false"></m:GuestRequest>

                 <m:MainGuest IsMainGuest="true" IsChild="false">

                       <m:FirstName>Rodel</m:FirstName>

                       <m:LastName>Surat</m:LastName>

                       <m:Address>

                              <m:Country ID="3"/>

                              <m:Telephone>123456789</m:Telephone>

                       </m:Address>

                       <m:EmailAddress>[email protected]</m:EmailAddress>

                 </m:MainGuest>

                 <m:PaymentDetail ItineraryTotalAmount="520">

                       <m:CreditCardDetail SerialCode="XXX" CardType="VSA" CardNumber=" XXXXXXXXXXXXXXXX" ExpiryDate="0811">

                              <m:CardHolderName>Rodel Surat</m:CardHolderName>

                              <m:Address>

                                     <m:AddressLine>680 George St</m:AddressLine>

                    <m:City Name="Sydney" />

                                     <m:State>NSW</m:State>

                    <m:Country ID="3" />

                    <m:Postcode>2000</m:Postcode>

                              </m:Address>

                       </m:CreditCardDetail>

                 </m:PaymentDetail>

  </m:HotelBookingRequest>

   </SOAP-ENV:Body>

and then send it as a soap request . i am absolutely new to SOAP in PHP

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

短叹 2024-11-16 00:08:28

这是我整理的一个简单的 wcf 服务测试,

/* Default location of WSDL Service (if used) */
define("DEFAULT_WSDL", "http://yourserver.com/Yoursvc.svc?wsdl");

/* Misc WSDL settings */
define("WSDL_SOAP_VERSION", SOAP_1_1);
define("WSDL_EXCEPTIONS", true);
define("WSDL_TRACE", 1);


/** Methods below **/
function testWcf() {

    try {
        $wsdloptions = array(
            'soap_version' => constant('WSDL_SOAP_VERSION'),
            'exceptions' => constant('WSDL_EXCEPTIONS'),
            'trace' => constant('WSDL_TRACE')
        );

        $client = new SoapClient(constant('DEFAULT_WSDL'), $wsdloptions);

        pr($client->__getFunctions());
        pr($client->__getTypes());
    } catch (Exception $exc) {
        echo $exc->getTraceAsString();
    }
}

function pr($array) {
    echo "<xmp>";
    print_r($array);
    echo "</xmp>";
}

希望它能帮助您前进。

Here is a simple wcf service test i've put together

/* Default location of WSDL Service (if used) */
define("DEFAULT_WSDL", "http://yourserver.com/Yoursvc.svc?wsdl");

/* Misc WSDL settings */
define("WSDL_SOAP_VERSION", SOAP_1_1);
define("WSDL_EXCEPTIONS", true);
define("WSDL_TRACE", 1);


/** Methods below **/
function testWcf() {

    try {
        $wsdloptions = array(
            'soap_version' => constant('WSDL_SOAP_VERSION'),
            'exceptions' => constant('WSDL_EXCEPTIONS'),
            'trace' => constant('WSDL_TRACE')
        );

        $client = new SoapClient(constant('DEFAULT_WSDL'), $wsdloptions);

        pr($client->__getFunctions());
        pr($client->__getTypes());
    } catch (Exception $exc) {
        echo $exc->getTraceAsString();
    }
}

function pr($array) {
    echo "<xmp>";
    print_r($array);
    echo "</xmp>";
}

Hope it will help you on your way forward.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文