14 Replies Latest reply: Oct 17, 2011 9:07 AM by Steve Cohen RSS

    WebServiceContext proxy

    Heiko Braun Master

      Recent discussions showed that beans should have a WebServiceContext proxy injected before they become method ready, which in turn delegates to a ThreadLocal or throws an IllegalArgumentException if the context is not set.

        • 2. Re: WebServiceContext proxy
          Heiko Braun Master

          I've added the proxy to ejb3/core:

          
          package org.jboss.injection;
          
          /**
           * WebServiceContext proxy that delegates to a ThreadLocal.
           *
           */
          public class WebServiceContextProxy implements WebServiceContext
          {
          [...]
          }
          


          Can someone make sure the injection happens?

          • 3. Re: WebServiceContext proxy
            Carlo de Wolf Master

            WebServiceContextProxy doesn't compile with JDK 6:

            /home/carlo/work/ejb3/core/src/main/java/org/jboss/injection/WebServiceContextProxy.java:[67,23] cannot find symbol
            symbol : method getEndpointReference(org.w3c.dom.Element[])
            location: interface javax.xml.ws.WebServiceContext

            /home/carlo/work/ejb3/core/src/main/java/org/jboss/injection/WebServiceContextProxy.java:[72,23] cannot find symbol
            symbol : method getEndpointReference(java.lang.Class,org.w3c.dom.Element[])
            location: interface javax.xml.ws.WebServiceContext

            Not a showstopper, just a bummer. For the moment I'm going to switch to 5, but I want to have a resolution in the works.

            • 4. Re: WebServiceContext proxy
              Carlo de Wolf Master

              Note that it's mandatory to throw an IllegalStateException if the method is called while no request is being serviced:
              http://java.sun.com/javase/6/docs/api/javax/xml/ws/WebServiceContext.html#getMessageContext()

              • 5. Re: WebServiceContext proxy
                Heiko Braun Master

                I've changed it to an IllegalStateException

                • 6. Getting EJBTHREE-1337 in JBoss 5.0.0.GA with each web servic
                  Carsten Wolters Newbie

                  I get the warning

                  [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected


                  with each call to a deployed web service. I'm running JBoss 5.0.0.GA with JDK6.

                  The Web Service is defined with these annotations:
                  @Stateless
                  @Remote(QuoteEndpoint.class)
                  @TransactionAttribute(TransactionAttributeType.REQUIRED)
                  @WebService(serviceName = "QuoteService", endpointInterface = "services.endpoints.QuoteEndpoint")
                  @Interceptors( { LoginEndpointInterceptor.class })
                  public class QuoteEndpointImpl extends AbstractSessionBeanImpl implements QuoteEndpoint {
                  
                   @Resource
                   public SessionContext sessionContext;
                  ...}


                  and the webservice interface:
                  @WebService
                  public interface QuoteEndpoint {
                   @WebMethod
                   EquityDTO[] getSubscriptions();
                  
                   @WebMethod
                   CustomSymbolDTO[] getCustomSymbols();
                  
                   @WebMethod
                   void receiveQuotes(QuoteDTO[] quotes);
                  
                   @WebMethod
                   void receiveEquityMappings(equityMappingDTO[] equityMappingDTOs);
                  }


                  Is something wrong with this code? Can I ignore the warning?

                  Please remove the warning from the log if unnecessary.

                  • 7. Re: Getting EJBTHREE-1337 in JBoss 5.0.0.GA with each web se
                    Augusto Cesar Lima Newbie

                     

                    "cwolters" wrote:
                    I get the warning

                    [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected


                    with each call to a deployed web service. I'm running JBoss 5.0.0.GA with JDK6.

                    The Web Service is defined with these annotations:
                    @Stateless
                    @Remote(QuoteEndpoint.class)
                    @TransactionAttribute(TransactionAttributeType.REQUIRED)
                    @WebService(serviceName = "QuoteService", endpointInterface = "services.endpoints.QuoteEndpoint")
                    @Interceptors( { LoginEndpointInterceptor.class })
                    public class QuoteEndpointImpl extends AbstractSessionBeanImpl implements QuoteEndpoint {
                    
                     @Resource
                     public SessionContext sessionContext;
                    ...}


                    and the webservice interface:
                    @WebService
                    public interface QuoteEndpoint {
                     @WebMethod
                     EquityDTO[] getSubscriptions();
                    
                     @WebMethod
                     CustomSymbolDTO[] getCustomSymbols();
                    
                     @WebMethod
                     void receiveQuotes(QuoteDTO[] quotes);
                    
                     @WebMethod
                     void receiveEquityMappings(equityMappingDTO[] equityMappingDTOs);
                    }


                    Is something wrong with this code? Can I ignore the warning?

                    Please remove the warning from the log if unnecessary.


                    Hi guys, I just came up with the same problem, is there any solution for this warning ? Why is it happening ? Although the code works I don't want to leave it that way. Please help me.
                    Thanks

                    • 8. Re: WebServiceContext proxy
                      Bogus Exception Newbie

                      Me, too...

                      This:

                      @Stateless
                      @Remote(HelloWorld.class)
                      @WebService(targetNamespace = "http://ejb.me.org", name = "HelloWorld", serviceName = "HelloWorldService")
                      @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = Use.LITERAL, parameterStyle = ParameterStyle.WRAPPED)
                      public class HelloWorldBean implements HelloWorld {
                      [...]


                      ...yields...

                      12:53:39,374 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected
                      12:53:39,382 WARN [InterceptorsFactory] EJBTHREE-1246: Do not use InterceptorsFactory with a ManagedObjectAdvisor, InterceptorRegistry should be used via the bean container
                      12:53:39,383 WARN [InterceptorsFactory] EJBTHREE-1246: Do not use InterceptorsFactory with a ManagedObjectAdvisor, InterceptorRegistry should be used via the bean container
                      12:53:39,418 INFO [HelloWorldBean] in sayHello
                      12:53:39,419 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected


                      The web service doesn't seem to be affected, but I am unable to figure out why it is carping... Do we have to comb through the jboss source? Is jboss saying I shouldn't use @WebService?

                      pat
                      :)

                      • 9. Re: WebServiceContext proxy
                        jaikiran pai Master

                         

                        "BogusException" wrote:

                        The web service doesn't seem to be affected, but I am unable to figure out why it is carping... Do we have to comb through the jboss source? Is jboss saying I shouldn't use @WebService?

                        pat
                        :)


                        Pat, for now ignore this message. That message isn't applicable to the end users (i.e. bean/webservice application developers). We'll fix it appropriately.


                        • 10. Re: WebServiceContext proxy
                          Ulrich Romahn Newbie

                           

                          That message isn't applicable to the end users (i.e. bean/webservice application developers). We'll fix it appropriately.


                          Since I am seeing the exact same "Warning" in 5.1.0.GA, when are you guys either suppress this warning or fix it once and forever.

                          Also, is there an ETA for this "fix"?

                          Thanks!

                          • 11. Re: WebServiceContext proxy
                            jaikiran pai Master

                             

                            when are you guys either suppress this warning or fix it once and forever.

                            Thanks for reminding me about this. Here's the issue for tracking this https://jira.jboss.org/jira/browse/EJBTHREE-1847

                            Also, is there an ETA for this "fix"?


                            Since we have a frequent release cycle http://www.jboss.org/ejb3.html you should be able to get this fix soon.

                            • 12. Re: WebServiceContext proxy
                              Steve Cohen Newbie

                              Guess not, I am still seeing it in 5.1.0-GA.  Workarounds?

                              • 13. Re: WebServiceContext proxy
                                Richard Opalka Master

                                How about AS 6.1.0.GA ?

                                • 14. Re: WebServiceContext proxy
                                  Steve Cohen Newbie

                                  As I stated in the other thread, corporate policies prohibit me from using 6.x.x though 7.x.x. may possibly become possible before I have to deploy this thing.  There is a workaround involving logrj configuration which is not ideal but better than seeing these stupid warnings every time the Web Service is invoked:

                                   

                                    <!-- Suppress EJBTHREE-1337 warning -->

                                    <category name="org.jboss.ejb3.stateless.StatelessBeanContext">

                                      <priority value="ERROR"/>

                                    </category>