java - How to add parameters to the SOAP Request -
i want call rfc
function in sap
, make request java
, wsdl
response. want send parameter soap request ? how ?
the class below, used create request , response :
public class soapclientsaaj { public static void main(string args[]) throws exception { // create soap connection soapconnectionfactory soapconnectionfactory = soapconnectionfactory.newinstance(); soapconnection soapconnection = soapconnectionfactory.createconnection(); // send soap message soap server string url = "http://10.130.105.8:8000/sap/bc/.....client=520"; soapmessage soapresponse = soapconnection.call(createsoaprequest(), url); // print soap response system.out.print("response soap message:"); soapresponse.writeto(system.out); soapconnection.close(); } private static soapmessage createsoaprequest() throws exception { messagefactory messagefactory = messagefactory.newinstance(); soapmessage soapmessage = messagefactory.createmessage(); soappart soappart = soapmessage.getsoappart(); string serveruri = "http://ws.cdyne.com/"; // soap envelope soapenvelope envelope = soappart.getenvelope(); envelope.addnamespacedeclaration("example", serveruri); // soap body soapbody soapbody = envelope.getbody(); soapelement soapbodyelem = soapbody.addchildelement("pernr","example"); soapbodyelem.addtextnode("10001001"); string authorization = new string(base64.encodebase64(("hr_develop:unrwa2013").getbytes())); soapmessage.getmimeheaders().addheader("authorization","basic " + authorization); soapmessage.savechanges(); /* print request message */ soapmessage.writeto(system.out); system.out.println(); return soapmessage; } }
Comments
Post a Comment