0

Iam Tanmay Sonawane I am just starting working with soap webservice, Using wsimport created a reference classes of WSDL now using those classes try to Log in but iam getting below mention exception but in my webservice log iam received the Session id. Below mention is my classes which used in login process

1) webservice -class  ie.my name in WSDL <service name="WebService">
2) WebserviceSoapPort -Interface ie. port name <port name="WebServiceSoapPort" binding="typens:WebServiceSoapBinding">

    Logonresult Sessionid;
    String sessionid="";
    WebService service=new WebService();
    WebServiceSoapPort soapPort= service.getWebServiceSoapPort();
    Logonresponsetype logOnResponce=new Logonresponsetype();
    Sessionid=soapPort.logon("tanmay", "123");
    sessionid=Sessionid.getSessionid();
    System.out.println("session id :"+sessionid);

Above code is using to invoke Login but below mentioned exception is occurred.


Exception in thread "main" com.sun.xml.internal.ws.protocol.soap.MessageCreationException: Couldn't create SOAP message due to exception: XML reader error: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
Message: Content is not allowed in prolog.
at com.sun.xml.internal.ws.encoding.SOAPBindingCodec.decode(Unknown Source)
at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.createResponsePacket(Unknown Source)
at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(Unknown Source)
at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(Unknown Source)
at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(Unknown Source)
at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Unknown Source)
at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Unknown Source)
at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Unknown Source)
at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Unknown Source)
at com.sun.xml.internal.ws.client.Stub.process(Unknown Source)
at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(Unknown Source)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(Unknown Source)
at com.sun.proxy.$Proxy39.logon(Unknown Source)
at com.tanmay.client.LogInClient.main(LogInClient.java:18)
Caused by: com.sun.xml.internal.ws.streaming.XMLStreamReaderException: XML reader error: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
Message: Content is not allowed in prolog.
at com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil.wrapException(Unknown Source)
at com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil.next(Unknown Source)
at com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil.nextContent(Unknown Source)
at com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil.nextElementContent(Unknown Source)
at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(Unknown Source)
at com.oracle.webservices.internal.impl.encoding.StreamDecoderImpl.decode(Unknown Source)
at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(Unknown Source)
at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(Unknown Source)
... 16 more
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
Message: Content is not allowed in prolog.
at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(Unknown Source)
at com.sun.xml.internal.ws.util.xml.XMLStreamReaderFilter.next(Unknown Source)
... 23 more
deadpool
  • 3
  • 1
  • 6
  • Also have a look at [How to enable logging in jax-ws](https://stackoverflow.com/a/16338394/8097737), to see what response you get. –  Dec 08 '17 at 06:44
  • Can you elaborate – deadpool Dec 08 '17 at 07:11
  • The information you provide aren't enough to help you. We only know that your program can't handle the response from the server, but we don't know if it's the fault from the server (invalid reponse) or a fault in your program. So you need to check what data the server sends. –  Dec 08 '17 at 10:44
  • If I am check my web service log then the proper request and responses is received in logs so I am not able to now that what is the exact problem . – deadpool Dec 08 '17 at 12:45
  • And I am little bit confused about the web service that the web service is compatible with java or not, Is there any way so that i can find out is compatible or not, Or is there any other way to perform these type of operation. – deadpool Dec 08 '17 at 12:49

0 Answers0