A
A
Andrey Shved2014-04-22 15:47:20
PHP
Andrey Shved, 2014-04-22 15:47:20

How to fix errors when accessing SOAP server from PHP client?

Good afternoon For the
3rd day I have been struggling with an error when accessing the SOAP server: a
virtual machine physically located in a Microsoft data center in Northern Europe, with the Windows Server 2008 R2 Datacenter SP1 64bit operating system. A Windows service developed by us is installed on the machine, which accepts requests on ports 19321 and 19322 using the http and https protocols, respectively. The service is developed on .NET Framework 4. Microsoft, by default, supports:
- {Soap12 ( www.w3.org/2003/05/soap-envelope) Addressing10 ( http://www.w3.org/2005/08/ addressing)} - SOAP version 1.2, WS-Addressing version 1.0.
The default settings are used.
For testing, a Web service is placed that has methods:
- GetString() without parameters returns a Cyrillic string
- Duplicate(String) takes one string parameter, returns a string containing the argument twice.
The service is available:
- via the protocol http a2services.cloudapp.net:19321/SimpleService The
WSDL description of the service is obtained by the following request:
a2services.cloudapp.net:19321/SimpleService?wsdl
I create a PHP client:

$client = new SoapClient("http://a2services.cloudapp.net:19321/SimpleService?wsdl", array(
   "trace"      => 1,
   "soap_version"   => SOAP_1_2,
   "exceptions" => true
));
print($client-> __call('GetString',array()));

When executed, it throws an error:
"Fatal error: Uncaught SoapFault exception: [s:Sender] The SOAP action specified on the message, '', does not match the HTTP SOAP Action, ' tempuri.org/ISimpleService/GetString '. in .. .."
Please suggest a solution to the problem.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yuri Denisov, 2014-04-23
@shvedan1

ini_set('soap.wsdl_cache_enabled', '0');
ini_set('soap.wsdl_cache_ttl', '0');
try {
$client = new SoapClient(" a2services.cloudapp.net:19321/SimpleService?wsdl ", array(
"trace" => 1,
'soap_version' => SOAP_1_2,
"exceptions" => true
));
$actionHeader[] = new SoapHeader(" www.w3.org/2005/08/addressing ", 'To', ' a2services.cloudapp.net:19321/SimpleService ');
$actionHeader[] = new SoapHeader(" www.w3.org/2005/08/addressing ", "Action", " tempuri.
$params = array();
$test = $client->GetString($params);
print $test->GetStringResult;
}
catch (SoapFault $exception)
{
echo $exception->getMessage();
}

Y
Yuri Denisov, 2014-04-22
@denissov

here stackoverflow.com/questions/8934365/php-fatal-erro... not a similar issue? Try to send headers

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question