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:
<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">
<Description> The description of the service </Description>
<transports>
<transport>HTTP</transport>
</transports>
<schema schemaNamespace="schema namespace"/>
<messageReceivers>
<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
</messageReceivers>
<parameter name="ServiceClass" locked="xsd:false">org.apache.axis2.sample.echo.EchoImpl</parameter>
<operation name="echoString" mep="operation MEP">
<actionMapping>Mapping to action</actionMapping>
<module ref=" a module name "/>
<messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
</operation>
</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:
<operation name="echoString">
<module ref=" a module name "/>
<messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
</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.
分享到:
相关推荐
标题中的“Axis2之使用services.xml发布带包的Webservice”指的是在Apache Axis2框架下,通过services.xml配置文件来发布包含多个类或包的Web服务。Apache Axis2是Java平台上的一个开源Web服务框架,它允许开发人员...
通过在services.xml或axis2.xml中引用模块,可以将这些功能附加到服务或整个Axis2实例上。模块配置使得功能的添加和管理变得灵活且模块化。 在开发和部署基于Axis2的Web服务时,理解并熟练掌握这三种配置文件的使用...
Axis2.x基于AXIOM(Abstract XML Information Model)和Axiom组件,提供了更高效的消息处理机制。AXIOM是一个高性能的XML信息模型,允许对XML数据进行低级别操作,提高了处理速度。此外,Axis2.x采用了模块化架构,...
总结来说,发布Axis2 Web服务涉及配置services.xml文件、编写服务实现类、打包服务以及在Tomcat服务器上部署。这个过程可以通过jar或aar格式完成,取决于你的需求。记住,aar格式通常用于Android项目,而jar则通用性...
文档中提到不使用上传服务的方式,而是直接将`.aar`文件复制到`%TOMCAT_HOME%/webapps/axis2/WEB-INF/services`目录下。这种方式更适用于对Web服务进行直接的管理和部署。 #### 三、自定义Web服务的建立 1. **需求...
4. **WSDL支持**:WSDL是一种XML格式,用于描述Web服务的接口和绑定。Axis可以生成WSDL文件,也可以从WSDL文件生成服务端和客户端代码。 5. **模块化设计**:Axis允许开发者通过插件机制扩展其功能,比如添加对WS-...
2. **服务配置 (services.xml)**: 服务配置文件专注于单个服务的设定,包括服务行为、操作、数据绑定等。 在 `service.xml` 文件中,你可以定义服务的元数据,比如服务名称、操作、消息处理器、消息形式、数据绑定...
4. **部署服务**: 将服务存档(AAR文件)放入Axis2的`services`目录下,或通过管理控制台在线部署。 5. **启动Axis2**: 运行`axis2server.bat`或`.sh`启动脚本。 6. **测试服务**: 使用SOAP客户端工具(如SoapUI)或...
如果我们在使用 Axis2 时出现了超时异常,可以通过修改 %TOMCAT_HOME%\webapps\axis2\WEB-INF\conf\axis2.xml 文件中的<parameter name="ConfigContextTimeoutInterval">30000,将其改大一些,以解决超时问题。...
文件列表中的“TipTec.Developing.Web.Services.with.Apache.CXF.and.Axis2.Jan.2010.pdf”很可能包含这些详细内容,对于想要学习或深入理解Apache CXF和Axis2的开发者来说,是一份宝贵的资源。这份文档将帮助他们...
此外,还需要配置Axis2的配置文件路径,通常为`WEB-INF/conf/axis2.xml`。 ```java @Configuration @ComponentScan(basePackages = {"your.package.name"}) @EnableWebMvc public class Axis2Config extends ...
3. **服务部署**:Axis2支持多种部署方式,如WAR(Web应用归档)文件、AXIS2.XML配置文件或者直接使用Java代码进行动态部署。 4. **编码和解码**:Axis2内置了对多种编码和解码的支持,包括SOAP 1.1和SOAP 1.2,...
例如,“WebService大讲堂之Axis2(3):使用services.xml文件发布WebService.doc”文档可能详细解释了如何使用services.xml来部署服务。 4. **代码示例**: “AXIS2代码示例详解-HelloWorld.doc”可能包含一个简单...
示例代码中的导入语句包括`javax.xml.namespace.QName`、`org.apache.axis.client.Call`和`org.apache.axis.client.Service`等,这些都是调用WebService所必需的。 ```java import javax.xml.namespace.QName; ...
3. **services** 目录:这里存放的是Axis2服务的部署档案,这些档案(通常为`.aar`格式)包含了Web服务的接口定义、实现类和服务元数据。 4. **repository** 目录:存储服务、模块、依赖库和其他资源的仓库。服务...
【javax.xml.ws.Service】是Java平台上用于Web服务客户端的一个核心接口,它位于Java Web Services (JWS) API中,主要用于创建和使用Web服务。这个接口是JAX-WS(Java API for XML Web Services)规范的一部分,它...
2. `conf`目录:存储配置文件,如`axis2.xml`,这是Axis2的核心配置文件。 3. `services`目录:用于存放Web服务的部署文件和服务实现。 4. `lib`目录:包含Axis2运行时所需的库文件。 5. `repository`目录:存储服务...
4. 配置:配置Axis的配置文件axis.properties和services.xml以定制服务行为。 五、注意事项 - Axis-1.4版本可能存在安全漏洞,对于新项目,建议使用更现代的版本,如Axis2,或者考虑采用其他的Web服务框架,如...