AnsweredAssumed Answered

Sample Code for calling Invoke Action type web service(Process Invocation)

Question asked by Naveen Kumar Challagulla on Jun 4, 2014
Latest reply on Jun 6, 2014 by Naveen Kumar Challagulla

Hi All
I want to start a process with no primary object by invoking 'Invoke Action' type web service named Process through Java Script.
Can anybody please suggest me the sample code for this?

can we invoke process using SOAP Request?
i have one sample code, please check is it any useful or not        

<html>
<head>
    <title>SOAP JavaScript Client Test</title>
    <script type="text/javascript">
        function soap() {
         
            var xmlhttp = new XMLHttpRequest();
            xmlhttp.open('POST', 'https://******.ondemand.ca.com/niku/xog/', true);

            // build SOAP request
            var sr =
                '<?xml version="1.0" encoding="utf-8"?>' +
              ' <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:inv="http://www.niku.com/xog/InvokeAction">'+
 '<soapenv:Header>'+
 '<inv:Auth>'+
 '<inv:Username>xog_user</inv:Username>'+
 '<inv:password>xog_password</inv:password>'+
 '</inv:Auth>'+
 '</soapenv:Header>'+
 '<soapenv:Body>'+
 '<inv:process>'+
 '<code>n_test_invokestart<code>'+
 '<request/>'+
 '</inv:process>'+
 '</soapenv:Body>'+
'</soapenv:Envelope>';

            xmlhttp.onreadystatechange = function () {
                if (xmlhttp.readyState == 4) {
                    if (xmlhttp.status == 200) {

                        alert('done use firebug to see response');
                    }
                }
            }
            // Send the POST request
            xmlhttp.setRequestHeader('Content-Type', 'text/xml');
            xmlhttp.send(sr);
            // send request
            // ...
        }
    </script>
</head>
<body>
    <form name="Demo" action="" method="post">
        <div>
            <input type="button" value="Soap" onclick="soap();" />
        </div>
    </form>
</body>
<html>

  
please give me some input on this.
And this is ondemand envronment, Here seems java script is working fine but there is no response from SOAP XML.
Thanks & Regards
Naveen

Outcomes