1

I hope this question won't be marked as duplicate as I read many related questions and answers on the site: although I tried most of the suggestions out there I still couldn't resolve my problem.

My codebase : (I left comments on purpose to give an idea of what I have been trying so far, based on my browsing)

      try { 
    
    $opts = array(
        //~mrossw 'http' => array(
            //~mrossw 'user_agent' => 'PHPSoapClient'
        //~mrossw ),
        //~mrossw 'socket' => array('bindto' => '158.69.189.149')
        'socket' => array('bindto' => '127.0.0.1')
        //~mrossw ,
        //~mrossw 'ssl' => [
          //~mrossw 'verify_peer'       => true,
          //~mrossw 'verify_peer_name'  => true,
          //~mrossw 'allow_self_signed' => true
    //~mrossw ]

    );
    $context = stream_context_create($opts);    
    
    $client = new SoapClient("https://ws_provider_hostname:xxxx/foo/bar/blah/Operaciones/OpFooBarBlahReqABCS?wsdl",
    //~mrossw $client = new SoapClient($doc_root.'OpCotizadorVehiculoExtReqABCS.xml',
        array(
          'location' => "https://ws_provider_hostname:xxxx/foo/bar/blah/Operaciones/OpFooBarBlahReqABCS?wsdl",
          'uri' => "https://ws_provider_hostname:xxxx/foo/bar/blah/Operaciones",
          // Stuff for development.
          'trace' => 1,
          'exceptions' => true,
          'keep_alive' => true,
          'connection_timeout' => 120,
          'stream_context' => $context,
          'cache_wsdl' => WSDL_CACHE_NONE,
          'compression'   => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | SOAP_COMPRESSION_DEFLATE,
          //~mrossw 'local_cert' => $certRequest_param['sslcertfile'],
          //~mrossw 'login'=>'username',
          //~mrossw 'password' => 'password'
        )
    );
  } catch (Exception $e) {
              echo \"<h2>Exception Error!</h2>\";
              echo $e->getMessage();
              // print_r($e);
  }   
  • The WS provider has an dev environment on port xxxx and a prod env on port yyyy. Hostname and path request are the same.

  • SoapClient instanciation and operation call work perfect in dev env.

  • When i change the port to fetch against prod env I get the following error:

    SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://ws_provider_hostname:xxxx/foo/bar/blah/Operaciones/OpFooBarBlahReqABCS?wsdl' : failed to load external entity "https://ws_provider_hostname:xxxx/foo/bar/blah/Operaciones/OpFooBarBlahReqABCS?wsdl"

  • Provider says my public web server's IP is correctly set as allowed in their firewall. It looks right because when I tried to run the code from a different server with different IP and it fails with the same error in both dev and prod env.

  • When I run that code from a server inside a private network, it works in both environment ! I don't know much about security, but this sounds to me like a security breach. I mention it here though, in case it can give a clue. I guess this is because this server has a private ip and the provider's firewall don't filter it.

  • When I go to https://ws_provider_hostname:xxxx/foo/bar/blah/Operaciones/OpFooBarBlahReqABCS?wsdl in my PC browser i get the correct wsdl's xml.

Do you have an idea of what can prevent the code to work form my public web server ?

Or maybe what else can I check ?

For example I couldn't find a way to check the ws server's http response code from outside my browser. I could neither get a request form to return the wsdl xml, but that should be another question maybe.

Also let me know if i can provide any other relevant test or data.

mrossw
  • 45
  • 5

0 Answers0