cancel
Showing results for 
Search instead for 
Did you mean: 

invoking the external webservice in UI5 function method with xml payload

soumya_r
Participant
0 Kudos
507

Hi,

I have to trigger the POST call with XML payload to Data center intergration webservice from bartender software to print labels for Orders in SAP UI5 application.

This service is added in BTP,destination and connection is successful. this service accepts only XML format data.

How to formulate XML in ui5 from data in the ui5 form screen and read the response.

I tried in string to formulate XML, but error and $.ajax().

the below tag control will be multiple based on order and repetitive.

<xSubString Name="_Field">
 <Value>111</Value>
 </xSubString>

XML format:

<?xml
version="1.0" encoding="UTF-8"?>
<XMLScript Version="1.0">
<level>
<Xprint>
<Form SaveAtEndOfJob="true" CloseAtEndOfJob="false">\\dummy
data print</Format>
<xSubString Name="_Field">
 <Value>111</Value>
 </xSubString>
<xSubString
Name="_Field">
 <Value>111</Value>
 </xSubString> 
 <Setup> 
 <copies>1</Copies> 
 <Printer>PDF</Printer>  
 </Setup> 
 </Xprint>
</level>
</XMLScript>
$.ajax({ 

type: "POST", url: sURL, 

content: "text/xml", datatype: "text/json", 

success: this.resSuccess, 

error: this.resError });

I followed this blog SOAP service an tried all the possibility. but not happening the response is always error.

I have added this webservice in destination in BTP and in neo-app.json as well. But, issue is not able to invoke this from my controller method. - how to fetch this from neo-app.json?

Any leads will be much appreciated.

Thanks in advance,

Soumya

Accepted Solutions (0)

Answers (1)

Answers (1)

gregorw
SAP Mentor
SAP Mentor
0 Kudos

In your ajax call you send a GET and not a POSt with a payload.

I would suggest that you find a way to call the API using REST or OData.

soumya_r
Participant
0 Kudos

Hi,

Post also is possible with AJAX call as in the post ajax call for soap service. this is not OData service.

its external webservice i am invoking.

thanks,

Soumya