2

I am working on a php SoapClient. The Soap server is a .NET server. Everything works fine when the client calls a http address and when the answer come from the server that the client calls.

The issue I have is that the client must call a https address and the server uses a load balancing system, leading to get an answer from another server (client calls serverX and get an answer sometimes from serverY, sometimes from serverZ, etc.).

Here is the php code that I use (works fine when no https and no load balancing, doesn't work with https and load balancing):

$client = new SoapClient('http://www.serverA.com/serviceB.svc?wsdl');
$immat = 'yadiyadiyada';
$params = array('immat' => $immat);
$result = $client->__soapCall('setImmat', array($params));
$id_found = $result->setImmatResult;

Any idea of what I should do? Any tips would be greatly appreciated!

Thanks

Urda
  • 5,460
  • 5
  • 34
  • 47
p1erstef
  • 384
  • 4
  • 11
  • That's a bug in the webservice implementation. You can't do much except from not using `SoapClient` and implementing the communication using lower level libraries (HTTP + XML) – hek2mgl Nov 28 '13 at 17:54
  • Ok @hek2mgl thank you for your answer! I tried with HTTP + XML (with cURL). Once again, it works fine when no https and no load balancing, but doesn't work with https and load balancing. I guess it's because the http response doesn't come from the same server than the http request... By any chance, would you have an idea on how to do this!? Thanks! – p1erstef Dec 03 '13 at 17:10
  • I already said it, you can't do much. The webservice vendor needs to fix his application. You can try to download WSDLs from every server and put them into the soap_cache_folder, prepare them to have the proper urls, and then set cache lifetime to -1 – hek2mgl Dec 03 '13 at 17:17

1 Answers1

0

I at last found a work around.

Instead of instantiating the php SoapClient with the XML file provided by the server, I made a copy of it on the client side and I modified it a little bit. I only changed the "schemaLocation": server side, the value was something like "https://www.serverY.com/serviceB.svc?xsd=xsd0", I replaced it by "https://www.serverX.com/serviceB.svc?xsd=xsd0". Now I instantiate the php SoapClient with this new file:

$client = new SoapClient('/local_path/wsdl.xml');

and it works!

p1erstef
  • 384
  • 4
  • 11