Issue Details (XML | Word | Printable)

Key: SPR-371
Type: New Feature New Feature
Status: Resolved Resolved
Resolution: Won't Fix
Priority: Major Major
Assignee: Juergen Hoeller
Reporter: Tom Czarniecki
Votes: 17
Watchers: 16
Operations

If you were logged in you would be able to see more operations.
Spring Framework

Direct exposure of Spring-managed bean as Apache Axis service

Created: 05/Oct/04 05:58 PM   Updated: 04/Jan/08 06:49 AM   Resolved: 04/Jan/08 06:49 AM
Component/s: SpringREMOTING
Affects Version/s: 1.0.2, 1.1 RC1, 1.1 RC2, 1.1 final, 1.1.1
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments: 1. Text File org.apache.axis.deployment.wsdd.Provider (0.2 kB)
2. Java Source File p-BeanHandler.java (4 kB)
3. Java Source File p-SpringAxisServlet.java (11 kB)
4. Java Source File p-SpringBeanMsgProvider.java (3 kB)
5. Java Source File p-SpringBeanProvider.java (2 kB)
6. Java Source File p-SpringBeanRPCProvider.java (3 kB)
7. Java Source File p-WSDDSpringMsgProvider.java (1 kB)
8. Java Source File p-WSDDSpringRPCProvider.java (1 kB)
9. Java Source File SpringAxisServlet.java (12 kB)
10. Java Source File SpringBeanMsgProvider.java (3 kB)
11. Java Source File SpringBeanProvider.java (3 kB)
12. File SpringBeanProvider.java_jv_mod (4 kB)
13. Java Source File SpringBeanRPCProvider.java (3 kB)
14. File SpringBeanRPCProvider.java_jv_mod (5 kB)
15. Text File store-web-context-in-engine.patch (7 kB)

Environment: Apache Axis 1.1


 Description  « Hide

Currently, web services are integrated via the org.springframework.remoting.jaxrpc.ServletEndpointSupport class which requires you to know the bean names of your required dependencies. The attached code provides an alternative more Spring-centric method of dependency injection into axis web service end points.
We created a SpringAxisServlet that simply extends AxisServlet and overrides the init() and destroy() methods to initialise and destroy a Spring WebApplicationContext for the AxisServlet. We used the same pattern, and code, as found in the ContextLoaderPlugIn, so you wind up with an axis-servlet.xml configuration file that describes the Spring beans that can be used as web service end points. We then created our own SpringBeanMsgProvider and SpringBeanRPCProvider classes to handle retrieval of Spring-managed end points.



Tom Czarniecki added a comment - 05/Oct/04 06:03 PM

For integration with apache axis, have a look at the javadoc in SpringBeanRPCProvider.java and SpringBeanMsgProvider.java


Joshua Vickery added a comment - 18/Nov/04 01:34 PM

I had some trouble getting this to work, so I made some modifications.

First off, I replaced the use of SpringAxisServlet.java with the org.springframework.web.context.ContextLoaderListener from the spring api. This required a modification to SpringBeanRPCProvider.java (and will require modification of SpringBeanMsgProvider.java as well, but have not looked into that yet).

Second, I was having trouble with the the axis servlet making calls to (java.lang.String, org.apache.axis.handlers.soap.SOAPService, org.apache.axis.MessageContext) with null MessageContexts, causing the webservice to error upon deployment. I addressed this by adding <parameter name="springBeanClass" value="class.of.springBean"/> to the wsdd and extending SpringBeanRPCProvider to read this. This may not be the most elegant solution (ideally this information could be gathered from the WebApplicationContext), but I could not find a way to access the ServletContext at the time that Axis called for this information.

Thanks for the nice bits of code Mr. Czarniecki, I was trying to figure this out myself when I stumbled across this post. Thanks to the great Spring team as well, as far as I'm concerned, Axis+Spring seems to be the best way I've seen to author web services.


john menke added a comment - 18/Jan/05 10:15 PM

Joshua,

Do you have your deploy.wsdd file for the service available along with your web.xml for Axis? I'm new to Axis and i've been struggling with trying to get this to work. What would be great is if somebody posted a working example - pls pls???

-john


john menke added a comment - 21/Jan/05 03:38 PM

Joshua,

thanks for the help. I am trying to do this with Message style provider. I will let you know if i have any success. (and hopefully post a working example )

-jm


lalit jairath added a comment - 25/Jan/05 10:26 AM

Hi Joshua/ All,

Is there any full blown spring-web services tutorial available that I can put my hands on. We're trying to use Spring framework in an Enterprise Portal project.

