1 Reply Latest reply on Jan 9, 2012 3:44 AM by difanders

    Error during JAXWS call with basic authentication

    difanders

      On JBoss-6.1.0.Final I get the following exception when calling a JAXWS service (hosted on another JBoss instance):

       

      Caused by: javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.

                at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:152) [:2.3.1-patch-01]

                at org.jboss.wsf.stack.cxf.client.ProviderImpl.createServiceDelegate(ProviderImpl.java:71) [:3.4.1.GA]

                at javax.xml.ws.Service.<init>(Service.java:57) [:1.0.0.Final]

                at MyService.<init>(MyServicesService.java:58) [:]

                ... 159 more

      Caused by: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.

                at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:93) [:2.3.1-patch-01]

                at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:207) [:2.3.1-patch-01]

                at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:150) [:2.3.1-patch-01]

                ... 162 more

      Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: com.ctc.wstx.exc.WstxParsingException: Unexpected close tag </body>; expected </HR>.

      at [row,col,system-id]: [1,944,"http://myhost:8280/MyServices?wsdl"]

                at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:235) [:2.3.1-patch-01]

                at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:186) [:2.3.1-patch-01]

                at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:91) [:2.3.1-patch-01]

                ... 164 more

      Caused by: com.ctc.wstx.exc.WstxParsingException: Unexpected close tag </body>; expected </HR>.

      at [row,col,system-id]: [1,944,"http://myhost:8280/MyServices?wsdl"]

                at com.ctc.wstx.sr.StreamScanner.constructWfcException(StreamScanner.java:630) [:3.2.6]

                at com.ctc.wstx.sr.StreamScanner.throwParseError(StreamScanner.java:461) [:3.2.6]

                at com.ctc.wstx.sr.BasicStreamReader.reportWrongEndElem(BasicStreamReader.java:3256) [:3.2.6]

                at com.ctc.wstx.sr.BasicStreamReader.readEndElem(BasicStreamReader.java:3198) [:3.2.6]

                at com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2830) [:3.2.6]

                at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1019) [:3.2.6]

                at org.apache.cxf.staxutils.StaxUtils.readDocElements(StaxUtils.java:998) [:2.3.1-patch-01]

                at org.apache.cxf.staxutils.StaxUtils.read(StaxUtils.java:849) [:2.3.1-patch-01]

                at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:226) [:2.3.1-patch-01]

                ... 166 more

       

      The error occurs when the web application uses basic authentication. With no authentication turned on everything works fine.

       

      This error also appeared in JIRA JBAS-8358 (https://issues.jboss.org/browse/JBAS-8358?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel) but issue seems to have been closed as it couldn't be reproduced.

       

      Any bright ideas?

        • 1. Re: Error during JAXWS call with basic authentication
          difanders

          After some further investigation I now think this problem is related to the chunked encoding that by default is enabled in Apache CXF. So I wanted to turn it off but I haven't found the exact way to do it. I tried using the JBossWS WebServiceFeature org.jboss.ws.feature.ChunkedEncodingFeature and setting it to false when I am creating the web service reference on the client. But this results in the following error:

           

          Caused by: javax.xml.ws.WebServiceException: Unknown feature error: org.jboss.ws.feature.ChunkedEncodingFeature

                    at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:100) [:2.3.1-patch-01]

                    at org.jboss.wsf.stack.cxf.client.ProviderImpl.createServiceDelegate(ProviderImpl.java:87) [:3.4.1.GA]

                    at javax.xml.ws.Service.<init>(Service.java:63) [:1.0.0.Final]

                    at javax.xml.ws.Service.create(Service.java:710) [:1.0.0.Final]

           

          I checked the code in Apache CFX and it looks like this:

           

          //new in 2.2

              public ServiceDelegate createServiceDelegate(URL wsdlDocumentLocation,

                                                           QName serviceName,

                                                           @SuppressWarnings("rawtypes") Class serviceClass,

                                                           WebServiceFeature ... features) {

                  Bus bus = BusFactory.getThreadDefaultBus();

                  for (WebServiceFeature f : features) {

                      if (!f.getClass().getName().startsWith("javax.xml.ws")) {

                          throw new WebServiceException("Unknown feature error: " + f.getClass().getName());

                      }

                  }

                  return new ServiceImpl(bus, wsdlDocumentLocation,

                                         serviceName, serviceClass, features);

           

              }

           

           

          So only features in package javax.xml.ws will pass this test and all others will generate an exception, including org.jboss.ws.feature.ChunkedEncodingFeature. This seems very odd, could anyone explain this please?

           

          Is there an alternative way to turn off chunking? Could it be done in any of the configuration files under jboss-6.1.0.Final/server/mydomain/deployers/jbossws.deployer/META-INF?

           

          rgds,

          Anders