In this weblog I will present how to post a message to XI Pipeline ( bypassing Adapter Engine).
For what reasons should I not use Adapter Engine? First of all it’s faster not to use it, secondly to diminish the load on it (if for instance you have interface that must work even if the Adapter Engine is down).
1. We will create a little Web Dynpro just to post the message in NWDS:
>New>Project >Web Dynpro>Web Dynpro Project.
2. You can ignore the warning message (if you got one).
3. Fill the project name (I called it Post_To_XI) and create the project (click on “Finish” button).
4. We can go to “Applications” and create new application
5.Let’s call it Post_To_XI and put it in “sample” package.
6.Create a new component
And finally it should look like this:
7. Now we will create GUI just to post the message:
Go to Web Dynpro Components
>Post_To_XI>Views–>Post_To_XIView and add 2 textboxes:URL(of XI PipeLine) and Payload(XML we are going to send) and a button, this should look like:
8. We should create 2 context elements (so we can use the text boxes): Go to Context tab:
9. Add 2 variables(URL and Payload):
10. Assign these variables to our textboxes: return to layout tab, click your “url” textbox and add value:
11. Choose “URL” from the context menu:
12. Do the same for Payload TextBox.
13. Now we will add some code to our button –>add an “onAction” event.
Name it “Send” and click the “Finish” button:
14. Go to “implementation” tab –>go to “onActionSend” function:
and add the following code:
// String SOAPUrl should be in the following format
//Get the url from gui
String SOAPUrl = wdContext.currentContextElement().getURL();
//Read the payload to post to XI
byte b = wdContext.currentContextElement().getPayload().getBytes();
//Create the connection to send the message
URL url = new URL(SOAPUrl);
URLConnection connection = url.openConnection();
HttpURLConnection httpConn = (HttpURLConnection)connection;
//Set the appropriate HTTP parameters.
httpConn.setRequestProperty( “Content-Length”,String.valueOf( b.length ) );
// Everything’s set up; send the XML that was read in b.
OutputStream out = httpConn.getOutputStream();
//Read the response
Reader isr = new InputStreamReader(httpConn.getInputStream());
BufferedReader in = new BufferedReader(isr);
String Response = “”;
while ((inputLine = in.readLine()) != null)
Response = Response + inputLine + “\n”;
//Exceptions we write in Payload textbox:
15. We move to ABAP development:
We will build a function that returns the input:
We go to se80, create new function ZRFC_Return_Input, giving it import variable, called “DATA” and export “DATA_BACK” Variable and write:
DATA_BACK = Data.
in the code section.
16. Make it “Remote-Enabled”.
Finally we move to XI:
17. Create the namespace “XI_Payload_Test”.
18. Name it : “com:test:xi_payload” and save.
19. Make sure that “Import RFC and IDOC Interfaces from SAP Systems permitted” selected:
20. Import our RFC into XI:
21. Create Message Interface “RFC_XI_Payload” for Our RFC Message and put our RFC as the interface (it should look like the following):
22. Create 2 Message Mapping (1 for request “XI_Payload_Test_MM”):
And another one for response “XI_Payload_Test_Response_MM”:
23. Create Interface Mapping “XI_Payload_Test_IM” and assign the mapping programs ” XI_Payload_Test_MM” and “XI_Payload_Test_Response_MM”.
24. Activate the “Change List”.
What is left is to build Configuration Scenario: so we move to Configuration:
25. Since we send to XI PipeLine there is no need in “Sender Agreement”.
26. Create Configuration Scenario ” Test_XI_Payload_SC” and save it:
27. Create Business Service “Text_XI_Payload_BS”:
And assign it our interface in sender interfaces:
28. Finally we build “Receiver Determination”:
Sender: Service :Test_XI_Payload_BS
Interface : RFC_XI_Payload
Configured Receiver : Your R/3 system
Inbound Interface : Interface : ZRFCRETURN_INPUT
Interface Mapping: Name : XI_Payload_Test_IM
Namespace : com:test:xi_payload
Receiver agreement : Your R/3 Communication channel.
29. Activate the Change List.
Now we can test our Scenario :
Run WebDynpro, enter the address of the service : I assume that your ABAP Port is 8000. This is true if your System ID is “00”, otherwise you should use another number instead of 8000.
The Payload is :
And Push the “Send” Button
The result is 2 messages in XI: