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

  • Home
  • SEARCH
  • 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 8729485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:50:34+00:00 2026-06-13T08:50:34+00:00

I tried using the example mentioned in below url. but got confused how they

  • 0

I tried using the example mentioned in below url. but got confused how they are building the $wrapper here. Can anyone tell me how to create to wrapper and what it should contain.
http://www.sis.utoronto.ca/web_services/code_samples.html.

Can someone help me here since I am using wsse for the first time so dont know how to use it. I am making a soap call from PHP to .net wsse.

Please let me know how to pass headers in this example.

<?php
  class WSSESoapClient extends SoapClient {                                                                                           
protected $wsseUser;
protected $wssePassword;

public function setWSSECredentials($user, $password) {
    $this->wsseUser = $user;
    $this->wssePassword = $password;
}

public function __doRequest($request, $location, $action, $version, $one_way = 0) {
    if (!$this->wsseUser or !$this->wssePassword) {

        return parent::__doRequest($request, $location, $action, $version, $one_way = 0);
    }

    // get SOAP message into DOM
    $dom = new DOMDocument();
    $dom->loadXML($request);
    $xp = new DOMXPath($dom);
    $xp->registerNamespace('SOAP-ENV', 'http://schemas.xmlsoap.org/soap/envelope/');

    // search for SOAP header, create one if not found
    $header = $xp->query('/SOAP-ENV:Envelope/SOAP-ENV:Header')->item(0);
    if (!$header) {
        $header = $dom->createElementNS('http://schemas.xmlsoap.org/soap/envelope/', 'SOAP-ENV:Header');
        $envelope = $xp->query('/SOAP-ENV:Envelope')->item(0);
        $envelope->insertBefore($header, $xp->query('/SOAP-ENV:Envelope/SOAP-ENV:Body')->item(0));
    }

    // add WSSE header
    $usernameToken = $dom->createElementNS('http://schemas.xmlsoap.org/ws/2002/07/secext', 'wsse:UsernameToken');
    $username = $dom->createElementNS('http://schemas.xmlsoap.org/ws/2002/07/secext', 'wsse:Username', $this->wsseUser);
    $password = $dom->createElementNS('http://schemas.xmlsoap.org/ws/2002/07/secext', 'wsse:Password', $this->wssePassword);
    $usernameToken->appendChild($username);
    $usernameToken->appendChild($password);
    $header->appendChild($usernameToken);

    // perform SOAP call
    $request = $dom->saveXML();

    return parent::__doRequest($request, $location, $action, $version, $one_way = 0);
}

  } // class WSSESoapClient

  $wsdl = 'Mywsdlurl';
  $sClient = new WSSESoapClient ($wsdl,array( "trace" => 1 ));


    $sClient->setWSSECredentials('username', 'password');

    $wrapper->AccountName = new SoapVar("NEw User", XSD_STRING);
    $wrapper->AccountInfo->propertyID = new SoapVar(2, XSD_STRING);


    try {
$result = $sClient->CreateAccount($wrapper);    
print_r($result);
} catch (SoapFault $fault) {
print("Fault string: " . $fault->faultstring . "\n");
print("Fault code: " . $fault->detail->WebServiceException->code . "\n");
}

echo $sClient->__getLastRequest();
 // "<br>" .
//  $sClient->__getLastResponse();

?>

When I check the __getLastRequest it is not attaching the headers defined in _doRequest;

Please let me know what wrong I am doing here.

  • 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-13T08:50:35+00:00Added an answer on June 13, 2026 at 8:50 am

    I have implemented the UserNameToken using PasswordDigest in my Moodle module that integrates with Skillsofts OLSA Web Services.

    Take a look at:
    http://code.google.com/p/moodle2-skillsoft-activity/source/browse/trunk/skillsoft/olsalib.php#40

    This is where I create a wrapper around the PHP SoapClient to support sending the UserNameToken with password digest, you can tweak this to do plain password etc etc

    It has some Moodle specific code for getting things like proxy to use etc, and where to “cache” the WSDL on the filesystem (makes it faster setting up the client – rather than each time you set it up pulling down the WSDL etc)

    Then look at:
    http://code.google.com/p/moodle2-skillsoft-activity/source/browse/trunk/skillsoft/olsalib.php#483

    Where I call one of the web services and you can see how the client is setup and how the username/password are passed across.

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

Sidebar

Related Questions

I tried using arrays but I don't need every single element, and so it
I tried using date/time, time, but it doesn't help. Exception Details: System.Web.HttpException: DataBinding: 'DatePickerControl.DatePicker'
I tried using the following code for a HTML page, but it doesn't work.
I tried using make defconfig to compile the kernel, but as expected, it failed
I tried using both ReadProcessMemory() and WriteProcessMemory() in my application,but in both cases I
I tried using height: 100% but this makes the div only as high as
Could anyone provide me with some assistance in creating a minimum example of using
How to achieve below mentioned JSON format using C#.NET HashTable {DoWorkResult: [ {Perimeter:55}, {Mortgage:540},
I have tried using a example file using PHPExcel script to extract data from
I tried using curl syntax: curl http:// localhost:8983/solr/update/csv?stream.file=/usr/local/src/apache-solr-3.6.0/example/exampledocs/my+file.csv&separator=;&stream.contentType=text/plain;charset=utf-8 with no luck. I get: -bash:

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.