on 11-20-2014 11:28 AM
Hi All,
I am trying to consuming SOAP based websrvice in SAP UI5 application, but dont know how to do this.
I have found a tutorial where we can use SAPUI5 views in dynamic Java web project.
In this tutorial SOAP webservie have almost done it, I can run servlet and it returns OK status.
But I want to pass data from SAPUI view to servlet, which I again dont know how to do it.
if I want to pass parameter in servlet from JAVASCRIPT then how to do that.
Thanks
sunil Maurya
Hope you have created servlet and declared it in web.xml file
If not check below link.
Check below sample for calling servlet from jquery
$.ajax({
type: "POST/GET",
url: 'servletname in web.xml file',
dataType: "json", //if you want to return xml file, then chagne the datatype as xml
success: function(data)
{
// your servlet data
},
error: function (xhr, ajaxOptions, thrownError) {
// you will get error details here
},
beforeSend: function(){
//call busy indicator here. in success hide the busy indicator.
}
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sriram,
Thanks for the quick response.
I am able to call servlet from JavaScript code, and also able to consume webservice in Servlet.
but now I want to pass some data from UI screen to servlet.
I have two input fields in one fields I want to give query parameter e.g. empId, and to get back emp_name in another textField.
in JS for query parameter I have written
input1 = sap.ui.getCore().byId("input1").getValue();
how to use this value in servlet request.getParameter();
Thanks
Sunil Maurya
My bad.
In javascript
var ipField1= "Field1 value";
var ipField2= "Field2 value";
var dataString = {"ipField1":ipField1,"ipField2":ipField2};
in ajax call add
data: dataString
In servlet
request.getparameter("ipField1");
reqeust.getparameter("ipField2");
For more info about jquery ajax call, check below link
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.