cancel
Showing results for 
Search instead for 
Did you mean: 

[Urgent]Issue with passing xml as input to OData service - Malformed URI literal syntax

0 Kudos

Dear Experts,

I have developed an OData service in my Gateway system. I have created a function import in the service.

I have a requirement to pass xml as data to import parameter of this function import.

Below is my xml data which i am passing to import parameter i_xml_value

<?xml version="1.0" encoding="utf-8"?>

<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">

     <asx:values>

          <DATA SEMANTIC_OBJECT="Recommendation-maintainScenario&amp;/Scenarios/SAP_CROSS_SELL_WEB_CHECKOUT "                         COMPLETE_URL="">

          </DATA>

     </asx:values>

</asx:abap>

Below is the complete call

/sap/opu/odata/sap/MyServiceName/MyFunctionImportName?I_XML_VALUE='

<?xml version="1.0" encoding="utf-8"?>

<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"><asx:values><DATA SEMANTIC_OBJECT="Recommendation-maintainScenario&amp;/Scenarios/SAP_CROSS_SELL_WEB_CHECKOUT " COMPLETE_URL=""></DATA></asx:values></asx:abap>

'

I am getting repose as "Malformed URI literal syntax" (please find attachment), Could you please guide me about how can i send xml as input value to my service function import.

Help is much appreciated.

Thanks,

Anurag.

Accepted Solutions (1)

Accepted Solutions (1)

former_member184867
Active Contributor
0 Kudos

Hi,

Is '&amp;' intentional in your XML ?


/sap/opu/odata/sap/MyServiceName/MyFunctionImportName?I_XML_VALUE='

<?xml version="1.0" encoding="utf-8"?>

<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"><asx:values><DATA SEMANTIC_OBJECT="Recommendation-maintainScenario&amp;/Scenarios/SAP_CROSS_SELL_WEB_CHECKOUT " COMPLETE_URL=""></DATA></asx:values></asx:abap>

'

Remove it if not needed.

Character '&' causes the problem in this case.

However I would be interested to know what is the use case, why do you need to pass XML as parameter value ?

Regards

Atanu 

0 Kudos

Wow Atanu,

Thank you that's the right answer.

Thanks.

Answers (1)

Answers (1)

AshwinDutt
Active Contributor
0 Kudos

Hello Anurag,

Looks like problem is with the string you are sending as input.

What is the operation?  GET / POST ?

However,

Did you try to send a simple string as input first ? say for example as below. Is it working ?

/sap/opu/odata/sap/MyServiceName/MyFunctionImportName?I_XML_VALUE='Anurag Bajaj'


Regards,

Ashwin

0 Kudos

Hello Ashwin,

I tried first sending string and its working.

I double checked my xml, It is well formed hence no issue with input.

I am now thinking of converting the xml to octent stream in JS and send to ABAP.

In ABAP, A reverse conversion to get back my xml.

Regards,

Anu.