[ 
https://issues.apache.org/jira/browse/AXIS2-4662?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stephan van Hugten updated AXIS2-4662:
--------------------------------------

    Description: 
I wanted to create an application that has tight integration between Axis2 
webservices and Spring. There is already a solution presented at the Axis2 
website, http://ws.apache.org/axis2/1_5_1/spring.html, but I found that 
solution very cumbersome in my opinion and doesn't support the JSR 181 
annotations.
With my proposed approach it is possible to fully integrate the Axis2 run-time 
with a spring container, whether it is stand-alone or in a web server such as 
Tomcat. This solution also supports both the JSR 181 annotated classes and the 
regular AAR-files.

To fully integrate Axis2 with Spring I have overridden the SimpleAxis2Server 
class used by the standard stand-alone run-time. A full listing of this class 
is included in my example application.
The important stuff is in line 21 up to 36. First it determines the absolute 
path of the repository and config location parameters. Then it passes those to 
the AxisRunner constructor (lines 10 to 13) and starts the server. After it 
successfully starts the Axis2 server it returns the bean to the Spring 
Container.
After the creation of the bean it will invoke setDeployedWebservices (lines 46 
to 51) which will cycle through the passed webservice classes and deploy them 
at the created run-time. That's it! No additional configuration or packaging is 
needed. If the Spring container starts up, so does the Axis2 run-time and the 
webservices get deployed.

The needed configuration in order to integrate Axis2 is quite simple. Below is 
a complete listing of my applicationContext.xml (Spring 2.5.6):
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="namespace stuff">
  
  <bean name="axisServer" class="com.example.poc.server.AxisRunner" 
factory-method="create" scope="singleton">
        <constructor-arg value="repository" />
        <constructor-arg value="config/axis2.xml" />
        <property name="deployedWebservices">
                <props>
                        <prop key="WeatherSpringService">
com.example.poc.webservice.WeatherSpringService
</prop>
                </props>
        </property>
  </bean>

</beans>

With a little bit more effort I think it's also possible to integrate this 
solution with the Spring component scan, making it possible to annotate the 
webservice classes and the run-time with @component. I have tested my 
war-project with Tomcat 6 and Sun Webserver 7.

  was:
I wanted to create an application that has tight integration between Axis2 
webservices and Spring. There is already a solution presented at the Axis2 
website, http://ws.apache.org/axis2/1_5_1/spring.html, but I found that 
solution very cumbersome in my opinion and doesn't support the JSR 181 
annotations.
With my proposed approach it is possible to fully integrate the Axis2 run-time 
with a spring container, whether it is stand-alone or in a web server such as 
Tomcat. This solution also supports both the JSR 181 annotated classes and the 
regular AAR-files.

To fully integrate Axis2 with Spring I have overridden the SimpleAxis2Server 
class used by the standard stand-alone run-time. A full listing of this class 
is included in my example application.
The important stuff is in line 21 up to 36. First it determines the absolute 
path of the repository and config location parameters. Then it passes those to 
the AxisRunner constructor (lines 10 to 13) and starts the server. After it 
successfully starts the Axis2 server it returns the bean to the Spring 
Container.
After the creation of the bean it will invoke setDeployedWebservices (lines 46 
to 51) which will cycle through the passed webservice classes and deploy them 
at the created run-time. That's it! No additional configuration or packaging is 
needed. If the Spring container starts up, so does the Axis2 run-time and the 
webservices get deployed.

The needed configuration in order to integrate Axis2 is quite simple. Below is 
a complete listing of my applicationContext.xml (Spring 2.5.6):
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="namespace stuff">
  
  <bean name="axisServer" class="com.example.poc.server.AxisRunner" 
factory-method="create" scope="singleton">
        <constructor-arg value="repository" />
        <constructor-arg value="config/axis2.xml" />
        <property name="deployedWebservices">
                <props>
                        <prop key="WeatherSpringService">
com.example.poc.webservice.WeatherSpringService
</prop>
                </props>
        </property>
  </bean>

</beans>

With a little bit more effort I think it's also possible to integrate this 
solution with the Spring component scan, making it possible to annotate the 
webservice classes and the run-time with @component.


> Improve
> -------
>
>                 Key: AXIS2-4662
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4662
>             Project: Axis2
>          Issue Type: Improvement
>          Components: kernel
>    Affects Versions: 1.5.1
>            Reporter: Stephan van Hugten
>             Fix For: 1.5.1
>
>
> I wanted to create an application that has tight integration between Axis2 
> webservices and Spring. There is already a solution presented at the Axis2 
> website, http://ws.apache.org/axis2/1_5_1/spring.html, but I found that 
> solution very cumbersome in my opinion and doesn't support the JSR 181 
> annotations.
> With my proposed approach it is possible to fully integrate the Axis2 
> run-time with a spring container, whether it is stand-alone or in a web 
> server such as Tomcat. This solution also supports both the JSR 181 annotated 
> classes and the regular AAR-files.
> To fully integrate Axis2 with Spring I have overridden the SimpleAxis2Server 
> class used by the standard stand-alone run-time. A full listing of this class 
> is included in my example application.
> The important stuff is in line 21 up to 36. First it determines the absolute 
> path of the repository and config location parameters. Then it passes those 
> to the AxisRunner constructor (lines 10 to 13) and starts the server. After 
> it successfully starts the Axis2 server it returns the bean to the Spring 
> Container.
> After the creation of the bean it will invoke setDeployedWebservices (lines 
> 46 to 51) which will cycle through the passed webservice classes and deploy 
> them at the created run-time. That's it! No additional configuration or 
> packaging is needed. If the Spring container starts up, so does the Axis2 
> run-time and the webservices get deployed.
> The needed configuration in order to integrate Axis2 is quite simple. Below 
> is a complete listing of my applicationContext.xml (Spring 2.5.6):
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="namespace stuff">
>   
>   <bean name="axisServer" class="com.example.poc.server.AxisRunner" 
> factory-method="create" scope="singleton">
>       <constructor-arg value="repository" />
>       <constructor-arg value="config/axis2.xml" />
>       <property name="deployedWebservices">
>               <props>
>                       <prop key="WeatherSpringService">
> com.example.poc.webservice.WeatherSpringService
> </prop>
>               </props>
>       </property>
>   </bean>
> </beans>
> With a little bit more effort I think it's also possible to integrate this 
> solution with the Spring component scan, making it possible to annotate the 
> webservice classes and the run-time with @component. I have tested my 
> war-project with Tomcat 6 and Sun Webserver 7.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to