SoapUI can send soap request, java xml cannot -
i have project whereby have make soap request endpoint. using soapui, request goes quite , receive response, when use java, receive following error:
com.sun.xml.internal.messaging.saaj.client.p2p.httpsoapconnection post severe: saaj0010: unable read response java.lang.nullpointerexception
anyone know why so? here part call occurs:
inputstream = new bytearrayinputstream(message.getbytes("utf-8")); messagefactory factory = messagefactory.newinstance(); soapmessage soapmsg = factory.createmessage(null, is); soapconnectionfactory connfactory = soapconnectionfactory.newinstance(); soapconnection conn = connfactory.createconnection(); url endpoint = new url(main.soap_end_point_testing); system.out.println(endpoint); soapmessage response = conn.call(soapmsg, endpoint); //right here error thrown
the connection on plain http
try :
soapconnectionfactory soapconnectionfactory = soapconnectionfactory.newinstance(); soapconnection soapconnection = soapconnectionfactory.createconnection(); messagefactory messagefactory = messagefactory.newinstance(); soapmessage soapmessage = messagefactory.createmessage(); soappart soappart = soapmessage.getsoappart(); soapenvelope envelope = soappart.getenvelope();
you have create body here , save changes.
soapmessage.savechanges();
print request message
bytearrayoutputstream outrequest = new bytearrayoutputstream(); soapmessage.writeto(outrequest); string request=outrequest.tostring(); soapmessage soapresponse = soapconnection.call(soapmessage,url);
Comments
Post a Comment