这几天在做一个移动应用程序的服务器端,用的是xfire+spring+struts2+hibernate。
项目部署后,发现无法访问发布的webservice的wsdl。
控制台输出:
[DEBUG 级别] org.codehaus.xfire.service.documentation.XMLDocumentationBuilder 类 (150 行) - Searching for Hello.doc.xml config..
[DEBUG 级别] org.codehaus.xfire.service.documentation.XMLDocumentationBuilder 类 (153 行) - Config Hello.doc.xml NOT found.
[DEBUG 级别] org.codehaus.xfire.aegis.XMLClassMetaInfoManager 类 (42 行) - Mapping file : /com/ruanko/jobAssistant/util/Hello.aegis.xml not found.
[DEBUG 级别] org.codehaus.xfire.aegis.XMLClassMetaInfoManager 类 (42 行) - Mapping file : /com/ruanko/jobAssistant/util/Hello.aegis.xml not found.
[DEBUG 级别] org.codehaus.xfire.aegis.XMLClassMetaInfoManager 类 (42 行) - Mapping file : /java/lang/String.aegis.xml not found.
[DEBUG 级别] org.codehaus.xfire.aegis.XMLClassMetaInfoManager 类 (42 行) - Mapping file : /com/ruanko/jobAssistant/util/Hello.aegis.xml not found.
[DEBUG 级别] org.codehaus.xfire.aegis.XMLClassMetaInfoManager 类 (42 行) - Mapping file : /com/ruanko/jobAssistant/util/Hello.aegis.xml not found.
[DEBUG 级别] org.codehaus.xfire.aegis.XMLClassMetaInfoManager 类 (42 行) - Mapping file : /java/lang/String.aegis.xml not found.
[DEBUG 级别] org.codehaus.xfire.aegis.XMLClassMetaInfoManager 类 (42 行) - Mapping file : /com/ruanko/jobAssistant/util/Hello.aegis.xml not found.
[DEBUG 级别] org.codehaus.xfire.aegis.XMLClassMetaInfoManager 类 (42 行) - Mapping file : /java/lang/String.aegis.xml not found.
[DEBUG 级别] org.codehaus.xfire.aegis.XMLClassMetaInfoManager 类 (42 行) - Mapping file : /com/ruanko/jobAssistant/util/Hello.aegis.xml not found.
[DEBUG 级别] org.codehaus.xfire.aegis.XMLClassMetaInfoManager 类 (42 行) - Mapping file : /java/lang/String.aegis.xml not found.
[INFO 级别] org.codehaus.xfire.spring.ServiceBean 类 (190 行) - Exposing service with name {http://util.jobAssistant.ruanko.com}Hello
[DEBUG 级别] org.codehaus.xfire.transport.DefaultTransportManager 类 (77 行) - Registered transport org.codehaus.xfire.transport.http.XFireServletTransport@137e670
[INFO 级别] com.opensymphony.xwork2.config.providers.XmlConfigurationProvider 类 (31 行) - Parsing configuration file [struts-default.xml]
[INFO 级别] com.opensymphony.xwork2.config.providers.XmlConfigurationProvider 类 (31 行) - Parsing configuration file [struts-plugin.xml]
[INFO 级别] com.opensymphony.xwork2.config.providers.XmlConfigurationProvider 类 (31 行) - Parsing configuration file [struts.xml]
[INFO 级别] com.opensymphony.xwork2.spring.SpringObjectFactory 类 (31 行) - Setting autowire strategy to name
以为是xfire的问题,在这个上面浪费了好长时间,中文网页基本搜索不到相关的信息。后来发现几个英文网页说碰到这个问题,但是认为这个.doc.xml NOT found没有关系,webservice可以正常访问。
没辙了,只能是自己尝试解决。
然后在项目中屏蔽掉与webservice发布无关的所有部分,webservice能正常访问了。
再逐步开放与webservice无关的spring配置,struts2配置,sitemesh配置,在添加上struts2功能的时候出现最初的问题。
再注释掉web.xml中struts2的配置,又能正常访问wsdl了。
确定是struts2配置的问题。
然后修改struts2的filter-mapping映射路径,修改/*为/management/*,还是有问题,对sitemesh配置做同样修改,访问开始正常。
问题解决。
总结:xfire与其他框架集成的时候,因为它的访问路径是/services/*,所以如果有其他的配置实用的/*,则会对webservice的访问造成影响,以后需要注意这种映射路径冲突的问题。