How to use soap in javascript

Posted by fresher on Stack Overflow See other posts from Stack Overflow or by fresher
Published on 2010-04-05T06:44:53Z Indexed on 2010/04/05 6:53 UTC
Read the original article Hit count: 286

Filed under:
|
|

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!!!

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about php