cancel
Showing results for 
Search instead for 
Did you mean: 

Can i call a HTTP Post method in ABAP or XI?

Former Member
0 Kudos

Hi All,

Can you please let me know how to call a HTTP Post method in ABAP or XI?

my HTTP Post is looks like (HTML form)

<form action="http://111.111.111.1:8080/sample_url" method="POST">

<table>

<tr><th>applicationId</th><td><input type="text" name="applicationId" value="test"></td></tr>

<tr><th>authCode</th><td><input type="text" name="authCode" value="test"></td></tr>

<tr><th>message</th><td><input type="text" name="message" value="Hello"></td></tr>

<!--<tr><th>version</th><td><input type="text" name="version" value="3.1"></td></tr> -->

<tr><th>contractId</th><td><input type="text" name="contractId" value="test"></td></tr>

<tr><th>receiverMobileNumber</th><td><input type="text" name="receiver" value="11111111111"></td></tr>

<tr><td colspan="2"><input type="submit" name="send" value="send"></td></tr>

</table>

</form>

I have a requirement to send a message to the above mention URL using the POST method.

Please let me know the possibility of sending it from ABAP or XI adaptor.

Thanks & Regards,

Chaminda

Accepted Solutions (0)

Answers (1)

Answers (1)

prateek
Active Contributor
0 Kudos

Create an http receive adapter and provide the below url details as host, port and path prefix there. Create any sender side scenario and send test message. HTTP adapter performs the Post call.

Regards,

Prateek

Former Member
0 Kudos

Hi Prateek,

shoul we send the below code as the payload?

<tr><th>applicationId</th><td><input type="text" name="applicationId" value="test"></td></tr>

<tr><th>authCode</th><td><input type="text" name="authCode" value="test"></td></tr>

<tr><th>message</th><td><input type="text" name="message" value="Hello"></td></tr>

<!--<tr><th>version</th><td><input type="text" name="version" value="3.1"></td></tr> -->

<tr><th>contractId</th><td><input type="text" name="contractId" value="test"></td></tr>

<tr><th>receiverMobileNumber</th><td><input type="text" name="receiver" value="11111111111"></td></tr>

Thanks.

Chaminda

prateek
Active Contributor
0 Kudos

No, this is not a valid payload. Create a corresponding structure (DT, Mt) in XI. When using it in mapping, you can find the required payload in mapping test tab.

Regards,

Prateek

Former Member
0 Kudos

this is my payload

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

- <ns1:MT_PM_FAE_RFC_HTTP_RCV xmlns:ns1="http://pm_fae_rfc_http">

<authCode>test</authCode>

<applicationId>test</applicationId>

<contractId>syn_test</contractId>

<version>3.1</version>

<message>tes</message>

<receiverMobileNumber>111111111</receiverMobileNumber>

</ns1:MT_PM_FAE_RFC_HTTP_RCV>

but i got error message .

"com.sap.aii.utilxi.misc.api.BaseRuntimeException:Content is not allowed in prolog"

Can you please explain this.

prateek
Active Contributor
0 Kudos

From where have you taken this payload? Can you try and test it in Message Mapping and Interface Mapping test tab? What is the result there?

Regards,

Prateek

stefan_grube
Active Contributor
0 Kudos

XML is not valid for form data.

You have to create the whole stream of the HTTP call in a Java mapping proram.

It is a text based call.

http://en.wikipedia.org/wiki/MIME#Form_Data

Former Member
0 Kudos

Hi Prateek

this is the operational mapping test message result.

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

<ns1:MT_PM_FAE_RFC_HTTP_RCV xmlns:ns1="http://pm_fae_rfc_http">

<authCode>test</authCode>

<applicationId>stest</applicationId>

<contractId>SYNC</contractId>

<version>3.1</version>

<message>1111</message>

<receiverMobileNumber>111</receiverMobileNumber>

</ns1:MT_PM_FAE_RFC_HTTP_RCV>

is this correct ? or do i need to set something to "prolog"?

chaminda

Former Member
0 Kudos

Hi Stefan Grube

Can you please give me some ideas how to do this.

Chaminda

stefan_grube
Active Contributor
0 Kudos

First of all you need the whole HTTP stream of the post. You can use an HTTP sniffer for this.

When you have the stream, build the same with a Java mapping program.

This is not an easy task.

Maybe you can convince the owner of the scenario to provide a web service instead.

HTTP forms are though for human interaction, not for system integration, though it is often used for it.

Former Member
0 Kudos

Hi all,

Thank you very much for your help. anyway i have solved the problem by using a ABAP Class "CL_HTTP_CLIENT" since Java Mapping is bit difficult. this class supports "POST" and "GET" both.

Thanks & Regards,

Chaminda