Thanks much in advance.

lkj


john menke added a comment - 26/Jan/05 02:13 PM

I found an example of using document literal with Axis:
http://www.relevancellc.com/halloway/wsdlAndAxis/AxisSamples.html

check out the Pizza Calculator.

-jm


lalit jairath added a comment - 26/Jan/05 04:54 PM

Still looking for a full blown spring web services tutorial! Any takers? Pointers.

Thx. in advance.
lkj


Claus Ibsen added a comment - 27/Jan/05 01:39 AM

See SPR-630 where I submitted a chapter for how to use Spring Web Service.


Claus Ibsen added a comment - 27/Jan/05 01:39 AM

Also Rod's latest book covers this - "... J2EE without EJB"


Tom Czarniecki added a comment - 20/Feb/05 07:48 AM

Thanks for all your comments and support Joshua. Haven't had the time to check on this issue until now. I am curious though, we have had this solution working without any null MessageContexts for a number of months, so either we are doing something funny, or there are some more issues with axis that I am unaware of. Secondly, we wrote the axis integration in such a way so that it could co-operate nicely with a spring web application context loaded by the context listener much in the same way that Spring's own DispatcherServlet does, and in the same way that the Spring-Struts plug-in integration works. Therefore, you can have your common application services, DAOs, etc, loaded by the root web application context, and have axis specific end-points loaded by the axis integration, and still have services and DAOs injected into the endpoints. So I am not sure what the benefits are from your proposed integration model.


Alef Arendsen added a comment - 08/Mar/05 02:37 PM

I've actually implemented this somehwere late 2004 as well and didn't have the time yet to look at this. The solution I had was almost the same except for the fact that I provided a new style: SpringRPC and registered this without having to extend the AxisServlet. I can't find the code know however so I'll have to have another look at this.

I think it's best to wait with something like this until Axis 1.2 is released. 1.2 will be dificult anyway so I'm moving this to 1.3 (for which I'd really like to have a look at this).


Mads Pultz added a comment - 06/Jul/05 02:18 AM

I had a go with the code I ran into similar problems as Joshua. MsgContext is null.

Fault - ; nested exception is:
org.apache.axis.ConfigurationException: Could not find class for the service named: formRequestWS
Hint: you may need to copy your class files/tree into the right location (which depends on the servlet system you are using).; nested exception is:
java.lang.NullPointerException
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
faultSubcode:
faultString: Could not find class for the service named: formRequestWS
Hint: you may need to copy your class files/tree into the right location (which depends on the servlet system you are using).; nested exception is:
java.lang.NullPointerException
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}hostname:armstrong

Could not find class for the service named: formRequestWS
Hint: you may need to copy your class files/tree into the right location (which depends on the servlet system you are using).; nested exception is:
java.lang.NullPointerException
java.lang.NullPointerException
at com.workingmouse.webservice.axis.SpringBeanProvider.initWebAppContext(SpringBeanProvider.java:53)
at com.workingmouse.webservice.axis.SpringBeanProvider.getBean(SpringBeanProvider.java:34)
at com.workingmouse.webservice.axis.SpringBeanProvider.getBeanClass(SpringBeanProvider.java:43)
at com.workingmouse.webservice.axis.SpringBeanMsgProvider.getServiceClass(SpringBeanMsgProvider.java:64)
at org.apache.axis.providers.java.JavaProvider.initServiceDesc(JavaProvider.java:461)
at org.apache.axis.handlers.soap.SOAPService.getInitializedServiceDesc(SOAPService.java:285)
at org.apache.axis.deployment.wsdd.WSDDService.makeNewInstance(WSDDService.java:500)
at org.apache.axis.deployment.wsdd.WSDDDeployableItem.getNewInstance(WSDDDeployableItem.java:274)
at org.apache.axis.deployment.wsdd.WSDDDeployableItem.getInstance(WSDDDeployableItem.java:260)
at org.apache.axis.deployment.wsdd.WSDDDeployment.getService(WSDDDeployment.java:427)
at org.apache.axis.configuration.FileProvider.getService(FileProvider.java:231)
at org.apache.axis.AxisEngine.getService(AxisEngine.java:311)
at org.apache.axis.transport.http.AxisServlet.doGet(AxisServlet.java:295)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:66)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:162)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:479)


Tom Czarniecki added a comment - 06/Jul/05 02:34 AM

Mads,
This seems a little weird. The exception is due to a null MessageContext. I cannot tell from the AXIS API whether it is valid for this parameter to ever be null. Are you sure that you have configured the com.workingmouse.webservice.axis.SpringAxisServlet correctly.
Tom.


