1 Reply Latest reply on Sep 4, 2002 6:32 AM by eldestroyer

    Web Service accessed from an EJB (how do I do that?)

    eldestroyer

      Hi I have a EJB Web services that is racking my brain.

      I have web service that was generated with G-Soap. It's 1.1 Soap stuff.

      I want to access this within an EJB so that an applet can make use of it and we can track the session.

      I don't know how to go about accessing this g-soap web service from an EJB.

      Can anyone help?

      I read an article by Monson-Hafel on EJB2.1 that he listed on :
      http://www.theserverside.com/resources/articles/MonsonHaefel-Column2/article.html

      It explained how to achieve what I want to do. I got stuck in the part that deals with binding the generated interface and stub of the client to the JNDI ENC. I tried adding resource references in both the jboss.xml and ejb-jar.xml files. This gave me some problems.

      The code to my problem may be found at:
      http://wwwhni.uni-paderborn.de/~ricardo/src.zip
      the associated jar with descriptors and all is at:
      http://wwwhni.uni-paderborn.de/~ricardo/HelloWorld.jar

      NOTE that all I was trying to do with my code is make sure that I could see the attached Web Service in the JNDI ENC.

      Please help me.

        • 1. Re: Web Service accessed from an EJB (how do I do that?)
          eldestroyer

          Okay, I solved my problem.

          I think perhaps no one tried to help because the answer was too obvious. But for those of you that are struggling with imbedded Web Services in an EJB here's what you have to do.

          First of all ignore the article that I suggested in my previous post. For your reference this article is:
          http://www.theserverside.com/resources/articles/MonsonHaefel-Column2/article.html (igonore it).

          The article deals with EJB 2.1 the final draft of this new standard has not been finished and EJB servers/containers are just working out the details now.

          All you have to do is access the Web Service through EJB. But, you need to make sure that you have added the library that includes the stubs and skeletons of your Web Service in the lib directory of the correct deployment area in JBoss. Also keep in mind that the EJB runs in a different Virtual Machine to your client. Thererfor you need a way of catching the exceptions and printing them to the console. I passed a string back the client and printed this string.

          That's it, once you have everything in place your set.

          If you are doing something similar don't hesitate to ask in this forum.

          Bye