Clarity

 View Only
Expand all | Collapse all

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

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

    Posted Jun 04, 2014 07:54 AM

    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="'" rel="nofollow" target="_blank">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



  • 2.  RE: Sample Code for calling Invoke Action type web service(Process Invocati
    Best Answer

    Posted Jun 04, 2014 10:52 PM
      |   view attached

    Hey,

    I threw this together quick for you from a template I always use to do this type of thing...

    Hope it helps! laugh

    Attachment(s)

    html
    startProcess.html   2 KB 1 version


  • 3.  RE: Sample Code for calling Invoke Action type web service(Process Invocati

    Posted Jun 06, 2014 04:47 AM

    Excellent chris,It is perfect for my question. Thanks allot