12 Replies Latest reply on Mar 24, 2006 3:05 PM by schuller007

    use an EJB as client of a web service

    mariob

      hi folks, I've got the following problem: I want to use an EJB as client of a web service.

      what I did up to now:

      # installed jboss 4 and axis 1.1 and configured axis to work with jboss,
      checked the configuration (http://localhost:8080/axis/) and it worked

      # used axis to create a simple hello world web service and wrote a simple
      java client to check whether the web service works properly

      # implemented a hello world stateless session bean and implemented
      a java client that uses the bean

      and now it's getting difficult, I changed the session bean implementation so that the bean acts as web service client. the stuff should work as figured below:

      java client <--- RPC/IIOP ---> EJB <--- SOAP/Http ---> web service

      (a java client calls the EJB which calls the web service and returns the result from the web service call back to the java client)

      when I try to call the method of the ebj, the jboss server throws the following exeption:

      org.apache.ConfigurationException: No engine configuration file found - aborting! .... (and a really long stack trace)

      so, what to do now?

      - thanks for your answers -




        • 1. Re:  use an EJB as client of a web service

          Why not use J2EE 1.4 web services instead of trying to hack axis into the application?

          • 2. Re:  use an EJB as client of a web service
            mariob

            is there a tool for eclipse that supports me in developing web services, like the lomboz plugin, so that I do not have to write the deployment descriptor, mapping file etc. by hand?

            • 3. Re:  use an EJB as client of a web service

              Try XDoclet's wseedoclet task. It will generate deployment descriptors for J2EE web services.

              • 4. Re:  use an EJB as client of a web service
                mariob

                thanks for your answer.

                I decided to use J2EE 1.4 web services to solve my problem.
                to get familar with J2EE web services I tryed the wiki step by step example
                (http://www.jboss.org/wiki/Wiki.jsp?page=WSRPCClientStepByStep)

                here what I did:


                downloaded a wsdl-file and used wscompile to generate the classes and descriptors for a provided web service


                build a stateless session bean that provides a method to invoke one method (String getPhoneNumber(String name)) of the web service. used nearly the same implementation like the wiki example:
                 ....
                 InitialContext iniCtx = getInitialContext();
                 PhoneServiceService service =
                 (PhoneServiceService)iniCtx.
                 lookup("java:comp/env/service/ThePhoneService");
                 PhoneService endpoint = service.getPhoneService();
                 String number= endpoint.getPhoneNumber("John Doe");
                 return number;
                 ....
                



                adapted and checked the desciptors (ejb-jar.xml, mapping.xml) and deployed the bean successfully on the server


                built a simple ejb-client that calls the session bean which (should!) invoke the web service ...

                when I try to execute the ejb-client I get the following error message:
                javax.naming.NameNotFoundException: ws4ee-client not bound at org.jnp.server.NamingServer.getBinding(NamingServer.java:495) at org.jnp.server.NamingServer.getBinding(NamingServer.java:503) ....


                any suggestions what could have gone wrong?

                • 5. Re:  use an EJB as client of a web service
                  mzill

                  I have the same problem as you:


                  ... adapted and checked the desciptors (ejb-jar.xml, mapping.xml) and deployed the bean successfully on the server

                  built a simple ejb-client that calls the session bean which (should!) invoke the web service ...

                  when I try to execute the ejb-client I get the following error message:

                  javax.naming.NameNotFoundException: ws4ee-client not bound at org.jnp.server.NamingServer.getBinding
                  (NamingServer.java:495) at org.jnp.server.NamingServer.getBinding(NamingServer.java:503) ....
                  


                  I tried to get it runnning with jboss-4.0.1sp1.
                  If anyone has a solution for it plz post it. I need help!!!





                  • 6. Re:  use an EJB as client of a web service
                    hsutarwala

                    I am trying to build a client using WSDocClientStepbyStep and ran across the same error. Any help will be appreciated.
                    javax.naming.NameNotFoundException: ws4ee-client not bound at org.jnp.server.NamingServer.getBinding

                    (NamingServer.java:495) at org.jnp.server.NamingServer.getBinding(NamingServer.java:503) ....

                    • 7. Re:  use an EJB as client of a web service

                      The same here... :(

                      • 8. Re:  use an EJB as client of a web service
                        sudhakaratbits

                        I certainly dont understand y anyone from jboss is not answering this question !! Or is it answered somewhere else? I have been trying out their Wiki documentation for the last 2 weeks but i am stuck with this problem. If they give sample applications that do not work, how the heck am i supposed to proceed further!!

                        Plsssssssssssssssss, someone from jboss respond n give the solution!!

                        thanks
                        sudhakar

                        • 9. Re:  use an EJB as client of a web service
                          jeshell

                          Did anybody ever hear back on this? I was able to execute my service locally from a web component (usint the no arg constructor of InitialContext), but the second I start messing with this,

                           Properties env = new Properties();
                          
                          ...
                           env.setProperty("j2ee.clientName", "ws4ee-client");
                          ...
                           InitialContext iniCtx = new InitialContext(env);
                          


                          I get that error (ws4ee-client not bound). Of course when I comment out that setting of the j2ee.clientName, I get an exception complaining that I didn't specify the j2ee.ClientName.

                          I looked through the samples from the wiki, and every servlet and EJB that I could see was newing up an InitialContext locally.

                          When my client, even though it is in a web application, is on another machine, could that implicitly make it an "Application Client", where I would need to bring in those other two (jboss-client and application-client) xml files?

                          Thanks in advance if anybody found the answer here.

                          --Jeff

                          • 10. Re:  use an EJB as client of a web service
                            thomas.diesler

                            Have you looked at the samples that are attached to the main wiki?

                            • 11. Re:  use an EJB as client of a web service
                              pierroot

                              Well, yes I looked in the samples provided and I am sorry I was not able to find out the reason why this is not working...

                              I really would like to know how to fix this... Thank you !

                              • 12. Re:  use an EJB as client of a web service
                                schuller007

                                Anybody actually found a solution to this problem? I have been also following Anil's blog, which is BTW a far better post than the JBOSS documentation, just to end up with the same error.