简体   繁体   English

如何在Web应用程序中部署JbossWS CXF

[英]How to deploy JbossWS CXF within a web-application

When I deploy my webapplication on a JBoss app-server it fails to deploy the webservice. 当我在JBoss app-server上部署我的webapplication时,它无法部署webservice。 I am using the top-down approach and generated the necessary files with wsconsume.bat from my wsdl- and xsd-files. 我正在使用自上而下的方法,并使用wsconsume.bat从我的wsdl-和xsd-files生成必要的文件。 I then add necessary anottations to the webservice implementation-class. 然后,我将必要的anottations添加到webservice实现类。 But this is pretty much as far as I get, the documentation in the user guides fails to describe how I should continue. 但这几乎就是我所知,用户指南中的文档未能描述我应该如何继续。

I have experimented with different settings in the jbossws-cxf.xml and web.xml. 我已经在jbossws-cxf.xml和web.xml中尝试了不同的设置。 But webserive fails to deploy correctly. 但是webserive无法正确部署。

Anyone could suggest some points or point me towards a reference implementation that describes my use case? 任何人都可以提出一些观点或指向我描述我的用例的参考实现?

So I finally got it to work. 所以我终于开始工作了。

The trick is to remove jbossws-cxf.xml-file. 诀窍是删除jbossws-cxf.xml文件。 In web.xml there should be a servlet-mapping to the webservice implementation-class. 在web.xml中,应该有一个到webservice实现类的servlet映射。 Jbossws-cxf.xml-file is then automatically generated and stored in a tmp-directory. 然后自动生成Jbossws-cxf.xml文件并将其存储在tmp目录中。 I advice to examine this file and then create the jbossws-cxf.xml so that customisation can be applied. 我建议检查这个文件,然后创建jbossws-cxf.xml,以便可以应用自定义。

In short this is how a configuration in it's simpliest form should look like: 简而言之,这是最简单形式的配置应如下所示:

WEB-INF/web.xml: WEB-INF / web.xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
  <servlet-name>ws-name</servlet-name>
  <servlet-class>org.company.WebServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
  <servlet-name>ws-name</servlet-name>
  <url-pattern>/webservice/endpoint</url-pattern>
</servlet-mapping>
</web-app>

WEB-INF/Jbossws-cxf.xml: WEB-INF /将JBossWS-cxf.xml:

<beans xmlns='http://www.springframework.org/schema/beans' 
        xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' 
        xmlns:beans='http://www.springframework.org/schema/beans' 
        xmlns:jaxws='http://cxf.apache.org/jaxws' 
        xmlns:soap='http://cxf.apache.org/bindings/soap' 
        xsi:schemaLocation='http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans.xsd 
        http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd'>
    <jaxws:endpoint id='ws-name' 
            address='http://127.0.0.1:8180/webservice/endpoint' 
            implementor='org.company.WebServiceImpl'>
        <jaxws:invoker>
            <bean class='org.jboss.wsf.stack.cxf.InvokerJSE'/>
        </jaxws:invoker>
    </jaxws:endpoint>
</beans>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM