`
vannay
  • 浏览: 1957 次
  • 性别: Icon_minigender_1
  • 来自: 上海
最近访客 更多访客>>
社区版块
存档分类
最新评论

Jax-ws WAR File Packaging

阅读更多

From: http://jax-ws.java.net/nonav/2.1.4/docs/jaxws-war.html

 

The WAR Contents

Typically, one creates the WAR file with a GUI development tool or with the

ant war task from the generated artifacts from wsimport, wsgen,

or apt tools.

For example, a sample WAR file starting from a WSDL file:

WEB-INF/classes/hello/HelloIF.class          SEI
WEB-INF/classes/hello/HelloImpl.class        Endpoint
WEB-INF/sun-jaxws.xml                        JAX-WS RI deployment descriptor
WEB-INF/web.xml                              Web deployment descriptor
WEB-INF/wsdl/HelloService.wsdl               WSDL
WEB-INF/wsdl/schema.xsd                      WSDL imports this Schema

The sun-jaxws.xml File

The <endpoints> element contain one or more <endpoint> elements.

Each endpoint represents a port in the WSDL and it contains all information

about implementation class, servlet url-pattern, binding, WSDL, service,

port QNames. The following shows a sun-jaxws.xml file

for a simple HelloWorld service. sun-jaxws.xml is the schema instance

of sun-jaxws.xsd.

<?xml version="1.0" encoding="UTF-8"?>
<endpoints
  xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime"
  version="2.0">
  <endpoint
    name="MyHello"
    implementation="hello.HelloImpl"
    url-pattern="/hello"/>
</endpoints>

  • endpoint can have the following attributes
  • Attribute Optional Use
    name
    N Name of the endpoint
    wsdl
    Y Primary wsdl file location in the WAR file. For e.g. WEB-INF/wsdl/HelloService.wsdl. If this isn't specified, JAX-WS will create and publish a new WSDL. When the service is developed from Java, it is recommended to omit this attribute.
    service
    Y QName of WSDL service. For e.g. {http://example.org/}HelloService. When the service is developed from java, it is recommended to omit this attribute.
    port
    Y QName of WSDL port. For e.g. {http://example.org/}HelloPort. When the service is developed from Java, it is recommended to omit this attribute.
    implementation
    N Endpoint implementation class name. For e.g: hello.HelloImpl. The class should have @WebService annotation. Provider based implementation class should have @WebServiceProvider annotation.
    url-pattern
    N Should match <url-pattern> in web.xml
    binding
    Y Binding id defined in the JAX-WS API. The possible values are:
    "http://schemas.xmlsoap.org/wsdl/soap/http",
    "http://www.w3.org/2003/05/soap/bindings/HTTP/"
    If omitted, it is considered SOAP1.1 binding.
    enable-mtom
    Y Enables MTOM optimization. true or false. Default is false.
  • endpoint can have a optional handler-chain element
<?xml version="1.0" encoding="UTF-8"?>
<endpoints ...">
  <endpoint ...>
    <handler-chain>
      <handler-chain-name>somename</handler-chain-name>
      <handler>
        <handler-name>MyHandler</handler-name>
        <handler-class>hello.MyHandler</handler-class>
      </handler>
    </handler-chain>
  </endpoint>
</endpoints>

The web.xml File

The following shows a web.xml file for a simple HelloWorld service.

It specifies JAX-WS RIspecific listener, servlet classes. These classes are com.sun.ws.transport.http.servlet.WSServletContextListener, and com.sun.xml.ws.transport.http.servlet.WSServlet is servlet

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" 
"http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">

<web-app>
  <listener>
    <listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener
</listener-class>
  </listener>
  <servlet>
    <servlet-name>hello</servlet-name>
    <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>hello</servlet-name>
    <url-pattern>/hello</url-pattern>
  </servlet-mapping>
  <session-config>
    <session-timeout>60</session-timeout>
  </session-config>
</web-app>

Remember these requirements when building a WAR:

  • WSDL and auxiliary WSDL, Schema files should be packaged
  • under WEB-INF/wsdl dir. It is recommended that they need not be packaged
  • when the service is started from Java
  • WebService implementation class should contain @WebService annotation.
  • Provider based endpoints should have @WebServiceProvider annotation.
  • wsdl, service, port attributes are mandatory for Provider based endpoints
  • and can be specified in @WebServiceProvider annotation
  • or deployment descriptor (sun-jaxws.xml).
分享到:
评论

相关推荐

    jax-ws webservice demo

    基于jax-ws 实现的web service client和server端的demo程序。 注:如果使用的是 myeclipse 时 server 部署到tomcat 启动的时候会报错 解决办法:找到myeclipse安装目录下的 plugins 目录里 查找 webservices-rt.jar,...

    JAX-WS 2.2 RI所有相关jar包

    JAX-WS 2.2 RI 所包含的JAR包集合,包含25个JAR包,列表如下: FastInoset.jar gmbal-api-only.jar ha-api.jar javax.annotation.jar javax.mail_1.4.jar jaxb-api.jar jaxb-impl.jar jaxb-xjc.jar jaxws-api...

    JAX-WS自学笔记

    JAX-WS自学笔记 本人自学JAX-WS笔记和简单例子,文档标题结构如下: JAX-WS使用教程 1、JAX-WS概述 2、创建Web Service 2.1 从java开始 2.1.1 运行wsgen 2.1.2 生成的WSDL和XSD 2.1.3 目录结构 2.2 从WSDL...

    Jax-ws所需要的JAR包

    亲测可用,Jax-ws所需要的JAR包,拷贝到tomcat安装路径的lib里,实现了webservice发布到tomcat,赞!

    MyEclipse8_0中使用 JAX-WS 部署 WebService 实例

    MyEclipse8_0中使用 JAX-WS 部署 WebService 实例 - 外衣 - 博客频道 - CSDN_NET.mht

    metro-jax-ws-master

    The Java API for XML Web Services (JAX-WS) is a Java programming language API for creating web services, particularly SOAP services. JAX-WS is one of the Java XML programming APIs. It's a part of the ...

    webService部署tomcat需要的jax-ws jar包

    webService部署tomcat需要的jax-ws 的完整jar包

    基于JAX-WS2.2开发WebService所需jar资源包

    使用 Eclipse JavaEE 开发 WebService 时,若选择手动创建原生的JAX-WS服务,需要导入此jar资源(教程详见我的博文https://blog.csdn.net/weixin_50604409/article/details/116399530)。 如果您同时装有 IntelliJ ...

    JAX-WS_WebService.rar

    JAX-WS方式开发和部署webservice应用,JAX-WS方式开发和部署webservice应用,JAX-WS方式开发和部署webservice应用,JAX-WS方式开发和部署webservice应用,JAX-WS方式开发和部署webservice应用

    JAX-WS2.0 API

    JAX-WS2.0 API

    Jax-WS 简单实例

    Jax-WS的简单实例 Jax-WS的简单实例

    jax-rs jax-ws所需包,亲测可用

    javax.xml.ws.Service 报错需要的包,亲测可以用,直接下载在ide里buildpath一下就可以,四个jar包 ,整合了其他的jar所以配置简单

    jax-ws webservice简单demo

    jax-ws webservice完整demo,包含所有jax-ws 2.2jar包。

    使用JAX-WS(JWS)发布WebService

    使用JAX-WS(JWS)发布WebService 使用myeclipse开发java的webservice的两种方式 方式一: (此方式只能作为调试,有以下bug:jdk1.6u17?以下编译器不支持以Endpoint.publish方式发布document方式的soap,必须在...

    JAX-WS开发的文件生成与部署相关全视频过程

    如果基于一个JAX-WS进行WebService开发,有很多教程,但是具体怎么更自动地生成一些文件,实现客户端与服务端的交互,都讲得不大清楚,为了让大家更方便地部署,我将服务端、客户端文件的生成与部署全过程以及测试...

    JAX-WS 2.2 完整jar包

    JAX-WS 2.2 RI 所包含的JAR包集合,包含25个JAR包,列表如下: FastInoset.jar gmbal-api-only.jar ha-api.jar javax.annotation.jar javax.mail_1.4.jar jaxb-api.jar jaxb-impl.jar jaxb-xjc.jar jaxws-api...

    基于JDK自带的Web服务JAX-WS实现WebService的简单示例

    Java 基于第三方插件实现WebService实在麻烦,尤其是要添加几十M的Jar包...还好,自从JDK 1.6开始,Java自身已经支持WebSeervice的开发即JAX-WS,附件是一个简单的示例,供入门参考。注意,JDK环境要求1.6及以上版本。

    JAX-WS的lib、src和docs

    JAX-WS不是一个孤立的框架,它依赖于众多其他的规范,本质上它由以下几部分组成 1.用来开发Web Services的Java API 2.用来处理Marshal/Unmarshal的XML Binding机制,JAX-WS2.0用JAXB2来处理Java Object与XML之间的映射,...

    jax-ws 方式发布web Service 后台用Hibernate实现,前端.NET通过引用服务方式实现

    rar中包含整个项目的源码和数据库生成脚本,采用jax-ws发布Web Service服务,支持java客户端和.Net客户端调用,数据库采用oracle10g,里面有创建数据库脚本文件createTable_Oracle10g.sql,由于Hibernate映射表中会...

    JAX-WS SOAP header设值

    NULL 博文链接:https://iamliming.iteye.com/blog/1399257

Global site tag (gtag.js) - Google Analytics