cancel
Showing results for 
Search instead for 
Did you mean: 

Http Post to XI Test Tool in Java?

Former Member
0 Kudos

I have been able to use the HTML test tool shared on SDN for my scenarios to date, but I have been <u>also</u> trying to write an http post program in java. For some reason the post never makes it to XI. Does anyone have a sample they will share or notice any problems with this code?

Thanks.

import java.net.*;

import java.io.*;

public class Reply {

private static String myUrl = "http://sr3a80px:8000/sap/xi/adapter_plain?service=PAN_HOTKEY&namespace=http://graybar.com/sandbox/hotkeyoutbound&interface=PANRequestAbstractInterfaceAsync&party=Panduit";

public static void main(String[] args) {

try {

URL u = new URL(myUrl);

URLConnection uCon = u.openConnection();

HttpURLConnection connection = (HttpURLConnection) uCon;

connection.setDoOutput(true);

connection.setRequestMethod("POST");

OutputStream out = connection.getOutputStream();

OutputStreamWriter wout = new OutputStreamWriter(out, "UTF-8");

wout.write("<?xml version=\"1.0\"?>\r\n");

wout.write("<ns0:hotkeyOut_PAN_MessageType

xmlns:ns0=\"http://abc.com/hotkeyoutbound\">\r\n");

wout.write("<RequestAvailability>\r\n");

wout.write("<Date>20050919</Date>\r\n");

...(rest of my xml)...

wout.flush();

out.close();

}

catch (IOException e) {

System.err.println(e);

e.printStackTrace();

}

} // end of main

} // end of class

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

cleaning up old ticket...never got this working, but tested another way