Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SoapClient throws Wrong version

When i sending below request, i am getting 'Wrong Version" exception.

<OTA_HotelGetMsgRQ xmlns="http://www.opentravel.org/OTA/2003/05"
    TimeStamp="2001-12-17T09:30:47.0Z" Version="4"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Messages>
        <Message HotelCode="123" HotelName="Test Hotel" ChainCode="321"
            ReasonForRequest="Reservation Retrieval" RequestCode="Optional"
            ChainName="Test Chain" MessageType="All" StartSeqNmbr="1"
            EndSeqNmbr="10" />
    </Messages>
</OTA_HotelGetMsgRQ>

above request is converted into zend code

$client = new zend_soap_client(null,
        array(
                'location' => 'http://url...',
                'Uri' =>"http://www.opentravel.org/OTA/2003/05"
        )
);

$request = array(
        array('Messages'=> 
                array ('Message' => 
                        array (
                                'HotelCode' => '123',
                                'HotelName' => 'Test Hotel',
                                'ChainCode' => '321',
                                'ReasonForRequest' => 'Reservation Retrieval',
                                'RequestCode' => 'Optional',
                                'ChainName' => 'Test Chain',
                                'MessageType' => 'All',
                                'StartSeqNmbr' => '1',
                                'EndSeqNmbr' => '10'
                        )
                )
        )
);

$result = $client->OTA_HotelGetMsgRQ ($request);

Above line throws exception 'Wrong Version'. Anyone help me how to solve this

like image 218
sivansethu Avatar asked Jun 14 '10 09:06

sivansethu


2 Answers

sounds like you are using the wrong version ;) - have you tried to add 'soap_version'=>'1.2' (or 1.1, depending on which version is needed) to the options of your soap_client?

like image 88
oezi Avatar answered Oct 22 '22 16:10

oezi


$autodiscover = new Zend_Soap_AutoDiscover();
$autodiscover->setClass('Core_Soap_Test');
$autodiscover->setUri( sprintf($this->_WSDL_URI,0) );
$autodiscover->handle();

$this->_WSDL_URI = '"http://WWW.EXAMPLE.COM/soap/index/wsdl/%s/?wsdl'

try the code above. this helped me

like image 22
Robert Avatar answered Oct 22 '22 14:10

Robert