‎2010 Jan 29 3:58 AM
Hello all,
I have requirment where i am trying to call an https URl from ABAP and pass an XML string and receive the response. However i am not sure how can i acheive this.
For example, the bleow code in java acheives the same thing but i want to do something similar in ABAP.
* Send data to OnDemand
*/
urlConnection = (HttpsURLConnection) (new URL(ONDEMAND_URI)).openConnection();
urlConnection.setDoInput(true);
urlConnection.setDoOutput(true);
urlConnection.setRequestMethod("POST");
urlConnection.setRequestProperty("Authorization", authHeader);
urlConnection.setRequestProperty("Content-length", "" + dataBytes.length);
urlConnection.setRequestProperty("Content-Type", "text/xml");
urlConnection.getOutputStream().write(dataBytes);
/*
* Ensure succesful data upload by ensuring HTTP Status Code 200.
*/
if(urlConnection.getResponseCode() != 201) {
throw new Exception("Failed dataSet upload.\n"
+ "HTTP " + urlConnection.getResponseCode()
+ ": " + urlConnection.getResponseMessage());
}
It would be really helpful if you could give some detail explanation or links where such information is available. Thanks a lot in advacne.
Warm Regards,
Naveen M
‎2010 Feb 22 4:04 PM
Hi, first thing to do is of course an abap proxy client.
This can be created in SE80 under enterprice service. You need the WSDL of the service and the
abap proxy (with input and output structures) is automatically generated.
When you have the abap proxy, you can use it any other abap class.
In will write a zreport program with ....
DATA: lo_proxy TYPE REF TO PROXY,
lf_output TYPE proxy_output_structure,
lf_input TYPE proxy_input_structure.
Create Proxy instance
CREATE OBJECT lo_proxy.
Method Call
TRY.
CALL METHOD lo_proxy->method_name
EXPORTING
INPUT = lf_input
IMPORTING
OUTPUT = lf_output.
CATCH cx_ai_system_fault.
sy-subrc = 1.
CATCH yfiqcx_fault_message .
sy-subrc = 2.
CATCH cx_ai_application_fault.
sy-subrc = 3.
ENDTRY.
Hope it can help you.
‎2010 Feb 22 4:04 PM
Hi, first thing to do is of course an abap proxy client.
This can be created in SE80 under enterprice service. You need the WSDL of the service and the
abap proxy (with input and output structures) is automatically generated.
When you have the abap proxy, you can use it any other abap class.
In will write a zreport program with ....
DATA: lo_proxy TYPE REF TO PROXY,
lf_output TYPE proxy_output_structure,
lf_input TYPE proxy_input_structure.
Create Proxy instance
CREATE OBJECT lo_proxy.
Method Call
TRY.
CALL METHOD lo_proxy->method_name
EXPORTING
INPUT = lf_input
IMPORTING
OUTPUT = lf_output.
CATCH cx_ai_system_fault.
sy-subrc = 1.
CATCH yfiqcx_fault_message .
sy-subrc = 2.
CATCH cx_ai_application_fault.
sy-subrc = 3.
ENDTRY.
Hope it can help you.
‎2010 Feb 22 10:38 PM
You will find more information in [SAP library - Example Program: Executing an HTTP Request|http://help.sap.com/SAPHELP_NW04S/helpdata/EN/1f/93163f9959a808e10000000a114084/frameset.htm]
‎2010 Feb 23 3:11 AM
Hi,
Thanks for the replies.
I tried using CL_HTTP_CLIENT class and it worked fine for my requirment.
Warm Regards,
Naveen