web services - How to receive Content-Type multipart/related response using java? -
i using saaj soap connection call third party web service.it seems web service have been created using wcf or c# .when invoking url using soap ui tool working fine , receiving response successfully. when tried access through below java code receiving error.
code :
public class soapclientsaajnew { 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 = "xxx"; soapmessage soapresponse = soapconnection.call(createsoaprequest(), url); // print soap response system.out.print("response soap message:"); soapresponse.writeto(system.out); soapconnection.close(); } }
error:
severe: saaj0008: bad response; cannot process message because content type 'text/xml; charset=utf-8' not expected type 'multipart/related; type="application/xop+xml"'. exception in thread "main" com.sun.xml.internal.messaging.saaj.soapexceptionimpl: com.sun.xml.internal.messaging.saaj.soapexceptionimpl: bad response: (415cannot process message because content type 'text/xml; charset=utf-8' not expected type 'multipart/related; type="application/xop+xml"'. @ com.sun.xml.internal.messaging.saaj.client.p2p.httpsoapconnection.call(httpsoapconnection.java:148) @ example.soapclientsaajnew.main(soapclientsaajnew.java:25) caused by: com.sun.xml.internal.messaging.saaj.soapexceptionimpl: bad response: (415cannot process message because content type 'text/xml; charset=utf-8' not expected type 'multipart/related; type="application/xop+xml"'. @ com.sun.xml.internal.messaging.saaj.client.p2p.httpsoapconnection.post(httpsoapconnection.java:258) @ com.sun.xml.internal.messaging.saaj.client.p2p.httpsoapconnection.call(httpsoapconnection.java:144) ... 1 more
cause:
com.sun.xml.internal.messaging.saaj.soapexceptionimpl: bad response: (415cannot process message because content type 'text/xml; charset=utf-8' not expected type 'multipart/related; type="application/xop+xml"'. @ com.sun.xml.internal.messaging.saaj.client.p2p.httpsoapconnection.post(httpsoapconnection.java:258) @ com.sun.xml.internal.messaging.saaj.client.p2p.httpsoapconnection.call(httpsoapconnection.java:144) @ example.soapclientsaajnew.main(soapclientsaajnew.java:25)
in soap ui tool in headers part see content-type receiving
http/1.1 200 ok content-length: 35512 content-type: multipart/related; type="application/xop+xml";start="<http://tempuri.org/0>";boundary="uuid:02b574c6-30b8-45f3-a9fc-5d5deac849ab+id=14";start-info="application/soap+xml" server: microsoft-iis/7.0 mime-version: 1.0 date: wed, 10 sep 2014 12:55:29 gmt
how receive content type using java ? have tried using axis also. same error message have received .
Comments
Post a Comment