webservice之axis介绍3

关于wsdd的文件格式,简单的deploy.wsdd和undeploy.wsdd的内容如下:

deploy.wsdd:

<?xml version="1.0" encoding="utf-8"?>
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
  xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
 <service name="BookService" provider="java:RPC">
  <parameter name="className" value="/bookservice.BookService"/>
  <parameter name="allowedMethods" value="*"/>
 </service>
</deployment>

undeploy.wsdd:

<?xml version="1.0" encoding="utf-8"?>
<undeployment xmlns="http://xml.apache.org/axis/wsdd/">
 <service name="BookService">
 </service>
</undeployment>

deploy.wsdd文件中还可以包括对JavaBean的自动序列化:

  <beanMapping qname="myNS:Book" xmlns:myNS="urn:BeanService"
   languageSpecificType="java:bookservice.Book"/>

关于如何序列化,可以使用axis中已经提供的如org.apache.axis.encoding.ser.BeanDeserializerFactory和
org.apache.axis.encoding.ser.BeanSerializerFactory,也可以自己写,需要写的class有serializer/deserializer class,serializer/deserializer factory,然后再deploy.wsdd文件中注册一下就可以了:

<typeMapping
xmlns:ns="urn:BookService"
qname="ns:Car" type="java:bookservice.BookService"
serializer="bookservice.BookSerializerFactory"
deserializer="bookservice.BookDeserializerFactory"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

 

 

下面介绍一下axis本身的组件,先看看axis服务器端的架构

axis的组件主要有:

axis engines:主引擎,通过调用一系列的handlers来协调SOAP消息的处理

Handlers:对request方向和response方的消息进行处理,比如说可以进行认证、压缩、加密、记录日志、消息转换等等

Chains:按特定顺序执行的一系列Handlers的总称,response和request每个方向上有三条transport,global,service,总共有六条chain

Provider:从request 方向的chain向response方向chain的转换点,负责调用webservice操作

Transports:处理从客户到engine的和从egnine到客户端的协议转换

Serializer/Deserializer:负责从java到xml的双向转换

Deployment/Configuration:部署和配置用

可以在wsdd文件中配置Handlers,不过只能在部署阶段,不能在运行阶段动态配置:

<globalConfiguration>
<requestFlow> handler-element* </requestFlow>
<responseFlow> handler-element* </responseFlow>
</globalConfiguration>

<transport name="http">
<requestFlow> handler-element* </requestFlow>
<responseFlow> handler-element* </responseFlow>
</transport>

<service name="service-name" provider="java:RPC">
<requestFlow> handler-element* </requestFlow>
<responseFlow> handler-element* </responseFlow>
</transport>

你可能感兴趣的:(java,apache,xml,webservice,SOAP)