#5 Programming Question: Webservice

closed
nobody
None
5
2008-01-16
2008-01-16
mweiss
No

Hi,

first thing to say is that I really like this application.

But I have the following problem. I'd like to submit E-Mails from a publich folder directly into JTrac! Therefore I would like to implement a webservice which receives the necessary data (mailfrom, subject, message, mailto...) and which creates the objects for me.

Planned operations:

- Look if user (mailfrom) exists and if not create
- Look for the space in which to create (configuration file mailto <-> space)
- Create item for that user in that space with the mail data (maybe also with attachment)
- Store item and only as nice to have: enable mail notification for specified users in a role for this space (e.g. project admin)

For this implemenation i followed the developers guide and used netbeans as IDE. For deployment I'd like to use GlassFish V2. Therefore I had to rename the version.properties file and changed the Code and build File for this (because GlassFish has also a version.properties file in its classpath)! For the webservice implementation I had to edit some parts in the ant script and after some problems I got it running and can call a sample webservice method like HelloWorld.

So, now my problem:

I don't know how to get the JTrac interface in my webservice in order to use the functions for finding the users...

You use the ComponentUtils method getJTrac from the wickets, but the webservice class has nothing to do with the wickets!

Maybe you can give me a hint how to do that ???????

Discussion

  • Peter Thomas
    Peter Thomas
    2008-01-16

    Logged In: YES
    user_id=523749
    Originator: NO

    Is your webservice deployed in the same WAR? Then you can do something like this using the Spring WebApplicationContextUtils just like in JtracApplication

    ServletContext sc = getServletContext();
    applicationContext = WebApplicationContextUtils.getWebApplicationContext(sc);
    Jtrac jtrac = (Jtrac) applicationContext.getBean("jtrac");

     
  • mweiss
    mweiss
    2008-01-16

    Logged In: YES
    user_id=1982872
    Originator: YES

    Thx for the super quick answer! I use JAX-WS with just the annotation @WebService in a normal Class. So I did not have the Servlet Context!

    But I found some interesting information on the spring homepage (http://static.springframework.org/spring/docs/2.5.x/reference/remoting.html) Chapter 17.5.5. But this is only for Spring 2.5.x. I've tested this solution a little bit, but so far without success. But I'll try a little bit more! As far as I understand I just have to implement @Autowired private Jtrac jtrac; !

     
  • mweiss
    mweiss
    2008-01-16

    • status: open --> closed
     
  • mweiss
    mweiss
    2008-01-16

    Logged In: YES
    user_id=1982872
    Originator: YES

    OK, I managed to get it working with the spring solution. After also deploying the 2.5.x Jars this solution works fine.

    Thx for your answer.