axis2 services.xml 文件格式

转自:http://laochake.iteye.com/blog/445577

 

The description of services are specified using services.xml. Each service archive file needs to have a services.xml in order to be a valid service and it should be available in the META-INF directory of the archive file. A very simple services.xml is shown below:

Xml代码   收藏代码
  1. <service name="name of the service" scope="name of the scope" class="full qualifide name the service lifecycle class"   targetNamespace="target namespase for the service">  
  2.     <Description> The description of the service  </Description>    
  3.   
  4.     <transports>   
  5.         <transport>HTTP</transport>  
  6.     </transports>  
  7.       
  8.     <schema schemaNamespace="schema namespace"/>   
  9.        
  10.     <messageReceivers>  
  11.         <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>  
  12.     </messageReceivers>  
  13.        
  14.     <parameter name="ServiceClass" locked="xsd:false">org.apache.axis2.sample.echo.EchoImpl</parameter>  
  15.       
  16.     <operation name="echoString" mep="operation MEP">   
  17.         <actionMapping>Mapping to action</actionMapping>  
  18.         <module ref=" a module name "/>  
  19.         <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>  
  20.     </operation>  
  21. </service>  

name: The service name will be the name of the archive file if the .aar file contains only one service, or else the name of the service will be the name given by the name attribute.

scope: (Optional Attribute) The time period during which runtime information of the deployed services will be available. Scope is of several types- "application", "soapsession", "transportsession", "request". The default value (if you don't enter any value) will be "request"

class: (Optional attribute) The full qualified name of the service lifecycle implementation class. ServiceLifeCycle class is useful when you want to do some tasks when the system starts and when it shuts down.

targetNamespace: (Optional Attribute) Target name space of the service. This value will be used when generating the WSDL. If you do not specify this value, the value will be calculated from the package name of the service impl class.

Description: (Optional) If you want to display any description about the service via Axis2 web-admin module, then the description can be specified here.


transports :
 (Optional) The transports to which the service is going to be exposed. If the transport element is not present, then the service will be exposed in all the transports available in the system. The transport child element specifies the transport prefix (the name of the transport specified in axis2.xml).


parameters:
 A services.xml can have any number of top level parameters and all the specified parameters will be transformed into service properties in the corresponding AxisService. There is a compulsory parameter in services.xml called ServiceClass that specifies the Java class, which performs the above transformation. This class is loaded by the MessageReceiver.


operations :
 If the service impl class is Java, then all the public methods in that service will be exposed. If the user wants to override it, he has to add the "operation" tag and override it. In a non-Java scenario or if you do not have a service class, then all the operations the user wants to expose by the service has to be indicated in the services.xml. It is specified as follows:

Xml代码   收藏代码
  1. <operation name="echoString">  
  2.     <module ref=" a module name "/>  
  3.     <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>  
  4. </operation>  

 The only compulsory attribute here is "name", which represents the operation name that is going to be exposed. Any operation can contain module references as well as any number of parameters. The most interesting thing is that you can register custom message receivers per operation. Then the registered message receiver will be the message receiver for the corresponding operation. If you do not specify the message receiver, then the default message receiver will perform the operation.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值