How to invoke webservice from a java servlet?
maddinenisri
08-30-2002, 07:00
Here you go....
// Make http connection to the webMethods b2b Server
URL url = new URL ("http://B2B_IP:Port_No/invoke/Interface_Name/Flow_Name?$xmldata=");
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setUseCaches(false);
conn.setRequestProperty("content type","application/x-www-form-urlencoded");
// Send the POST data to the B2B server
DataOutputStream Out = new DataOutputStream(conn.getOutputStream());
Out.writeBytes("$xmldata=" + URLEncoder.encode(exchg));
Out.flush();
Out.close();
Hope this solves your problem.......