Send raw request to SOAP server

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Send raw request to SOAP server

jpadron
Hi, I'm traying to send a raw request to a SOAP server. The only way I found to do this is creating a redundant Zend_Soap_Client_Common in order to invoke _dorequest. Is really that necessary? Is there any other way to send raw xml to the server?

Here's the code:

    $client = new Zend_Soap_Client('http://212.170.239.71/appservices/ws/FrontendService?wsdl',
                        array(
                                'soap_version'=>SOAP_1_1
                                ,'encoding' => 'UTF-8'
                                ,'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_DEFLATE
                                ,'location'=>'http://212.170.239.71/appservices/ws/FrontendService'
                               
                        )
                );
   
    $location = 'http://212.170.239.71/appservices/ws/FrontendService';
   
    $request = '<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
        <soapenv:Body> 
                <hb:getHotelValuedAvail xmlns:hb="http://axis.frontend.hydra.hotelbeds.com" xsi:type="xsd:anyType"> 
<HotelValuedAvailRQ echoToken="DummyEchoToken" sessionId="DummySessionId" xmlns="http://www.hotelbeds.com/schemas/2005/06/messages" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.hotelbeds.com/schemas/2005/06/messages HotelValuedAvailRQ.xsd">
        <Language>CAS</Language>
        <Credentials>
                <User>XXXXX</User>
                <Password>XXXXX</Password>
        </Credentials>
        <PaginationData pageNumber="1"/>
<ExtraParamList>
       <ExtendedData type="EXT_ORDER">
            <Name>ORDER_CONTRACT_PRICE</Name>
             <Value>ASC</Value>
        </ExtendedData>
</ExtraParamList>
        <CheckInDate date="20110809"/>
        <CheckOutDate date="20110811"/>
        <Destination code="LPA" type="SIMPLE">
            <ZoneList>
                 <Zone code="20" type="SIMPLE"/>
            </ZoneList>
    </Destination>
        <OccupancyList>
                <HotelOccupancy>
                        <RoomCount>1</RoomCount>
                        <Occupancy>
                                <AdultCount>2</AdultCount>
                                <ChildCount>0</ChildCount>
                        </Occupancy>
                </HotelOccupancy>
        </OccupancyList>
</HotelValuedAvailRQ>
                </hb:getHotelValuedAvail> 
        </soapenv:Body> 
</soapenv:Envelope>';
               
        $clientCommon = new Zend_Soap_Client_Common($client, 'http://212.170.239.71/appservices/ws/FrontendService?wsdl',
                        array(
                                'soap_version'=>SOAP_1_1
                                ,'encoding' => 'UTF-8'
                                ,'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_DEFLATE
                                ,'location'=>'http://212.170.239.71/appservices/ws/FrontendService'
                               
                        ));
    $response =  $client->_doRequest($clientCommon, $request, $location, 'getHotelValuedAvail', SOAP_1_1);
   
         // With these two lines I've managed the call using "native" SoapClient
         //$client = new SoapClient("http://212.170.239.71/appservices/ws/FrontendService?wsdl", array('trace'=>1));
        //$response =  $client->__doRequest($request, $location, 'getHotelValuedAvail', SOAP_1_1);

Thanks in advance.
Jorge