4 Replies Latest reply on Oct 27, 2009 7:14 AM by kconner

    Error accessing JBossWS service via JbossESB SoapProcessor

    sagolsb

      Hi,

      i have been trying to access JBossWS service from JBossESB through the SOAPProcessor action. It works fine until I injected Spring beans to the service implementation through the WebServiceContext. When I try to access the Spring WebApplicationContext by passing the SOAPProcessorServletContext it throws the following error:

      Caused by: java.lang.UnsupportedOperationException: Not yet supported
      at org.jboss.soa.esb.actions.soap.adapter.SOAPProcessorServletContext.getAttribute(SOAPProcessorServletContext.java:45)

      It says 'not yet supported', can someone please clarify if I can't do this? Please see the following URL I posted earlier thinking it was a problem with the JBossWS.

      Thanks,
      Biramani

        • 1. Re: Error accessing JBossWS service via JbossESB SoapProcess
          sagolsb
          • 2. Re: Error accessing JBossWS service via JbossESB SoapProcess
            kconner

            Your issue is because you are attempting to use the ServletContext in an invocation which is not occurring over HTTP. There is no servlet context from which to retrieve attributes.

            If you can provide us with an example of what you are trying to achieve then we can certainly see if we can mimic this within the ESB.

            Kev

            • 3. Re: Error accessing JBossWS service via JbossESB SoapProcess
              sagolsb

              Hi Kev,

              I thought the SOAPProcessor action was simulating/making a web service request to the web service on JBossWS? I certainly get an instance of org.jboss.soa.esb.actions.soap.adapter.SOAPProcessorServletContext which is an implementation of ServletContext interface; but as you mentioned I can not retrieve attributes from it. The following is what I have been trying to do:

              1. Start the Spring WebApplicationContext when the JBossWS web application is started byt adding the following in the web.xml

              <listener>
               <listener-class>
               org.springframework.web.context.ContextLoaderListener
               </listener-class>
              </listener>


              2. Inject the WebServiceContext to the POJO service implementation through the @Resource annotation as follows:
              @Resource
               WebServiceContext context;


              3. Then get the ServletContext from it:
              ServletContext servletContext =
               (ServletContext) context.getMessageContext().get(
               MessageContext.SERVLET_CONTEXT);


              This way I can get hold of the MessageContext as well as the ServletContext.

              4. The retrieve the Spring WebApplicationContext started earlier from the ServletContext:
              servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);


              But it fails as the ServletContext doesn't have attributes registered with it, with the following error message:

              ........................
              ERROR [InvocationHandlerJAXWS] Method invocation failed with exception: null
              java.lang.reflect.InvocationTargetException
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              Caused by: java.lang.UnsupportedOperationException: Not yet supported
              at org.jboss.soa.esb.actions.soap.adapter.SOAPProcessorServletContext.getAttribute(SOAPProcessorServletContext.java:45)
              ..................................


              This works ok if I access the service directly bypassing the ESB.

              Thanks,
              Biramani


              • 4. Re: Error accessing JBossWS service via JbossESB SoapProcess
                kconner

                 

                "sagolsb" wrote:
                I thought the SOAPProcessor action was simulating/making a web service request to the web service on JBossWS?

                It is, but it does that by pretending to be coming over HTTP. There was no InVM invocation for JBossWS at the time this was written and I believe this may still be the case. In any case, any JBossWS InVM mechanism would probably suffer from the same issue as it would likely bypass the web app.

                "sagolsb" wrote:
                I certainly get an instance of org.jboss.soa.esb.actions.soap.adapter.SOAPProcessorServletContext which is an implementation of ServletContext interface; but as you mentioned I can not retrieve attributes from it.

                Sure, but this is coming from ESB and not via any web app.

                "sagolsb" wrote:
                1. Start the Spring WebApplicationContext when the JBossWS web application is started byt adding the following in the web.xml

                This is started within the context of the web application, but we have had to bypass that in order to support co-located web services.

                "sagolsb" wrote:
                4. The retrieve the Spring WebApplicationContext started earlier from the ServletContext:
                servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);


                But it fails as the ServletContext doesn't have attributes registered with it, with the following error message:

                It fails because it is not coming via the web app, and ESB knows nothing about any of the web application settings.

                "sagolsb" wrote:
                This works ok if I access the service directly bypassing the ESB.

                The web app does have that knowledge, hence it is available through that ServletContext.

                We will need to investigate this and see what is possible. Could you please create a JIRA for this feature request?

                Thanks,

                Kev