www.webdeveloper.com
Results 1 to 5 of 5

Thread: SOAP server return particular XML

  1. #1
    Join Date
    Sep 2013
    Posts
    3

    SOAP server return particular XML

    Hi Fellows, I am new to SOAP or any webservices technology, but i have a problem to connect an online travel agent (OTA) website to Channel Manager called Siteminder.



    And they provide some documentation for developer to connect them here : https://siteminder.atlassian.net/wik...Retrieve+Rooms

    But unfortunately i don't even understand what is this, how can i create a SOAP server in PHP which able to produce particular xml like this ( precisely as written in this docs ):

    <OTA_HotelAvailRQ xmlns="http://www.opentravel.org/OTA/2003/05" Version="1.0" TimeStamp="2005-08-01T09:30:47+02:00" EchoToken="fb57388d" AvailRatesOnly="true">
    <AvailRequestSegments>
    <AvailRequestSegment AvailReqType="Room">
    <HotelSearchCriteria>
    <Criterion>
    <HotelRef HotelCode="HOTEL1"/>
    </Criterion>
    </HotelSearchCriteria>
    </AvailRequestSegment>
    </AvailRequestSegments>
    </OTA_HotelAvailRQ>


    and this xml as the response of previous xml (if it submitted)

    <OTA_HotelAvailRS xmlns="http://www.opentravel.org/OTA/2003/05" Version="1.0" TimeStamp="2005-08-01T09:30:47+02:00" EchoToken="abc123">
    <Success/>
    <RoomStays>
    <RoomStay>
    <RoomTypes>
    <RoomType RoomTypeCode="SGL">
    <RoomDescription Name="Single Room"/>
    </RoomType>
    </RoomTypes>
    </RoomStay>
    <RoomStay>
    <RoomTypes>
    <RoomType RoomTypeCode="DBX">
    <RoomDescription Name="Deluxe Double Room"/>
    </RoomType>
    </RoomTypes>
    </RoomStay>
    <RoomStay>
    <RoomTypes>
    <RoomType RoomTypeCode="DBL">
    <RoomDescription Name="Standard Double Room"/>
    </RoomType>
    </RoomTypes>
    </RoomStay>
    </RoomStays>
    </OTA_HotelAvailRS>

    please kindly help me.., and many thanks in advance...

  2. #2
    Join Date
    Apr 2012
    Posts
    38
    It seems like you expect other people to create these PHP files for you but I don't think people will. (At least I won't)
    Since you don't seem to know anything about SOAP I uploaded a zip file with some example files.
    I believe this examples are public somewhere but I couldn't find a link that fast.
    You can find this zip file here: http://www.sendspace.com/file/hspjj4

    I haven't worked with SOAP for about two years but if you have some code and you are stuck I'm willing to have a look and help you out if I can.

  3. #3
    Join Date
    Sep 2013
    Posts
    3
    Quote Originally Posted by GettingSmart View Post
    It seems like you expect other people to create these PHP files for you but I don't think people will. (At least I won't)
    Since you don't seem to know anything about SOAP I uploaded a zip file with some example files.
    I believe this examples are public somewhere but I couldn't find a link that fast.
    You can find this zip file here: http://www.sendspace.com/file/hspjj4

    I haven't worked with SOAP for about two years but if you have some code and you are stuck I'm willing to have a look and help you out if I can.
    i very appreciate it my good friend, it's very helpful. And now i have an answer for my problem, i am using nuSOAP library right now, and it's very helpful. I write code below, and my problems are partially solve

    PHP Code:
    <?php
    require_once('lib/nusoap.php'); 
     
    $server = new nusoap_server;
     
    $server->configureWSDL('server','http://localhost/myweb');
     
    $server->wsdl->schemaTargetNamespace 'http://localhost/myweb';

    $server->wsdl->addComplexType(
        
    'AvailRequestSegments',
        
    'complexType',
        
    'struct',
        
    'all',
        
    '',
        array(
            
    'AvailRequestSegment' => array('name' => 'AvailRequestSegment''type' => 'tns:AvailRequestSegment')
               )
    );

    $server->wsdl->addComplexType(
        
    'AvailRequestSegment',
        
    'complexType',
        
    'struct',
        
    'all',
        
    '',
        array(
            
    'HotelSearchCriteria' => array('name' => 'HotelSearchCriteria''type' => 'tns:HotelSearchCriteria')
               )
    );

    $server->wsdl->addComplexType(
        
    'HotelSearchCriteria',
        
    'complexType',
        
    'struct',
        
    'all',
        
    '',
        array(
            
    'Criterion' => array('name' => 'Criterion''type' => 'tns:Criterion')
               )
    );

    $server->wsdl->addComplexType(
        
    'Criterion',
        
    'complexType',
        
    'struct',
        
    'all',
        
    '',
        array(
            
    'HotelRef' => array('name' => 'HotelRef''type' => 'tns:HotelRef')
               )
    );

    $server->wsdl->addComplexType(
        
    'HotelRef',
        
    'complexType',
        
    'struct',
        
    'all',
        
    '',
        array(
            
    'HotelCode' => array('name' => 'HotelCode''type' => 'xsd:string')
               )
    );

    $server->register('OTA_HotelAvailRQ',
                array(
    'AvailRequestSegments'=>'tns:AvailRequestSegments'),
                array(
    'result' => 'xsd:string'),
                
    'http://localhost/myweb',
                
    'http://localhost/myweb#SayHello');

    //  <AvailRequestSegments>
    //    <AvailRequestSegment AvailReqType="Room">
    //      <HotelSearchCriteria>
    //        <Criterion>
    //          <HotelRef HotelCode="HOTEL1"/>


    function OTA_HotelAvailRQ($param)
    {
        return 
    "success";
    }

    $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA '';
     
    $server->service($HTTP_RAW_POST_DATA);
    ?>
    and the rest of my problem is how to make this AvailReqType="Room" attribute inside the < AvailRequestSegment> like show below
    Code:
    <AvailRequestSegment AvailReqType="Room">
    thx a lot for helping me..

  4. #4
    Join Date
    Apr 2012
    Posts
    38
    I have to say I'm not familiar with the addComplexType function within SOAP since I've just done some basic work with it.
    Maybe too easy but can't you create AvailReqType in the same way you've created HotelSearchCriteria for example? (Or HotelRef since that's more like the format you want)

  5. #5
    Join Date
    Sep 2013
    Posts
    3
    Quote Originally Posted by GettingSmart View Post
    I have to say I'm not familiar with the addComplexType function within SOAP since I've just done some basic work with it.
    Maybe too easy but can't you create AvailReqType in the same way you've created HotelSearchCriteria for example? (Or HotelRef since that's more like the format you want)
    actually i am not so sure bout that, i am just trying to make it as close as possible to the sample shown in their docs.

Thread Information

Users Browsing this Thread

There are currently 3 users browsing this thread. (0 members and 3 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles