Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9139495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:23:43+00:00 2026-06-17T09:23:43+00:00

I have a SOAP server web service and a SOAP client on another server

  • 0

I have a SOAP server web service and a SOAP client on another server to test my web service.

In wsdl-mode the SOAP server ignores the header and header function, thus ignoring the client authentication details. Meaning the client doesn’t authenticate. The SOAP server is on a https domain.

The SOAP server and client works perfectly in non-wsdl mode.

Can anybody please tell me what I am doing wrong?

Here is my SOAP client:

    $params = 'LHAFDS89';

    ini_set('soap.wsdl_cache_enabled',0);
    ini_set('soap.wsdl_cache',0);
    ini_set('soap.wsdl_cache_ttl',0);

    $client = new SoapClient('https://www.example.com/webservices/example.wsdl', array('trace'=>true));

    $authentication['key'] = "n/KLASDF9ASDF9832JDAFJ234=";

    $auth_key = $authentication['key'];
    $auth_mode = 't';

    $auth = new SOAPAuth($auth_key,$auth_mode);

    $header[] = new SoapHeader("urn:www.example.com",'authenticateClient',$auth,0);
    $client->__setSoapHeaders($header);

    try
    {
        $result = $client->soapFunction($params);
    }
    catch (SoapFault $e) 
    {
        echo "<script>alert('".$e->faultcode.'\n\n'.$e->faultstring."');</script>";
    }

    echo $result['message'];

class SOAPAuth 
{
    public $key;
    public $mode;

public function __construct($key, $mode) 
    {
      $this->key = $key;
      $this->mode = $mode;
    }
}

SOAP Server:

class ExampleClass {

    protected $user_is_valid;
    protected $mode;

    public function __construct()
    {
        $this->user_is_valid = false;
        $this->mode = '';
    }

    public function authenticateClient($header){
        if (isset($header->key) && isset($header->mode)){
            $authentication['key'] = $header->key;
            $this->mode = $header->mode;
            if($authentication['key']== 'n/KLASDF9ASDF9832JDAFJ234=')
            {
                $this->user_is_valid = true;
            }
        }
    } 

    public function soapFunction($params)
    {
        if($this->user_is_valid == true){

                $result['message'] = "User is valid."
                return $result; 

        } else {
            throw new SoapFault("Authorization:", "Failed!"); 
        }
    }
}

ini_set('soap.wsdl_cache_enabled',0);
ini_set('soap.wsdl_cache',0);
ini_set('soap.wsdl_cache_ttl',0);

$example_class = new ExampleClass();
$server = new SoapServer("example.wsdl");

$server->setObject($example_class);
$server->handle();    

WSDL:

<?xml version="1.0" encoding="utf-8"?>

<definitions name="Example"
   targetNamespace="urn:Example"
   xmlns:typens="urn:Example"
   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
   xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
   xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
   xmlns="http://schemas.xmlsoap.org/wsdl/">

   <message name='header'>
     <part name='key' type='xsd:string'/>
     <part name='mode' type='xsd:string'/>
   </message>

   <message name='soapFunction_request'>
     <part name='params' type='xsd:string'/>
   </message>       
   <message name='soapFunction_response'>
     <part name='result' type='xsd:string[]'/>
   </message>

   <portType name='soapFunctionPortType'>
     <operation name='soapFunction'>
       <input message='tns:soapFunction_request'/>
       <output message='tns:soapFunction_response'/>
     </operation>
    </portType>

    <binding name='soapFunctionBinding' type='tns:soapFunctionPortType'>
    <soap:binding style='rpc'
         transport='http://schemas.xmlsoap.org/soap/http'/>
     <operation name='soapFunction'>
     <soap:operation soapAction='urn:soapFunction'/>
     <input>
        <soap:header message="header" part="key"/>
        <soap:header message="header" part="mode"/>
        <soap:body use='encoded' namespace='urn:soapFunction'
            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
     </input>
     <output>
        <soap:body use='encoded' namespace='urn:soapFunction'
            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
     </output>
     </operation>
      </binding>

      <service name='soapFunctionService'>
     <port name='soapFunctionServicePort' binding='soapFunctionBinding'>
      <soap:address location='https://www.example.com/webservices/soapServer.php'/>
     </port>
      </service>
</definitions> 

Any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:23:44+00:00Added an answer on June 17, 2026 at 9:23 am

    I found a solution to my problem. It is not exactly what I had in mind, but it works.

    I let the SOAP clients connect to my SOAP server in wsdl mode and I let the SOAP server respond in non wsdl mode.

    For some reason the headers do not get ignored while working this way, the client authenticates correctly and the client’s input get checked against the wsdl for validity.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web server which is acting as a SOAP client to communicate
I have to make a web service client from an wsdl file. I have
I have WSDL of remote web service and WSDL of server. I have C++
I have two webapps: a web-service client and a server (both CXF-based, using the
I Have an internal SOAP Web service that is being called from an external
I have asimple WCF HTTP/SOAP web service, the service implementation looks something like this:
I have a requirement where i have to develop a Web service Client to
I am trying to invoke method via webservice (SOAP) I have generated Web service
I have written a SOAP based web service which runs fine on a Tomcat
I have a web service project and simple test application. I can debug the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.