Forum Stats

  • 3,727,536 Users
  • 2,245,407 Discussions
  • 7,852,848 Comments

Discussions

Couldn't create SOAP message due to exception: XML reader error

Tanmay Sonawane
Tanmay Sonawane Member Posts: 1

Hi,

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

This discussion has been closed.