Unable to connect to WSDL

I was working with older version of OpenSSL(OpenSSL 0.9.8o) and I was forced to use newer OpenSSL 1.0.1e-fips as the result I was unable to connect to WSDL:

Message: SoapClient::SoapClient(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

I need to disable SSL certification check, I tried:

    $client = new SoapClient("https://IP:443/sdk/vimService?wsdl",
        array(
            "trace" => 1,
            "location" => "https://IP:443/sdk/",
            "stream_context" => stream_context_create(
                array(
                    'ssl' => array(
                        'verify_peer'       => false,
                        'allow_self_signed' => true,
                    )
                )
            )
        ) 
    );

`

And it throw:

Message: SoapClient::SoapClient(): Peer certificate CN=localhost.localdom' did not match expected CN=SAME IP AS IN SoapClient()'

Then I added 'peer_name'=> 'localhost.localdom', in stream_context and then it says XML file is empty:

Fatal error: Uncaught SoapFault exception: [Client] looks like we got no XML document

PHP 5.5

Okey, I was able to found issue.

You can avoid this mess using stable PHP 5.5 version

Recently I learned that error: "looks like we got no XML document" is caused because of PHP version - PHP 5.6 in 5.5 working like a charm.

How to fix it in PHP 5.6

1) Remove SSL certificate check in PHP 5.6:

In 5.6 version SSL certification was enabled by default, so if you want to disabled it you must pass context stream:

    "stream_context" => stream_context_create(
        array(
            'ssl' => array(
                'verify_peer'       => false,
                'verify_peer_name'  => false,
            )
        )
    )

2) Deleted ?wsdl and added .wsdl instead (with ?wsdl, it didn't worke for me)

<?php

$client = new SoapClient("https://IP:443/sdk/vimService.wsdl",
    array(
        "trace" => 1,
        "location" => "https://IP:443/sdk/",
        'exceptions' => 1,
        "stream_context" => stream_context_create(
            array(
                'ssl' => array(
                    'verify_peer'       => false,
                    'verify_peer_name'  => false,
                )
            )
        )
    ) 
);


$soapmsg["_this"] = array( "_" => "ServiceInstance", "type" => "ServiceInstance");

$result = $client->RetrieveServiceContent($soapmsg);
$ServiceContent = $result->returnval;

$soapmsg = NULL;
$soapmsg["_this"] = $ServiceContent->sessionManager;
$soapmsg["userName"] = "USERNAME";
$soapmsg["password"] = "PASSWORD";

$result = $client->Login($soapmsg);
$UserSession = $result->returnval;

echo "User, " . $UserSession->userName . ", successfully logged in!\n";

$soapmsg = NULL;
$soapmsg["_this"] = $ServiceContent->sessionManager;
$result = $client->Logout($soapmsg);

Trouble connecting to WSDL, It does not contain the "?WSDL" - that suffix is strictly for discovering the web service. b) The location on disk that the wsdl is located at in the unpacked distribution. As I mentioned, I can access the WSDL through browser, but not through eclipse or through client. When you say intentional blocking and checking of headers, what specific headers they might be looking and blocking the connection and why is this not happening through browser. Would HTTP headers vary between the way it is accessed.

In my case stream_context_create didn't worked. So I download this file here : https://curl.haxx.se/ca/cacert.pem

and placed it in my localhost as : F:\xampp\apache\cert.pem and gave the same path for openssl.cafile=F:\xampp\apache\cert.pem in my phpini

This made the localhost to acquire certificate and things worked great...!! Posting this in case this may help some one going through my situation.

php - Unable to connect to WSDL, forced to use newer OpenSSL 1.0.1e-fips as the result I was unable to connect to WSDL: Message: SoapClient::SoapClient(): SSL operation failed with code 1  I was working with older version of OpenSSL(OpenSSL 0.9.8o) and I was forced to use newer OpenSSL 1.0.1e-fips as the result I was unable to connect to WSDL: Message: SoapClient::SoapClient(): SSL

In my case was needed to add the crypt_method

"stream_context" => stream_context_create(
        array(
            'ssl' => array(
                'verify_peer'       => true,
                'verify_peer_name'  => true,
                'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT
            )
        )
    )

Can get to wsdl with browser but cannot connect with the client (Web , Can get to wsdl with browser but cannot connect with the client. Post by: John Landon , Ranch Hand. Dec 12, 2008 07:33:00. Hi, I have jax-ws web service on mt  Photosmart 7520 Unable to Connect to Web Services ‎01-17-2014 11:51 AM I just got done talking with a colleague who tells me pulling the power plug without touching the power button is more effective for this problem and he has a 7520.

In my case "stream_context" did the magic, i've just added the code :

`"stream_context" => stream_context_create(
   array(
      'ssl' => array(
           'verify_peer'       => false,
           'verify_peer_name'  => false,
      )
   )
)`

Load WSDL from address PC can't connect to?, Here is an interesting question. I am trying to load a web service from a server that my local machine can't connect to but the Remedy server  The WCF Web Service Reference tool is a Visual Studio connected service extension that provides an experience like the Add Service Reference functionality for .NET Core and ASP.NET Core projects. This tool retrieves metadata from a web service in the current solution, on a network location, or from a WSDL file, and generates a .NET Core

'Cannot connect to web service' when trying to Load from WSDL , After copying my XML into the 'Request Message' and clicking 'Load from WSDL', I get a 'Cannot connect to web service' error. It should be  If you can't connect using telnet then that's not using your code, or any .net at all, it is using the basic network connection between your machine and the server. Try putting the url for the web service in your browser and see what happens also.

Web Services client unable to connect, Service Manager generates WSDL files that contain the hostname and TCP port number for the Service Manager server instance receiving the request. The Web​  BL stands for the bottom left (should be a curved left arrow). It doesn't matter if its lit up or not. Press Power button to turn the Printer On. Press BL, BL, BL, BL Buttons, in sequence. Touch Support Menu. Select Reset Menu and Touch OK. Select Semi-Full Reset and Touch OK. Wait for unit to Power Down/Turn Off.

Unable to connect to the remote server, I'm trying to consume a very basic SOAP web service that I created to return "​hello world" message a works fine in the browser and WSDL file  Re: Unable to write to WSDL using (Web Services Consumer Transformation ) Sreeman G Mar 29, 2014 12:02 AM ( in response to aditya_prakash7 ) As per the 2nd and 3rd screenshots( i think u have taken from Application Connection Browser) there i dont see the end point url(you have to mention the end point url) and Trust certificate files like

Comments
  • I had the same issue using the Salesforce PHP Toolkit (developer.salesforce.com/page/…) when upgrading to PHP 5.6, but this has solved it. Thanks!
  • I had the same bug with ubuntu 14.10 and php5.6.9 1) - helped me, the best answer!
  • Adding ssl params solves my problem "stream_context" => stream_context_create( array( 'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, ) ) )
  • Indeed, this is really good solution for localhost testing app.