简体   繁体   中英

php SoapClient and load balancing server

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

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM