2 Replies Latest reply on May 10, 2012 7:28 AM by Max Rydahl Andersen

    XMLStreamException while invoking the web service

    vamo Newbie

      I published Web Service using  JAX-WS RI 2.1.6 in JDK 6. Platform Windows 2003 Enterprise. On linux same use case working.


      After publishing the web service I am trying to invoke service using jboss-eap-5.0.0 GA as client and got the following exception.


      java.io.IOException: java.io.IOException: An established connection was aborted by the software in your host machine

      at com.sun.xml.internal.ws.server.SDDocumentImpl.writeTo(SDDocumentImpl.java:267)

      at com.sun.xml.internal.ws.transport.http.HttpAdapter.publishWSDL(HttpAdapter.java:526)

      at com.sun.xml.internal.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:218)

      at com.sun.xml.internal.ws.transport.http.server.WSHttpHandler.handleExchange(WSHttpHandler.java:95)

      at com.sun.xml.internal.ws.transport.http.server.WSHttpHandler.handle(WSHttpHandler.java:80)

      at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:65)

      at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:65)

      at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:68)

      at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:555)

      at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:65)

      at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:527)

      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

      at java.lang.Thread.run(Thread.java:662)


      Caused by: javax.xml.stream.XMLStreamException: java.io.IOException: An establis

      hed connection was aborted by the software in your host machine at com.sun.xml.internal.stream.writers.XMLStreamWriterImpl.close(XMLStreamWriterImpl.java:369)

              at com.sun.xml.internal.ws.server.SDDocumentImpl.writeTo(SDDocumentImpl.java:265)


      I disabled firewall, even after that I am getting above exception. I debugged this issue further, following are my findings   

      As service initialization started before invoking web service following things I observed


      It invoke to WSHttpHandler. This WSHttpHandler calls HttpAdapter which is registered/created when we publish the Web Service.


      The WSHttpHandler is used to return the response for the given request. Before serving request it reads the WSDL file using SDDocumentImpl.wrteTo as follows


      public void writeTo(PortAddressResolver portAddressResolver, DocumentAddressResolver resolver, XMLStreamWriter out) throws XMLStreamException, IOException {

              for (SDDocumentFilter f : owner.filters) {

                  out = f.filter(this,out);



      XMLStreamReader xsr = source.read();

              try {


                  new WSDLPatcher(owner.owner,this,portAddressResolver,resolver).bridge(xsr,out);

              } finally {





      As per my understanding the "**source.read()**" not able to read WSDL file completely or read operation is timed out. As result above exception is thrown from "bridge" method, where XML parsing is happening line by line and writing it to the **XMLStreamWriter**.


      The reason I am suspecting time out because when I am debugging issue by adding breakpoint in the the "bridge" method present in **com.sun.xml.internal.ws.util.xml.XMLStreamReaderToXMLStreamWriter** I do not get any exception.


      Also, after above execution **com.sun.xml.internal.ws.transport.http.server.WSHttpHandler. handler** again invoked and in this run I do not encounter any exception. The WSDL file has been correctly read by XMLStreamReaderToXMLStreamWriter and service at client side is initialized. And I am able to invoke the web service.


      Can any one please tell me why I am getting XMLStreamException ?