Mads Pultz added a comment - 06/Jul/05 03:08 AM

Hi Tom,

Maybe I got something wrong. Here is my web.xml.

<web-app>
<display-name>SpringExample</display-name>
<description>Example using Spring framework</description>

<listener>
<listener-class>org.apache.axis.transport.http.AxisHTTPSessionListener</listener-class>
</listener>

<servlet>
<servlet-name>context</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<!-- Spring remoting -->
<servlet>
<servlet-name>remoting</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>4</load-on-startup>
</servlet>

<!-- Axis -->
<servlet>
<servlet-name>axis</servlet-name>
<display-name>Apache-Axis Servlet</display-name>
<!-- <servlet-class>org.apache.axis.transport.http.AxisServlet</servlet-class>-->
<servlet-class>com.workingmouse.webservice.axis.SpringAxisServlet</servlet-class>
<!-- <load-on-startup>5</load-on-startup>-->
</servlet>

<servlet>
<servlet-name>AdminServlet</servlet-name>
<display-name>Axis Admin Servlet</display-name>
<servlet-class>org.apache.axis.transport.http.AdminServlet</servlet-class>
<load-on-startup>100</load-on-startup>
</servlet>

<!--
<servlet>
<servlet-name>SOAPMonitorService</servlet-name>
<display-name>SOAPMonitorService</display-name>
<servlet-class>org.apache.axis.monitor.SOAPMonitorService</servlet-class>
<init-param>
<param-name>SOAPMonitorPort</param-name>
<param-value>5001</param-value>
</init-param>
<load-on-startup>100</load-on-startup>
</servlet>
-->

