S
S
Screamy Di2016-04-07 16:30:50
PHP
Screamy Di, 2016-04-07 16:30:50

SOAP HTTP Bad Request. Why aren't the service functions called?

A task was received to connect the tracking of postal items to the site.

Given: A remote web service with four nodes. HTML, XML, JSON and SOAP.
Chose SOAP, for a number of reasons, mainly because of the support in PHP. And away we go...

Here is the WSDL delivery.aero/tracking/soap.svc?singleWsdl

It would seem that everything is standard, we send the necessary requests there, we get answers back. But...

// Получаю объект SOAP с заданными в wsdl параметрами (wsdl лежит на удаленном сервере)
$client = new SoapClient("some.wsdl", array("trace" => true, "soap_version" => SOAP_1_2));

// проверяю наличие методов
var_dump($client->__getFunctions());

/* В дампе лежит следующее
array(4) {
  [0]=>
  string(74) "GetPublicTrackingResponse GetPublicTracking(GetPublicTracking $parameters)"
  [1]=>
  string(101) "GetPublicTrackingLocalizedResponse GetPublicTrackingLocalized(GetPublicTrackingLocalized $parameters)"
  [2]=>
  string(56) "GetTrackingResponse GetTracking(GetTracking $parameters)"
  [3]=>
  string(83) "GetTrackingLocalizedResponse GetTrackingLocalized(GetTrackingLocalized $parameters)"
}
*/

// По wsdl смотрю что GetPublicTracking ждет на вход две строки
$xml = $client->__soapCall('GetPublicTracking', array('123', '123'))


And immediately I get an error:
Uncaught SoapFault exception: [s:Sender] The SOAP action specified on the message, '', does not match the HTTP SOAP Action, ' https://....some...url '

It doesn't matter , think! Doesn't see action , we'll show it now.

// Запиливаю заголовок с путем до нужного action-a и начинаю смутно подозревать что здесь что-то не то
$actionHeader = new SoapHeader('http://www.w3.org/2005/08/addressing', 'Action', 'https://path-to-action-');
$client2->__setSoapHeaders($actionHeader);


I get this beauty:
Uncaught SoapFault exception: [s:Sender] The message with To '' cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver's EndpointAddresses agree.

This is where my modest knowledge of SOAP ends and I go to smoke Stackoverflow. In Russian on a subject it is not enough. There are many overseas, but half recommend cutting something on the service, but I don’t have access to it. The second half recommends sticking another heading.

No problem, let's stick
// Естественно массивом в нем теперь лежит два заголовка вот последний
$actionHeader[] = new SoapHeader('http://www.w3.org/2005/08/addressing','To','https:service-address/soap.svc');
$client->__setSoapHeaders($actionHeader);


And the result:
Uncaught SoapFault exception: [HTTP] Bad Request in C:\path-to-local-server

Then a lot of dancing with a tambourine, but to no avail. They say the error may be in the syntax, but I don't see where it is. I tried to change the call method to $client-> __call(), I also tried to call directly via $client->GetPublicTracking('123','123'); No difference. Tried other methods. The same story

Can anyone tell me how I can still get the data on request? And get to that damn service

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sasha, 2016-04-07
@Screamie

https://services.soft.aero/mp1/delivery/tracking/T...
the GetPublicTracking method follows the url above, but the url above does not open.
in general, I do not recommend soap for use. json will be more flexible.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question