Answer the question
In order to leave comments, you need to log in
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'))
// Запиливаю заголовок с путем до нужного action-a и начинаю смутно подозревать что здесь что-то не то
$actionHeader = new SoapHeader('http://www.w3.org/2005/08/addressing', 'Action', 'https://path-to-action-');
$client2->__setSoapHeaders($actionHeader);
// Естественно массивом в нем теперь лежит два заголовка вот последний
$actionHeader[] = new SoapHeader('http://www.w3.org/2005/08/addressing','To','https:service-address/soap.svc');
$client->__setSoapHeaders($actionHeader);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question