Posted on 2011-04-23
Last Modified: 2012-06-27
Hi Guys,

Please someone help me provide the revised code for this issue :

Question by:softbless
    LVL 5

    Accepted Solution


    I have not had time to test this, but you want to do something like this:
    	$securityHeaderParam = array('Username'=>'admin', 'Password'=>'admin');
    	$headers = new SoapHeader('', 'UserCredentials', $securityHeaderParam);
           	$client = new SoapClient('');
           	echo 'Request :<pre>'.htmlspecialchars($client->__getLastRequest());
           	echo '</pre>Response:<pre>'.htmlspecialchars($client->__getLastResponse()) . '</pre>';
        catch (SoapFault $e)
           echo '<p>Fault String: ' . $e->faultstring . '<p>';
           echo '<p>Fault Code: ' . $e->faultcode . '<p>';

    Open in new window

    The main points to remember, are to add the user credentials to the soap header .

    line 6 defines the user credentials.
    line 7 adds the credentials to a new soap header object.
    line 10 adds the header to the soap client, which will then be included in the future function calls

    Author Closing Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
    Part of the Global Positioning System A geocode ( is the major subset of a GPS coordinate (, the other parts being the altitude and t…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now