Iam Tanmay Sonawane我刚开始使用soap webservice,使用wsimport创建了一个WSDL的引用类,现在使用这些类尝试登录但是我得到以下提及异常但在我的webservice日志中我收到了Session id。
下面提到的是我在登录过程中使用的类
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