NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
WebService with SSL Authentication

Joined: 14 Oct 2015
Posts: 1
Reply with quote
I've been trying to connect to a webservice that requires authentication. I've tried every suggestion that I get in the web but still not able to connect successfully. See my code below:


$url = '';
$certFile = 'certificate.crt';

$soapUI = new nusoap_soapUI($url, true);
//Read from a post to specify the soap version to prevent the application type error
$soapUI->soap_version = 'SOAP_1_1';
$soapUI->authtype = 'certificate';
$soapUI->soap_defencoding = 'UTF-8';
$soapUI->decode_utf8 = false;

$soapUI->certRequest['sslcertfile'] = $certFile;
$soapUI->certRequest['sslkeyfile'] = $keyFile;
$soapUI->certRequest['cainfofile'] = $caFile;
$soapUI->certRequest['verifypeer'] = 0;
$soapUI->certRequest['verifyhost'] = 0;

//Tried to execute this but got the same error.
$soapUI->setCurlOption( CURLOPT_RETURNTRANSFER, true );
$soapUI->setCurlOption( CURLOPT_FOLLOWLOCATION,true );
$soapUI->setCurlOption( CURLOPT_SSL_VERIFYHOST, false);
$soapUI->setCurlOption( CURLOPT_SSL_VERIFYPEER, false);
$soapUI->setCurlOption( CURLOPT_SSLKEY, $keyFile);
$soapUI->setCurlOption( CURLOPT_CAINFO, $caFile);
$soapUI->setCurlOption( CURLOPT_SSLCERT, $certFile);
$soapUI->setCurlOption( CURLOPT_ERRORBUFFER, 'curlError');

$soapUI->call("setLogin, $credentials);

if ($soapUI->fault)

    // check result
    $err_msg = $soapUI->getError();
    if ($err_msg) {
        // print error msg
      //  echo 'Error: '.$err_msg;
        // print result
        echo 'Result: ';

echo '<h2>Request</h2><pre>' . $soapUI->request, ENT_QUOTES . '</pre>';
echo '<h2>Response</h2><pre>' . $soapUI->response, ENT_QUOTES . '</pre>';
echo '<h2>Debug</h2><pre>' . $soapUI->debug_str, ENT_QUOTES . '</pre>';

See below for the Request and Result
POST /Connect/WebServices/SentWebService.svc HTTP/1.0
User-Agent: NuSOAP/0.9.5 (1.123)
Content-Type: text/xml; charset=UTF-8
SOAPAction: ""
Content-Length: 476

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="" xmlns:xsd="" xmlns:xsi="" xmlns:SOAP-ENC="" xmlns:ns7913=""><SOAP-ENV:Body><SetLogin xmlns=""><Set>WebTest</Set><Password>abcdef123</Password>

<pre>HTTP/1.1 415 Cannot process the message because the content type 'text/xml; charset=UTF-8' was not the expected type 'application/soap+xml; charset=utf-8'.
Date: Wed, 14 Oct 2015 14:38:41 GMT
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
Content-Length: 0
Connection: close
Content-Type: text/plain; charset=UTF-8


Additional Information
Language Used: PHP
Version: PHP 5.5.9-1ubuntu4.11

php -i | grep -i soap
Soap Client => enabled
Soap Server => enabled
soap.wsdl_cache => 1 => 1
soap.wsdl_cache_dir => /tmp => /tmp
soap.wsdl_cache_enabled => 1 => 1
soap.wsdl_cache_limit => 5 => 5
soap.wsdl_cache_ttl => 86400 => 86400
View user's profileFind all posts by lonelygirl86Send private message
WebService with SSL Authentication
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

 Reply to topic