Announcement Announcement Module
No announcement yet.
bean exposure as web service Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • bean exposure as web service

    I'm just looking at web services (seriously) for the first time. Is there a way, like the spring jmx support, that you could expose a bean in spring as a webservice without any extra work?

    For example, this is how I expose some beans currently,
    <bean id="jmxAdapter"
    <property name="beans">
    <entry key="myDomain:Name=myBean">
    <ref bean="myBeanRef" />

    Could something similar be written to expose that bean as a service? Am I barking up the wrong tree completely?

  • #2
    I haven't seen this in Spring where you could expose it in the XML file.

    However Axis integration is pretty easy as your exposed bean can be delegated from a class that extends ServletEndpointSupport.

    But I guess there is a JIRA somewhere where someone has posted a solution or request for this feature in the Spring core.

    Let us know if you find such a JIRA and post the link here.


    • #3
      what are your service clients like? Are they running in the same jvm, are they running remotely ... are they written in different language?

      I've had success implementing PHP, PEAR, and XML_RPC as a client-side consumer, using the Apache XML-RPC library on the server side, mapping all /xmlrpc/* requests through the DispatcherServlet to my XmlRpcServer extension. This way any Bean or Service I want to expose through Spring is available.


      • #4

        My clients will be running remotely, ideally i'd like to have the same kind of entry in the xml file and perhaps use xfire to expose the bean. I'm thinkng out loud here, but I'll take a look over the weekend and see it it is possible to repeat the JMX pattern.


        • #5
          interesting link

          Not quite what i had in mind - but this shows how easy it is using the current method


          • #6
            Re: interesting link

            Originally posted by analogueboy
            Not quite what i had in mind - but this shows how easy it is using the current method

            Isn't the example in the Spring reference .pdf more simple? Just extending a special support class and you'll have access to Spring Bean Factory? Of course the Axis integration is the same as the link above where you can register the class using server-deploy.wsdd.

            I'm using this approach at a project at work. Both exposing a service and consuming a service. All using Spring and Axis in two seperate apps. One in Tomcat and one as a standalone java main app.


            • #7
              already implemented

              For the sake of completeness, this has been included in 1.2RC1, not sure who implemented it tho...