- 浏览: 81832 次
- 性别:
- 来自: 合肥
最新评论
-
cherryzhu:
...
java中用反射访问私有方法和私有成员 -
ydlccm:
您好,说缺少webservice.jar,我刚开始学习 没找到 ...
较完整的webservice例子 -
天空没有云:
错误解决了~~呵呵~不好意思啦~~是spring下的jar包和 ...
较完整的webservice例子 -
天空没有云:
信息: Loading Spring root WebAppl ...
较完整的webservice例子 -
ywl8653699:
不错,,希望你继续发这么好的文章。。顶了。。
较完整的webservice例子
看了网上有很多关于xfir + spring 开发webservice服务的例子,本人进行了总结在这里介绍一个较完整的例子:
1、 在myeclipse中新建一个web工程xfireWS,导入需要的spring和xfire支持包,
2、创建包及所需要的类文件
其中IDataService.java为服务接口类,IDataServiceImpl.java为接口实现类,TestServlet.java为测试用servlet类,IDataService.aegis.xml和IDataService.doc.xml为接口方法描述文件,名称应与接口名匹配,由xfire-aegis包支持。下面是类的具体代码:
IDataService.java
package com.ws.test;
IDataServiceImpl.java
TestServlet.java
IDataService.aegis.xml
IDataService.doc.xml
applicationContext.xml
3、web.xml文件和xfire-sevlet.xml文件,“xfire”与web.xml文件中servlet-name对应。
web.xml 内容
xfire-sevlet.xml内容
4、发布到tomcat服务器,启动服务器成功后,输入
http://localhost:8080/xfireWS/testService.ws?wsdl可以查看wsdl描述文件,
输入
http://localhost:8080/xfireWS/testService.ws/getXmlData?userName=123&pwd=123可以得到webservice服务提供的返回值,为一个xml数据,
如果输入用户名和密码错误则有错误提示。
关于web.xml文件和xfire-sevlet.xml文件的配置这里不在重述,如有疑问可以在网上找到答案。
1、 在myeclipse中新建一个web工程xfireWS,导入需要的spring和xfire支持包,
2、创建包及所需要的类文件
其中IDataService.java为服务接口类,IDataServiceImpl.java为接口实现类,TestServlet.java为测试用servlet类,IDataService.aegis.xml和IDataService.doc.xml为接口方法描述文件,名称应与接口名匹配,由xfire-aegis包支持。下面是类的具体代码:
IDataService.java
package com.ws.test;
/** * WebService服务接口 * @author zhouyang * 2009-7-16 */ public interface IDataService { /** * 从WebService服务器上获取xml数据 * @param user * @param pwd * @return String xml数据 */ public String getXmlData(String userName, String pwd); /** * 发送xml数据到WebService服务器 * @param user * @param pwd * @param xmlData 转型为byte[]类型的xml数据 * @return String 发送成功或失败信息 */ public String sendXmlData(String userName, String pwd, byte[] xmlData); }
IDataServiceImpl.java
public class DataServiceImpl implements IDataService { public String getXmlData(String userName, String pwd) { //这里给出该方法的简单实现,你可以写更复杂的业务逻辑 String xmlData = ""; if("123".equals(userName) && "123".equals(pwd)){ xmlData = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; xmlData += "<books><book>Thinking In Java</book>" + "<book>Java & Pattern</book><book>Effective Java</book></books>"; }else{ xmlData = "用户名和密码错误"; } return xmlData; } public String sendXmlData(String userName, String pwd, byte[] xmlData) { return null; } }
TestServlet.java
import java.io.IOException; import java.io.PrintWriter; import java.net.URL; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.codehaus.xfire.client.Client; /** * 通过get方式请求webservice,这里用servlet进行客户端调用处理 * */ public class TestServlet extends HttpServlet { private static final long serialVersionUID = 1L; @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String userName = req.getParameter("userName"); //用户名 String pwd = req.getParameter("pwd"); //密码 String ip = req.getLocalAddr(); int port = req.getServerPort(); String url = "http://" + ip + ":" + port + "/xfireWS/testService.ws?wsdl"; //wsdl描述文件路径 //调用客户端方法 String result =wsClient(url, "getXmlData", new Object[]{userName,pwd}); if(result.indexOf("<?xml")>=0) //设置输出格式,如果是异常信息则以html格式输出 resp.setContentType("text/xml"); else resp.setContentType("text/html"); resp.setCharacterEncoding("UTF-8"); PrintWriter out=resp.getWriter(); out.write(result); out.flush(); } /** * webservice客户端调用方法 * @param url wsdl描述文件路径 * @param methodName 服务方法名 * @param obj 服务方法参数数组 * @return String */ private String wsClient(String url, String methodName, Object[] obj) { Client client; try { client = new Client(new URL(url)); Object[] results = client.invoke(methodName, obj); return (String)results[0]; } catch (Exception e) { e.printStackTrace(); return "服务请求失败"; } } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doGet(req, resp); } }
IDataService.aegis.xml
<?xml version="1.0" encoding="UTF-8"?> <mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xfire.codehaus.org/schemas/1.0/mapping.xsd"> <mapping> <method name="getXmlData"> <parameter index="0" mappedName="userName"/> <parameter index="1" mappedName="pwd"/> <return-type mappedName="xmlData" /> </method> <method name="sendXmlData"> <parameter index="0" mappedName="userName"/> <parameter index="1" mappedName="pwd"/> <parameter index="2" mappedName="xmlData"/> <return-type mappedName="successInfo" /> </method> </mapping> </mappings>
IDataService.doc.xml
<service> <method name="getXmlData" parametersNumber="2" > <parameter index="0"> <documentation> 用户名 </documentation> </parameter> <parameter index="1"> <documentation> 密码 </documentation> </parameter> <return> <documentation> 获取的xml数据 </documentation> </return> </method> <method name="sendXmlData" parametersNumber="3" > <parameter index="0"> <documentation> 用户名 </documentation> </parameter> <parameter index="1"> <documentation> 密码 </documentation> </parameter> <parameter index="2"> <documentation> 转型为byte数组发送的xml数据 </documentation> </parameter> <return> <documentation> 发送成功或失败信息 </documentation> </return> </method> </service>
applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <bean id="dataServiceBean" class="com.ws.test.DataServiceImpl"></bean> </beans>
3、web.xml文件和xfire-sevlet.xml文件,“xfire”与web.xml文件中servlet-name对应。
web.xml 内容
<?xml version="1.0" encoding="UTF-8"?> <web-app id="starter" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>webservice demo</display-name> <!-- 配置文件路径 开始 --> <context-param> <param-name>contextConfigLocation</param-name> <param-value> classpath:applicationContext.xml classpath:org/codehaus/xfire/spring/xfire.xml </param-value> </context-param> <!-- 启动时加载SpringContextServlet --> <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> <!-- XFire 配置 --> <servlet> <servlet-name>xfire</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>xfire</servlet-name> <url-pattern>*.ws</url-pattern> </servlet-mapping> <!—测试请求的serv配置--> <servlet> <servlet-name>test</servlet-name> <servlet-class>com.ws.test.TestServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>test</servlet-name> <url-pattern>/testService.ws/getXmlData/*</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>test</servlet-name> <url-pattern>/testService.ws/sendXmlData/*</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app>
xfire-sevlet.xml内容
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="urlMap"> <map> <entry key="/testService.ws"> <ref bean="test"/> </entry> </map> </property> </bean> <bean id="test" parent="webService" class="org.codehaus.xfire.spring.remoting.XFireExporter"> <property name="serviceBean"> <ref bean="dataServiceBean"/> </property> <property name="serviceClass"> <value>com.ws.test.IDataService</value> </property> </bean> <!-- webService base --> <bean id="webService" class="org.codehaus.xfire.spring.remoting.XFireExporter" abstract="true"> <property name="serviceFactory"> <ref bean="xfire.serviceFactory" /> </property> <property name="xfire"> <ref bean="xfire" /> </property> </bean> </beans>
4、发布到tomcat服务器,启动服务器成功后,输入
http://localhost:8080/xfireWS/testService.ws?wsdl可以查看wsdl描述文件,
输入
http://localhost:8080/xfireWS/testService.ws/getXmlData?userName=123&pwd=123可以得到webservice服务提供的返回值,为一个xml数据,
如果输入用户名和密码错误则有错误提示。
关于web.xml文件和xfire-sevlet.xml文件的配置这里不在重述,如有疑问可以在网上找到答案。
评论
8 楼
ydlccm
2012-10-21
您好,说缺少webservice.jar,我刚开始学习 没找到这个包,您能提供吗?谢谢
7 楼
天空没有云
2012-08-10
错误解决了~~呵呵~不好意思啦~~是spring下的jar包和xfire下的冲突了~~楼主有没有试过显示wsdl:documentation这一个字段??为什么xsd:documentation的描述内容能显示,而wsdl:documentation就显示不了呢?
6 楼
天空没有云
2012-08-10
信息: Loading Spring root WebApplicationContext
2012-08-10-17:00:09 INFO (XmlBeanDefinitionReader.java:163) - Loading XML bean definitions from class path resource [applicationContext.xml]
2012-08-10-17:00:09 ERROR (ContextLoader.java:205) - Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Line 5 in XML document from class path resource [applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null".
org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null".
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.rootElementSpecified(XMLDTDValidator.java:1621)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDValidator.java:1900)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:764)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1359)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$ContentDriver.scanRootElementHook(XMLDocumentScannerImpl.java:1316)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3095)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:921)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:225)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:222)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:173)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:148)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:126)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:142)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:126)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:89)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:269)
at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:134)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4334)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2012-8-10 17:00:09 org.apache.catalina.core.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanDefinitionStoreException: Line 5 in XML document from class path resource [applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null".
org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null".
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.rootElementSpecified(XMLDTDValidator.java:1621)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDValidator.java:1900)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:764)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1359)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$ContentDriver.scanRootElementHook(XMLDocumentScannerImpl.java:1316)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3095)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:921)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:225)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:222)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:173)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:148)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:126)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:142)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:126)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:89)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:269)
at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:134)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4334)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2012-8-10 17:00:09 org.apache.catalina.core.StandardContext start
严重: Error listenerStart
2012-8-10 17:00:09 org.apache.catalina.core.StandardContext start
严重: Context [/xfireWS] startup failed due to previous errors
2012-8-10 17:00:09 org.apache.catalina.core.ApplicationContext log
信息: Closing Spring root WebApplicationContext
2012-8-10 17:00:09 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2012-8-10 17:00:09 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2012-8-10 17:00:09 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/47 config=null
2012-8-10 17:00:09 org.apache.catalina.startup.Catalina start
信息: Server startup in 4272 ms
楼主遇到过这个问题吗??这个例子里面wsdl:documentation显示这块是我想要的,可以讲解一下怎么实现的吗??我之前编的时候实现不了呢~不知道是不是缺少什么配置~望指点~~
2012-08-10-17:00:09 INFO (XmlBeanDefinitionReader.java:163) - Loading XML bean definitions from class path resource [applicationContext.xml]
2012-08-10-17:00:09 ERROR (ContextLoader.java:205) - Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Line 5 in XML document from class path resource [applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null".
org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null".
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.rootElementSpecified(XMLDTDValidator.java:1621)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDValidator.java:1900)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:764)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1359)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$ContentDriver.scanRootElementHook(XMLDocumentScannerImpl.java:1316)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3095)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:921)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:225)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:222)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:173)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:148)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:126)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:142)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:126)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:89)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:269)
at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:134)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4334)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2012-8-10 17:00:09 org.apache.catalina.core.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanDefinitionStoreException: Line 5 in XML document from class path resource [applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null".
org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null".
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.rootElementSpecified(XMLDTDValidator.java:1621)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDValidator.java:1900)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:764)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1359)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$ContentDriver.scanRootElementHook(XMLDocumentScannerImpl.java:1316)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3095)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:921)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:225)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:222)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:173)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:148)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:126)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:142)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:126)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:89)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:269)
at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:134)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4334)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2012-8-10 17:00:09 org.apache.catalina.core.StandardContext start
严重: Error listenerStart
2012-8-10 17:00:09 org.apache.catalina.core.StandardContext start
严重: Context [/xfireWS] startup failed due to previous errors
2012-8-10 17:00:09 org.apache.catalina.core.ApplicationContext log
信息: Closing Spring root WebApplicationContext
2012-8-10 17:00:09 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2012-8-10 17:00:09 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2012-8-10 17:00:09 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/47 config=null
2012-8-10 17:00:09 org.apache.catalina.startup.Catalina start
信息: Server startup in 4272 ms
楼主遇到过这个问题吗??这个例子里面wsdl:documentation显示这块是我想要的,可以讲解一下怎么实现的吗??我之前编的时候实现不了呢~不知道是不是缺少什么配置~望指点~~
5 楼
ywl8653699
2012-07-04
不错,,希望你继续发这么好的文章。。顶了。。
4 楼
quwufeiyang
2012-07-03
写写楼主分享,学习了。
3 楼
心灵花园2010
2012-04-11
学习一下
2 楼
yiwanxinyuefml
2012-04-06
,学习了
1 楼
liuqiuyue
2012-03-06
很好的实例
相关推荐
VS2003(Visual Studio 2003)的提及表明这些例子是在较旧的开发环境中测试过的,尽管如此,其基本原理仍然适用于现代的开发环境。 【标签】"WebService vc"表明这是用C++(Visual C++)实现的WebService示例。C++...
对比来看,WebService更适合于企业级应用,需要跨平台、跨语言的交互,且对数据完整性和一致性有较高要求的场景。而Socket更适合于低延迟、高吞吐量的应用,如在线游戏、视频聊天等。 在实际开发中,选择WebSocket...
在LIONSKY.NET压缩包中,可能包含了一个完整的示例项目,演示了如何使用客户端函数调用WebService。这个项目可能包括了生成的服务代理代码、调用服务的主程序逻辑以及任何必要的配置文件。通过查看和运行这个示例,...
【描述】中提到的"mybatis+spring+cxf webservice服务 项目框架代码例子"意味着这个压缩包包含了一个实际的项目示例,供开发者学习和参考。它可能包含了从数据库操作到Web服务接口实现的完整流程,帮助开发者理解...
在这个例子中,`HelloWorld`接口定义了一个名为`sayHello`的方法,该方法接受一个字符串参数并返回一个字符串。 ##### 2. 实现WebService接口 接下来,需要实现上面定义的接口。实现类也需要使用`@WebService`注解...
一般而言,较小的表应该放在前面,以减少整体的处理量。 #### 二十五、关于运行速度参考时间 - 查询的速度受多种因素影响,包括硬件配置、索引设计、查询复杂度等。可以通过性能分析工具来评估和优化查询性能。 ##...
这些文档对应的是CMPP的早期版本2.0.0,虽然较旧,但依然有用,因为某些系统可能还在使用。它们同样描述了模板短信的使用和CMPP协议的基本操作。 3. **UserAPI.docx**: 这可能是用户API的文档,包含了如何与移动...
相较于之前的版本,EJB3.0 在简化开发流程、提高开发效率方面有了显著的进步。 #### 二、运行环境配置 1. **下载与安装**: - 需要下载并安装 JBoss AS(Application Server),这是一个强大的应用服务器,能够...
**XMLSerializer** 是 ASP.NET 中 WebService SOAP 请求的默认序列化方式。它主要用于序列化对象的公共属性和成员,并将这些信息以 XML 的形式表示出来。这种方式易于阅读且格式统一,非常适合于跨平台的数据交换。 ...
通过一个具体的例子来说明如何利用 AD (Application Dictionary) 进行开发,包括定义新的业务对象、创建表单和页面等内容。 #### 六、库表结构及关联性 **6.1 简介** 这一章节介绍了 Openbravo ERP 中主要的数据表...
heap内存分配没有固定的规则,因此分配效率相对较低,但由于其灵活性,适用于各种复杂场景。 - **Stack(栈)**: 静态分配内存区域,用于存储局部变量等。栈遵循先进后出(LIFO)原则,内存分配和释放速度快,但空间...