cancel
Showing results for 
Search instead for 
Did you mean: 

How to consume SOAP based webservice in SAPUI5

sunil1101
Advisor
Advisor
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member207744
Contributor
0 Kudos

Hope you have created servlet and declared it in web.xml file

If not check below link.

Servlets First Examples

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.

           }

         });

sunil1101
Advisor
Advisor
0 Kudos

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

former_member207744
Contributor
0 Kudos

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

http://api.jquery.com/jquery.ajax/