How to use soap in javascript
- by fresher
Hi guys,
I am trying to use SOAP in javascript but i am not getting how to start it.
Here is the code sample i write in PHP and it works fine. I want to write this code in Javascript. In following code i call one api from a www.example.com and for calling certain api we require to pass some parameters.
$soapClient = new SoapClient("https://www.example.com/abc.aspx?WSDL");
// Prepare SoapHeader parameters
$param_sh = array( );
$header = new SoapHeader('http://somesite.com/action/', 'user_credential', $param_sh);
// Prepare Soap Client
$soapClient->__setSoapHeaders(array($header));
// Setup the RemoteFunction parameters
$param = array(
"pwd" => "password",
"id" => "name"
);
// Call RemoteFunction ()
$contents = $soapClient->__call("name_of_api",array($param));
print_r($contents);
Thanx in advance!!!