<!-- Spring remoting -->
<servlet-mapping>
<servlet-name>remoting</servlet-name>
<url-pattern>/remoting/*</url-pattern>
</servlet-mapping>

<!-- Axis -->
<servlet-mapping>
<servlet-name>axis</servlet-name>
<url-pattern>/servlet/AxisServlet</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>axis</servlet-name>
<url-pattern>*.jws</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>axis</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>

<!--
<servlet-mapping>
<servlet-name>SOAPMonitorService</servlet-name>
<url-pattern>/SOAPMonitor</url-pattern>
</servlet-mapping>
-->

<!-- uncomment this if you want the admin servlet -->
<servlet-mapping>
<servlet-name>AdminServlet</servlet-name>
<url-pattern>/servlet/AdminServlet</url-pattern>
</servlet-mapping>

<session-config>
<!-- Default to 5 minute session timeouts -->
<session-timeout>5</session-timeout>
</session-config>

<!-- currently the W3C havent settled on a media type for WSDL;
http://www.w3.org/TR/2003/WD-wsdl12-20030303/#ietf-draft
for now we go with the basic 'it's XML' response -->
<mime-mapping>
<extension>wsdl</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>

<mime-mapping>
<extension>xsd</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>

</web-app>


Mads Pultz added a comment - 06/Jul/05 03:14 AM

By the way. I'm using jboss 3.2.7, Axis 1.2.1 and jdk 1.3.1


Joshua Vickery added a comment - 06/Jul/05 08:07 AM

I too was getting null MessageContexts

Running this on: Tomcat 4.1.30, Axis 1.1 and Sun JDK 1.3.1_02 on Linux


Tom Czarniecki added a comment - 06/Jul/05 06:35 PM

We are running this on both WindowsXP/jdk1.4.2/tomcat4.1.30 and Solaris/jdk1.4.2/SunOne7. One thing that I did note is that we are running axis (1.2beta 2107 May 19 2004) because we needed to add castor document marshalling/unmarshalling to axis. So, it may be that in axis 1.1 the MessageContext is null, but not in axis 1.2.

Here is an abridged version of our web.xml. As you can see we run a Struts/Spring integration as well as axis in the same web app, so our Spring beans are configured from a number of xml files:

  • applicationContext.xml (application DAOs and services)
  • rules-config.xml (business rule processing framework)
  • action-servlet.xml (Spring-managed struts actions - configured via the ContextLoaderPlugIn)
  • axis-servlet.xml (Spring-managed axis end points)

<?xml version="1.0"?>

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

<distributable></distributable>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml,/WEB-INF/rules-config.xml</param-value>
</context-param>

<filter>
<filter-name>hibernateSessionFilter</filter-name>
<filter-class>org.springframework.orm.hibernate.support.OpenSessionInViewFilter</filter-class>
<init-param>
<param-name>sessionFactoryBeanName</param-name>
<param-value>sessionFactory</param-value>
</init-param>
</filter>

<filter-mapping>
<filter-name>hibernateSessionFilter</filter-name>
<servlet-name>action</servlet-name>
</filter-mapping>

<filter-mapping>
<filter-name>hibernateSessionFilter</filter-name>
<servlet-name>axis</servlet-name>
</filter-mapping>

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>1</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>1</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet>
<servlet-name>axis</servlet-name>
<display-name>Apache-Axis Servlet</display-name>
<servlet-class>com.workingmouse.webservice.axis.SpringAxisServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>axis</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>

<session-config>
<session-timeout>20</session-timeout>
</session-config>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/error.jsp</location>
</error-page>

<error-page>
<error-code>400</error-code>
<location>/error404.jsp</location>
</error-page>

<error-page>
<error-code>404</error-code>
<location>/error404.jsp</location>
</error-page>

<taglib>
<taglib-uri>http://jakarta.apache.org/struts/tags-tiles</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-tiles.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
<taglib-location>/WEB-INF/tld/fmt.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/tld/c.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>http://jakarta.apache.org/struts/tags-html</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-html.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>http://jakarta.apache.org/struts/tags-bean</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-bean.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>http://jakarta.apache.org/struts/tags-logic</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-logic.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>http://jakarta.apache.org/struts/tags-bean-el</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-bean-el.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>http://jakarta.apache.org/struts/tags-html-el</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-html-el.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>http://jakarta.apache.org/taglibs/string-1.0.1</taglib-uri>
<taglib-location>/WEB-INF/tld/taglibs-string.tld</taglib-location>
</taglib>

<resource-ref>
<description></description>
<res-ref-name>jdbc/dsa</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

<resource-ref>
<description></description>
<res-ref-name>jdbc/dsb</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

<resource-ref>
<description></description>
<res-ref-name>jdbc/dsc</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

<resource-ref>
<description></description>
<res-ref-name>jdbc/dse</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

<resource-ref>
<description></description>
<res-ref-name>mail/MailSession</res-ref-name>
<res-type>javax.mail.Session</res-type>
<res-auth>Container</res-auth>
</resource-ref>

</web-app>


Tom Czarniecki added a comment - 06/Jul/05 06:42 PM

D'oh. Just spotted that you are using axis 1.2.1 Mads.
Maybe its not that then. Perhaps its our customization of axis to allow us to use castor - will have to look at that when I get some time.


king added a comment - 28/Aug/05 02:35 AM

Tom, what ever I used, axis1.1rc2, axis1.2rc2 and axis1.2.1,the result is the same as Mads, null MessageContexts.
I am using Tomcat 5.0.28, jdk 1.5, windows 2000.


king added a comment - 28/Aug/05 02:38 AM

here is my web.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/springapp-servlet.xml</param-value>
</context-param>

<servlet>
<servlet-name>springapp</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<!-- Axis -->
<servlet>
<servlet-name>axis</servlet-name>
<display-name>Apache-Axis Servlet</display-name>
<servlet-class>com.workingmouse.webservice.axis.SpringAxisServlet</servlet-class>
</servlet>

<!-- Axis -->
<servlet-mapping>
<servlet-name>axis</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>springapp</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file>
index.jsp
</welcome-file>
</welcome-file-list>
<display-name>BugTracking</display-name>

<!-- currently the W3C havent settled on a media type for WSDL;
http://www.w3.org/TR/2003/WD-wsdl12-20030303/#ietf-draft
for now we go with the basic 'it's XML' response -->
<mime-mapping>
<extension>wsdl</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>

<mime-mapping>
<extension>xsd</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
</web-app>


Douglas Hubler added a comment - 28/Oct/05 10:46 PM

I tried the orginal java files (unmodified) and all worked!

  • Handler: SpringBeanRPCProvider
  • Axis 1.3 w/default xml serializers (org.apache.axis.encoding.ser.BeanDeserializerFactory)
  • Spring 1.2.3
  • web.xml as Tom orginally posted except
    o replace org.apache.axis.transport.http.AxisServlet
    o with com.workingmouse.webservice.axis.SpringAxisServlet

Tom, is there a copyright and/or license to these source files? I need to check them into my subversion repository (http://scm.sipfoundry.org/rep/sipX) until Spring accepts them.

THANKS!!!


Douglas Hubler added a comment - 02/Nov/05 05:17 PM

I finally got the NullPointer exception, however the _mod files caused me more grief related to NullPointers with ParameterDesc.getJavaType deep inside Axis so I just changed this one line

Instead made the following edit to SpringBeanProvider.java:53
if (webAppCtx == null && msgContext != null) {


Tom Czarniecki added a comment - 02/Nov/05 09:34 PM

Douglas:
1. License - we developed this code for a private client initially, but then decided to give something back to the Spring community. So I'd reckon this stuff should be licensed under BSD or something like it - all care but no responsibility. Go ahead and add it to your repository. We did
2. Bloody NPE - we still use the castor integration and don't see it, so it must be something with that. Haven't had time to look at this - been on holidays - code Vs Santorini - no contest.


Douglas Hubler added a comment - 08/Nov/05 10:54 PM

I was getting the NullPointers when no SOAP message is posted. This happens when ?wsdl is accessed or when opening raw service URL with web browser (which is of little importance)

I refactored code original code posted to store WebApplicationContext in the Axis Engine session. All works now. ServletContext would have been better, unfort. I couldn't get that to work in all cases for me.

Code also available here:
http://scm.sipfoundry.org/rep/sipX/main/sipXconfig/web/src/com/workingmouse/webservice/axis/


Todd Orr added a comment - 16/Dec/05 08:55 PM

This may be a dumb comment, but the wsdd config for using this stuff is not clear. My settings:

<service name="UserService" provider="java:RPC">
<parameter name="allowedMethods" value="loginUser"/>
<parameter name="className" value="foo.bar.UserWebService"/>
</service>

result in the following exception:

18:28:24,395 WARN [Types] The class foo.bar.svc.IUserServiceInternal does not contain a default constructor, which is a requirement for a bean class. The class cannot be converted into an xml schema type. An xml schema anyType will be used to define this class in the wsdl file.

and a subsequent null pointer.

This means that the implementation class of the interface is never injected into the UserWebService and that the public setter for the implementation is being exposed since it is trying to convert the interface that has been specified as an argument in my setter. Please include some sort of documentation on this feature for fools like me.


Peter Triller added a comment - 03/Jan/06 12:21 PM

Fileset of classes that Registers SpringRPC and SpringMsg as new providers


Peter Triller added a comment - 03/Jan/06 12:21 PM

Fileset of classes that Registers SpringRPC and SpringMsg as new providers


Peter Triller added a comment - 03/Jan/06 12:21 PM

Fileset of classes that Registers SpringRPC and SpringMsg as new providers


Peter Triller added a comment - 03/Jan/06 12:30 PM

I commited a new class fileset. This Adds Spring configurability to Axis through the commons-discovery plugin mechanism provided by Axis.

If theese classes are in the classpath and the: org.apache.axis.deployment.wsdd.Provider file can be found in the classpath in /META-INF/services then a Spring managed Service can be added as

<service name="PingPong" provider="java:SpringRPC">
<parameter name="springBean" value="wsPingPong"/>
</service>

or

<service name="PingPong" provider="java:SpringMsg">
<parameter name="springBean" value="wsPingPong"/>
</service>

The advantage of this Type of injection is that I requires no setup from the user at all, just putting the
spring-axis.jar into the classpath is enough to make this work.

I also uploaded A BeanHandler class. This class is to create Spring configured Handlers for axis
This class enables to register Spring Beans as Handlers.

Usage is

<handler name="BeanAuthenticate" type="java:com.workingmouse.webservice.axis.BeanHandler">
<parameter name="beanId" value="axisAuthHandler"/>
</handler>

This class is still a little crude and needs some proper Error Handling added, but It works

My naming of parameters is a little inconsistent right now, and some code still needs to be
cleaned up.
Some of the code still needs to be cleaned up and some proper error handling needs to be added, but
other than that it works pretty well


Christopher Sahnwaldt added a comment - 24/Jul/06 04:01 PM

Here's another way. It gets rid of server-config.wsdd, keeps the whole configuration in Spring, deploys and undeploys any bean directly as an Axis service (including ?wsdl generation), and needs no class path magic. I created an issue in Axis JIRA because the problem how to publish any object (not just a class) as a web service is not Spring specific, and neither is this solution.

http://issues.apache.org/jira/browse/AXIS-2530


Tom Czarniecki added a comment - 18/Apr/07 12:10 AM

The folks at sipX seem to have found a new solution to the NPE bug - take a look at http://scm.sipfoundry.org/viewsvn/sipX/main/sipXconfig/web/src/com/workingmouse/webservice/axis/


Juergen Hoeller added a comment - 04/Jan/08 06:49 AM

As of Spring 2.5, there are no plans for special integration with Axis 1 anymore, so I'm closing this issue now.

Juergen