java - saaj client program getting response as wsdl file code -


i not getting proper response, getting response wsdl file code. please tell me how resolve problem proper response

public class saajclientdemo {      private static soapmessage createsoaprequest() throws exception {         messagefactory messagefactory = messagefactory.newinstance();         soapmessage soapmessage = messagefactory.createmessage();         string loginpassword = "xx:xx";         soapmessage.getmimeheaders().addheader("authorization", "basic " + new string(base64.encode(loginpassword.getbytes())));        // creating soap part         soappart soappart = soapmessage.getsoappart();         soapenvelope soapenvelope = soappart.getenvelope();         soapenvelope.addnamespacedeclaration("urn", "urn:sap-com:document:sap:soap:functions:mc-style");         soapbody soapbody = soapenvelope.getbody();         soapelement soapelement = soapbody.addchildelement("zfmaddrole", "urn");         soapelement element1 = soapelement.addchildelement("iprole");         element1.addtextnode("madu");         soapelement element2 = soapelement.addchildelement("ipuname");         element2.addtextnode("dev1");         mimeheaders headers = soapmessage.getmimeheaders();         headers.addheader("soapaction", "urn:sap-com:document:sap:soap:functions:mc-style:zws_add_role:zfmaddrolerequest");         soapmessage.savechanges();         system.out.println("----------soap request------------");         soapmessage.writeto(system.out);         return soapmessage;     }    // creating response please tell me how proper response    // getting wsdl file code response     private static void createsoapresponse(soapmessage soapresponse) throws exception {         transformerfactory transformerfactory = transformerfactory.newinstance();         transformer transformer = transformerfactory.newtransformer();         source sourcecontent = soapresponse.getsoappart().getcontent();         system.out.println("\n----------soap response-----------");         streamresult result = new streamresult(system.out);         transformer.transform(sourcecontent, result);     }      public static void main(string args[]) {         try {             soapconnectionfactory soapconnectionfactory = soapconnectionfactory.newinstance();             soapconnection soapconnection = soapconnectionfactory.createconnection();             string url = "http://sapcoe1:8080/sap/bc/srt/wsdl/srvc_40f2e9076ebd1ed69efe1708abb6241c/wsdl11/allinone/ws_policy/document?%22";             soapmessage soaprequest = createsoaprequest();             //hit soaprequest server response             soapmessage soapresponse = soapconnection.call(soaprequest, url);             createsoapresponse(soapresponse);             soapconnection.close();         } catch (exception e) {             e.printstacktrace();         }     } } 


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -