Here’s a simple example of calling an M3 web service using jQuery. In this example, my web service has two input fields and 3 output fields. You’ll obvously need to change the URL to the web service and the format of your soap request to match your WSDL.
<html> <head> <title>example m3 soap web service with jquery</title> http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js $(document).ready(function () { jQuery.support.cors = true; $("#submitBtn").click(function (event) { var wsUrl = "http://ussplu124.lu123train.lawson.com:20005/lws-ws/learning/JK-CustomerService"; var soapRequest = ''; soapRequest += '' + $("#cusno").val() + '' + $("#addressId").val(); soapRequest += ''; $.ajax({ type : "POST", url : wsUrl, contentType : "text/xml", dataType : "xml", data : soapRequest, success : processSuccess, error : processError }); }); }); function processSuccess(data, status, req) { if (status == "success") { var ois002 = $(req.responseText).find('OIS002'); var response = ois002.find('Name').text() + "
" + ois002.find('AddressLine1').text() + "
" + ois002.find('AddressLine2').text(); $("#response").html(response); } } function processError(data, status, req) { alert(req.responseText + " " + status); } </head> <body> <h3>Calling Web Services with jQuery/AJAX</h3> <h4>Input</h4> Customer Number / Address ID <input id="cusno" type="text" /> <input id="addressId" type="text" /> <input id="submitBtn" value="Submit" type="button" /> <h4>Output</h4> <div id="response"/> </body> </html>
Here’s the example HTML page, with my input fields and the response I get when I submit the form:
/Jessica
I confirm it works.
LikeLike
I confirm it works, to complete, you can use something like this to avoid to write the all address and to manage every environments 😉 :
var wsUrl = “/mws-ws/services/PPS620”;
To help to generate the soap message, you can use SoapUI
LikeLike