I have some issues when trying to perform a soap request to a salesforce api from a php code deployed on an apache 2.4 server (Centos 7).

My soap request works fine on localhost running with the php built-in server (php -S Its also works fine when I launch the built-in php server on my remote Centos host (php -S -c path-to-my-ini/php.ini). But doesn't works on apache. The problem is that I don't get any error response, it just returns null with status 200 so I have no way to debug deeply.

Here is my Soap client config:

public function getClient(){

        $wsdl = PUBLIC_PATH.'/wsdl-metadata.xml'; // le fichier wsdl
        // creation de l'objet SOAP avec proxy et trace à TRUE       
        $service = new SoapClient($wsdl, array( 'proxy_host' => "xxx.proxy.xxx.fr", 
                                                'proxy_port' => 3130,
                                                'trace' => 1) );
        return $service;

And here is my controller function which performs the soap request:

 public function editMock( Request $request, Response $response, $arg){
        $token = base64_decode($request->getQueryParams()['token']);
        $explodeToken = explode ('!', $token);
        $sandboxUrl = $this->getSandboxUrl($arg['sandbox']);
        $serviceName = $_POST['service'];
        $valueUseMock = $_POST['isMock'];

        $soapService = new SoapService($token);
        $client = $soapService->getClient();
        $soapService->updateServiceMock($serviceName, $valueUseMock);
        $xmlReq = $soapService->getXml();

        $location = "https://".$sandboxUrl."/services/Soap/m/44.0/" . $explodeToken[0];

        // appel soap avec la requete créée 
        return $client->__doRequest($xmlReq, $location, null, 44, 0);

Note that I already activate soap in my php_ini

; SOAP - Extension permettant les echanges clients/serveurs SOAP.
extension = soap.so

Am I doing something wrong?

1 Answers

Géraud Willing B-S On Best Solutions

We finally figure it out. The rease why it works with php built-in server and doesn't work on apache was that we disable tls and ssl in our composer.json

"config": {
        "process-timeout": 0,
        "sort-packages": true,
        "secure-http" : true,
        "disable-tls" : false

And since the php built-in server use composer.json, it bypass the tls/ssl verifications. So we just install the salesforce certificate on our apache server and set soap to use it and It works now.

Thanks all for your replies!