hi,Sagara
first , my web site is working.
1. Spring Bean
public interface IDataSetEnquiryManager {
public String getValue();
}
public class DataSetEnquiryManagerImpl implements IDataSetEnquiryManager {
public String getValue(){
return "TEST";
}
}
applicationContext.xml is:
<bean id="DataSetServiceEnquiry"
class="com.eadi.ws.DataSetServiceEnquiry">
<property name="dataSetEnquiryManager">
<ref bean="dataSetEnquiryManager" />
</property>
</bean>
<bean id="dataSetEnquiryManager"
class="com.eadi.service.impl.DataSetEnquiryManagerImpl">
</bean>
2. web service class,
DataSetServiceEnquiry.java :
package com.eadi.ws;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMText;
import com.eadi.service.IDataSetEnquiryManager;
public class DataSetServiceEnquiry {
private IDataSetEnquiryManager dataSetEnquiryManager = null;
public IDataSetEnquiryManager getDataSetEnquiryManager() {
return dataSetEnquiryManager;
}
public void setDataSetEnquiryManager(
IDataSetEnquiryManager dataSetEnquiryManager) {
this.dataSetEnquiryManager = dataSetEnquiryManager;
}
// The web service
public OMElement getValue(OMElement ignore) {
OMFactory factory=OMAbstractFactory.getOMFactory();
OMNamespace payloadNs=
factory.createOMNamespace("http://ws.eadi.com/datasetenquiry",
"datasetenquiry");
OMElement payload =factory.createOMElement("string", payloadNs);
OMText response =
factory.createOMText(this.dataSetEnquiryManager.getValue());
payload.addChild(response);
return payload;
}
}
3. add services.xml to /mysite/META-INF/services.xml
<serviceGroup>
<service name="DataSetServiceEnquiry">
<description>
simple spring example
</description>
<parameter
name="ServiceObjectSupplier">org.apache.axis2.extensions.spring.receivers.SpringServletContextObjectSupplier</parameter>
<parameter name="SpringBeanName">dataSetServiceEnquiry</parameter>
<operation name="getValue">
<messageReceiver
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
</operation>
</service>
</serviceGroup>
4. open url in browser :
http://localhost:8080/EADIWeb/services/DataSetServiceEnquiry?wsdl
and got error result:
11:09:14,877 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
javax.servlet.ServletException: File
"/axis2-web/listSingleService.jsp" not found
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
at
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:557)
at
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:481)
at
org.apache.axis2.transport.http.AbstractAgent.renderView(AbstractAgent.java:121)
at
org.apache.axis2.transport.http.ListingAgent.processListService(ListingAgent.java:407)
at
org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:242)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.eadi.web.bean.SessionFilter.doFilter(SessionFilter.java:98)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
at java.lang.Thread.run(Thread.java:595)
11:09:14,877 INFO [STDOUT] 2009-07-29 11:09:14,877 INFO
[org.apache.axis2.transport.http.AbstractAgent] - Old Servlet API
:javax.servlet.ServletException: File
"/axis2-web/listSingleService.jsp" not found
2009/7/29 Sagara Gunathunga <[email protected]>:
> AFAIK there is no any restriction with Spring 2.5 or any other version
> , i don't think you will encounter any version problem. As i remember
> i have used Spring 2.5.6 without any problems, so you better to try
> out first and write back to the list if you get any issue.
>
> Thanks ,
>
> On Wed, Jul 29, 2009 at 6:57 AM, sam wong<[email protected]> wrote:
>> hi,Sagara,
>>
>> I found this in the sample page :Spring versions 1.2.6, 1.2.8 and 2.0
>> have been tested, but probably any version would work as only the core
>> functionality is required.
>>
>> I am using spring 2.5,
>> current axis2 version is not support spring 2.5 ?
>>
>>
>>
>> Best & Regards,
>> Sam Wong
>>
>>
>>
>>
>>
>> 2009/7/29 Sagara Gunathunga <[email protected]>:
>>> Hi ,
>>> You can write your functions with Spring/Hibernate as usual and then
>>> possible to expose your Spring services ( a bean) as a web service
>>> using Axis2 -Spring integration.
>>>
>>> Basically you have to do following two steps.
>>>
>>> 1.) Like in any other web framework define the Spring
>>> ContextLoaderListener in the web.xml file in order to load the Spring
>>> ApplicationContext.
>>>
>>> 2.) Define SpringServletContextObjectSupplier as the
>>> ServiceObjectSupplier for your web service , you can define this in
>>> the axis2 service.xml file.
>>>
>>> please refer[1] for details and code samples.
>>>
>>> [1] - http://ws.apache.org/axis2/1_5/spring.html
>>>
>>> Thanks ,
>>>
>>> On Tue, Jul 28, 2009 at 11:16 PM, sam wong<[email protected]> wrote:
>>>> hi, everybody,
>>>>
>>>> I hava a web project writing with Spring2.5+Hibernate
>>>> some function need publish as WebService.
>>>> I want to use Axis2 to impletment this.
>>>>
>>>>
>>>> anybody can give me some Tutorial about this?
>>>>
>>>>
>>>>
>>>> thanks a lot..
>>>>
>>>>
>>>>
>>>> Sam Wong.
>>>>
>>>
>>>
>>>
>>> --
>>> Sagara Gunathunga
>>>
>>> Blog - http://ssagara.blogspot.com
>>> Web - http://sagaras.awardspace.com/
>>>
>>
>
>
>
> --
> Sagara Gunathunga
>
> Blog - http://ssagara.blogspot.com
> Web - http://sagaras.awardspace.com/
>