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
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?
$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
I had this problem as well. The problem in my case was that I wasn't passing an expected (and thus required) parameter without throwing back a SoapFault-exception. Maybe it's useful to someone.
Related
Hi guys I am trying to do a SOAP request with php, unfortunately it always returns the Error 'Wrong Version'.
My request looks like this:
<?php
$option=array('trace'=> true, 'cache_wsdl' => WSDL_CACHE_NONE, 'soap_version' => SOAP_1_2, 'exeptions' => true,);
$soapClient=new SoapClient('http://www.SOMEURL.net/SOAPAPI/HEX_XMLIF_1_1_0-0?wsdl',$option);
$soapClient->__setLocation('http://www.SOMEURL.net/SOAPAPI/HEX_XMLIF_1_1_0-0');
try{
$parameters = array(
'Version' => '1.1.0',
'TransactionIdentifier' => 'X4711',
'TimeStamp' => '2013-10-24T16:56:10',
'Target' => 'Test',
'POS' => array (
'Source' => array(
'RequestorID' => array(
'ID' => '709900001',
'ID_Context' => '1234',
'ID_Operator' => 'BJT',
'ID_Token' => '135975505',
'ID_Key' => 'znt'),
'ISOCurrency' => 'EUR',
'ISOCountry' => 'DE'),
),
'CarPark' => array(
'Code' => 'FRA8')
);
$soapClient->CarParkInformation($parameters);
}catch(SoapFault $fault){
echo '<br/><br/> Error Message : <br/>',
$fault->getMessage();
echo '<br/><br/>';
echo 'Request : <br/><xmp>',
$soapClient->__getLastRequest();
echo '</xmp><br/> Response : <br/><xmp>',
$soapClient->__getLastResponse();}
?>
According to the documentation which came with the WSDL file, my request is just fine. The only thing I am missing is a header. The header in the documentation is empty ("")-> No idea how to add an empty header to the request.
I don't think that is the reason for the version error...?
The request which is created looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="de.znt.hexapi">
<SOAP-ENV:Body>
<ns1:GetCarParkInformationRQ>
<ns1:Version>1.1.0</ns1:Version>
<ns1:TransactionIdentifier>X4711</ns1:TransactionIdentifier>
<ns1:TimeStamp>2013-10-24T16:56:10</ns1:TimeStamp>
<ns1:Target>Test</ns1:Target>
<ns1:POS>
<ns1:Source>
<ns1:RequestorID>
<ns1:ID>709900001</ns1:ID>
<ns1:ID_Context>1234</ns1:ID_Context>
<ns1:ID_Operator>BJT</ns1:ID_Operator>
<ns1:ID_Token>135975505</ns1:ID_Token>
<ns1:ID_Key>znt</ns1:ID_Key>
</ns1:RequestorID>
<ns1:ISOCurrency>EUR</ns1:ISOCurrency>
<ns1:ISOCountry>DE</ns1:ISOCountry>
</ns1:Source>
</ns1:POS>
<ns1:CarPark>
<ns1:Code>FRA8</ns1:Code>
</ns1:CarPark>
</ns1:GetCarParkInformationRQ>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
I have no idea why I am getting "Wrong Version" error, I tried with 1.1 and 1.2 and I have been testing around for a few days.
Does anyone have a clue what to do?
Problem FIXED - I have been using the wrong endpoint.
I'm trying to use nuSOAP to send a array with some data that will be use it on DB, but every time i get this "wsdl error: XML error parsing WSDL issue ... not well-formed (invalid token)" on my client.php
Here is my a little of my code on the server :
$server->register('cadastrar',
array('dados'=>'tns:cadastro'),
array('return'=>'xsd:string'),
$namespace,
$namespace.'#cadastrar',
'rpc',
'encoded',
''
);
$server->wsdl->addComplexType('cadastrar', 'complexType', 'struct', 'all','',
array(
'empresa' =>array ('name'=>'empresa','type'=>'xsd:string')
,'nome' =>array ('name'=>'nome','type'=>'xsd:string')
,'email' =>array ('name'=>'email','type'=>'xsd:string')
,'ddd' =>array ('name'=>'ddd','type'=>'xsd:string')
,'tel' =>array ('name'=>'tel','type'=>'xsd:string')
,'msg' =>array ('name'=>'msg','type'=>'xsd:string')
)
);
function cadastrar($dados){
//$objCliente = new Cliente();
//if($objCliente)
//$id = $objCliente->cadastroWebService($dados);
return $dados['empresa'];
}
and this is my code on the client :
$dados = array(
'empresa' => $_POST['empresa'],
'nome' => $_POST['nome'],
'email' => $_POST['email'],
'ddd' => $_POST['ddd'],
'tel' => $_POST['tel'],
'msg' => $_POST['msg']
);
//Chama o metodo call do SOAP
$result = $client->call('cadastrar', array('cadastro'=> $dados));
Anybody got any idea why isn't working ?
Thanks
I found what i was doing wrong when i was iniciating the client i was missing some arguments...
$client = new nusoap_client('http://www.domain.com/server.php?wsdl&debug=1', 'wsdl');
I just put the wsdl&debug=1', 'wsdl' and it work it
Hi please tell me how to get reposnse
I have a wsdl and i would like to call awebservice through it
Although using soapUI i can get the reposnse but not throgh php
I am also giving the xml request that need to be made
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header /><soapenv:Body>
<q2:OneOffDeductionRequestMsg
xmlns:q0="http://www.huawei.com/bme/accountmgr"
xmlns:q1="http://www.huaweiommon"
xmlns:q2="http://www.accountmgrmsg">
<RequestHeader>
<q1:CommandId>OneOffDeduction</q1:CommandId>
<q1:Version>1</q1:Version>
<q1:TransactionId/>
<q1:SequenceId>1</q1:SequenceId>
<q1:RequestType>Event</q1:RequestType>
<q1:SessionEntity>
<q1:Name>NET</q1:Name>
<q1:Password>084912FA9733C4A0115D</q1:Password>
<q1:RemoteAddress>10.176.122.2</q1:RemoteAddress>
</q1:SessionEntity>
<q1:SerialNo>192741328589162212</q1:SerialNo>
</RequestHeader>
<OneOffDeductionRequest>
<q0:SubscriberNo>XXXXXX73</q0:SubscriberNo>
<q0:OperationID>4059999</q0:OperationID>
<q0:AdditionalInfo>VNET</q0:AdditionalInfo>
<q0:DeductAmt>100</q0:DeductAmt>
<q0:MinMeasureId>101</q0:MinMeasureId>
</OneOffDeductionRequest>
</q2:OneOffDeductionRequestMsg>
</soapenv:Body></soapenv:Envelope>
Here is the PHP code that utilizes it:
<?php
$RequestHeader = array(
'CommandId' => 'OneOffDeduction',
'Version' => '1',
'TransactionId' => '34234',
'SequenceId' => '1',
'RequestType' => 'EVENT',
'SerialNo' => '1527013286284589162212');
$SessionEntity =array(
'Name' => 'V',
'Password' => 'v',
'RemoteAddress' =>'10.0.0.0');
$wsdl ="http://eAccountMgrService?wsdl";
$client = new SoapClient($wsdl);
$param =array('SubscriberNo'=>'54321',
'OperationID' =>'4059999',
'AdditionalInfo'=>'VAS2NET',
'DeductAmt'=>'10',
'MinMeasurId'=>'101');
var_dump($client);
$Result = $client->__call('OneoffDeduction',array(
'CommandId' => 'OneOffDeduction',
'Version' => '1',
'TransactionId' => '34234',
'SequenceId' => '1',
'RequestType' => 'ET',
'SerialNo' => '1527',
'sessionEntity' =>array(
'Name' => 'V',
'Password' => 'v',
'RemoteAddress' =>'10.0.0.0')));
var_dump($Result);
echo $client->__getLastRequest();
$Response = $client->__call('OneoffDeduction',array('SubscriberNo'=>'54321',
'OperationID' =>'4059999',
' AdditionalInfo'=>'VAET',
'DeductAmt'=>'10',
'MinMeasurId'=>'101'));
echo $client->__getLastRequest();
?>
Until your code it DRY and organized, it's not easy / possible to debug the problem.
Since you define variables that you never use, it's likely that you've become confused by which vars are actually being sent to the API - e.g. $params seems never sent in any form.
Recommend you refer to the soapClient docs to ensure that you're passing the correct list.
i am trying to calling .net webservice in php
below is my code.
<?php
$client = new SoapClient("http://test.etech.net/PanelIntegration/PanelIntegration.asmx?wsdl");
<?php
$sh_param = array(
'Username' => 'IntegratorLPI',
'Password' => 'password531');
$headers = new SoapHeader('http://wms.etech.net/', 'UserCredentials', $sh_param);
$client->__setSoapHeaders($headers);
$params = array('CustomerName' => 'Mr Smith','ContactMobileNo' => '01237 376347',
'AddressLine1' => '33 Amblecote Road',
'AddressTown' => 'Cambridgeshire',
'AddressPostCode' => 'NW23 6TR',
'VendorAddressLine1' => '80 Norton Road',
'VendorAddressTown' => 'Hickley ',
'VendorAddressCounty' => 'Cambridgeshire',
'VendorAddressPostCode' => 'NW23 2AQ',
'RegionalOfficeID' => '3',
'ExternalNotes' => 'Case Accepted',
'UPRN' => '',
'InstructionTypeID' => '2',
'PropertyTypeID' => '11',
'PropertyTenure' => '2',
'SurveyorID' => '23',
'RRN' => '0240-9002-0391-3520-0020',
'NewInstruction'=> 'true',
'StatusID' => '1'
);
$result = $client->__soapCall("UpdateInstruction", $params );
print_r( $result);
?>
i have got this error
Fatal error: Uncaught SoapFault exception: [soap:Server] Server was unable to process request. ---> Object reference not set to an instance of an object. in C:\xampp\htdocs\test2.php:33 Stack trace: #0 C:\xampp\htdocs\test2.php(33): SoapClient->__soapCall('UpdateInstructi...', Array) #1 {main} thrown in C:\xampp\htdocs\test2.php on line 33
You probably need to send something like:
$result = $client->__soapCall("UpdateInstruction", array('Instruction' => $params );
Where Instruction is the name of the object that you are passing.
It looks like a NullReferenceException was thrown on the server side. So, it's a matter of the parameters to whatever function is occurring on the server side generating that error.
Regardless of why, per best practices, this is an error in the .NET service. The NullReferenceException should really be replaced with something more specific.
Can you get in touch with whomever wrote the service to get more information to troubleshoot? It's quite possible that you have a parameter misnamed in your $params array, but you're probably going to need some help from the service writer.
I need to generate the following XML with SOAP:
...
<InternationalShippingServiceOption>
<ShippingService>StandardInternational</ShippingService>
<ShippingServiceCost currencyID="USD">39.99</ShippingServiceCost>
<ShippingServicePriority>1</ShippingServicePriority>
<ShipToLocation>CA</ShipToLocation>
</InternationalShippingServiceOption>
...
So I have the following SOAP array in PHP to do this:
$params = array(
'InternationalShippingServiceOption' => array(
'ShippingService'=>'StandardInternational',
'ShippingServiceCost'=>39.99,
'ShippingServicePriority'=>1,
'ShipToLocation'=>'CA',
)
)
$client = new eBaySOAP($session); //eBaySOAP extends SoapClient
$results = $client->AddItem($params);
Everything works great, except I am not generating the currencyID="USD" attribute in the ShippingServiceCost tag in the XML. How do I do this?
You don't need to use SoapVar. This works (for me at least):
$params = array(
'InternationalShippingServiceOption' => array(
'ShippingService'=>'StandardInternational',
'ShippingServiceCost' => array('_' => 39.99, 'currencyID' => 'USD')
'ShippingServicePriority'=>1,
'ShipToLocation'=>'CA',
)
)
I'm using this technique with the PayPal SOAP API.
Why, I am glad you asked. I just solved this today.
$shippingsvccostwithid = new SoapVar(array('currencyID' => $whatever),SOAP_ENC_OBJECT, 'ShippingServiceCost', 'https://your.namespace.here.com/');
$params = array("InternationalShippingServiceOption" => array(
"ShippingService" => "StandardInternational",
"ShippingServiceCost" => $shippingsvccostwithid,
"ShippingServicePriority" => 1,
"ShipToLocation" => "CA"
);
And then continue as normal.
Please let me know if you need any more help.