-- 作者:wshuyuan
-- 发布时间:5/19/2008 10:39:00 PM
-- 用JAX-RPC开发Web Services 配置文件
Configuration File The xrpcc tool reads an XML configuration file that specifies the files to be generated. The configuration file has two different formats, depending on whether you are starting with RMI interfaces or a WSDL document. The file can have one format or the other, but not both. The file's <configuration> element must have either one <service> element or one <wsdl> element. Xrpcc工具读XML配置文件,XML配置文件指出产生的文件。配置文件有两种格式,这两种格式取决你用RMI接口还是WSDL文件开始。文件可以有一个或另一个格式,但不能两个都有。文件的<configuration>元素必须有<service>元素或<wsdl>元素。 Starting With RMI Interfaces 运行RMI接口 If you are starting with RMI interfaces, the tool can generate stubs, ties, a server configuration file, and a WSDL document. With RMI interfaces, the tool's configuration file must have the following form: 如果你运行RMI接口,工具会产生stubs,ties,服务配置文件和WSDL文件。用RMI接口,工具产生的配置文件必须有下列形式: <?xml version="1.0" encoding="UTF-8"?> <configuration xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config"> <service name="[1]" 服务名 packageName="[2]"> 包名 targetNamespace="[3]" 目标命名空间 typeNamespace="[4]"> 类型命名空间 <interface name="[5]" 接口名 servantName="[6]" 服务名 soapAction="[7]" soapActionBase="[8]"> <handlerChains> [9] </handlerChains> </interface> <typeMappingRegistry> [10] </typeMappingRegistry> <handlerChains> [9] </handlerChains> <namespaceMappingRegistry> [11] </namespaceMappingRegistry> </service> </configuration> The integers in the preceding syntax indicate the following: 前面的语法指示为: 1. Service name 服务名 2. Package name for the generated classes (for example, the service interface that extends javax.xml.rpc.Service) 被创建的类的包名(如:扩展javax.xml.rpc.Service的服务接口。) 3. Target namespace for the generated WSDL document 产生的WSDL文件的目标命名空间。 4. Target namespace for the schema portion of the generated WSDL document 产生的WSDL文件的schema部分的目标命名空间。 5. Fully qualified name of an interface 接口全名。 6. Fully qualified name of a servant class that implements the interface 执行接口的服务类全名。 7. Optional: string to be used as the SOAPAction for all operations in the corresponding port 可选项:相应端口的SOAP行为所有操作的字符串。 8. Optional: string to be used as a prefix for the SOAPAction strings for the operations in the corresponding port 可选项:相应端口SOAP行为操作的字符串前缀。 9. Optional: handler chain information* 可选项:处理程序链接信息。 10. Optional: type mapping information* 可选项:类型映射信息。 11. Optional: namespace mapping information* 可选项:名字空间映射信息。 *This feature is for advanced users. Please refer to the XML schema in the jax-rpc-ri-config.xsd file, which resides in the directory <JWSDP_HOME>/docs/tutorial/examples/jaxrpc/common. 此功能给高级功能用户用。请看jax-rpc-ri-config.xsd文件里的XML schema。XML schema在目录<JWSDP_HOME>/docs/tutorial/examples/jaxrpc/common里。 In this type of configuration file, the <configuration> element must have just one <service> element, which may contain multiple <interface> elements. 在这种配置文件里,<configuration>元素必须有一个<service>元素,一个<service>元素里有多个<interface>元素。 The JAX-RPC Specification discusses the classes of the javax.xml.rpc.holders package. These classes can be used in a WSDL document, but not in an RMI interface. JAX-RPC规定讨论javax.xml.rpc.holders包里的类。这些类被用在WSDL文件里,但不在RMI接口里。 SOAPAction Elements SOAPAction 元素 If you are an advanced user you might be interested in the following information about SOAPAction elements: If the soapAction attribute is specified, all the operations in the generated port will use that string as the SOAPAction. 如果你是高级用户,你可能对下面SOAPAction 元素信息感兴趣:如果SOAPAction属性被规定,各端口的操作将用属性字符串作为SOAPAction。 If the soapActionBase attribute is specified, its value will be used as a prefix for the generated SOAPAction strings. The suffix will be a unique string; in the current implementation it is the operation name. 如果soapActionBase属性被指定,它们的值被作为产生soapAction字符串的前缀。前缀是独一无二的字符串,在当前执行前缀是操作名。 For example, if soapActionBase is set to http://hello/ and the port has two operations, opA and opB, their SOAPAction strings will be http://hello/opA and http://hello/opB respectively. If neither soapAction nor soapActionBase are specified, the SOAPAction for all operations will be the empty string. Notice that in this release, JAX-RPC does not rely on the SOAPAction HTTP header for dispatching. 例如,如果soapActionBase设置为:http://hello/,端口有两个操作:opA和opB。他们的SOAPAction字符串将各自为:http://hello/opA和http://hello/opB。如果soapAction或soapActionBase都没被指定,SOAPAction所有操作将是空字符串。注意:这个版本JAX-RPC发送不依赖SOAPAction HTTP头。 Starting With a WSDL Document 用WSDL文件 If you are starting with a WSDL document, the tool can generate stubs, ties, a server configuration file, and RMI interfaces. The tool's configuration file must have the following form: 如果你用WSDL文件,工具会产生stubs,ties,一个服务器配置文件, <?xml version="1.0" encoding="UTF-8"?> <configuration xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config"> <wsdl location="[1]" packageName="[2]"> <typeMappingRegistry> 类型映射注册表 [3] </typeMappingRegistry> <handlerChains> 处理链 [4] </handlerChains> <namespaceMappingRegistry> 命名空间映射注册表 [5] </namespaceMappingRegistry> </wsdl> </configuration> The integers in the preceding syntax indicate the following: 前面的语法指示为: 1. URL pointing to a WSDL document URL指向一个WSDL文档。 2. Fully qualified name of the package for the generated classes and interfaces 所产生类和接口的包的全名。 3. Optional: type mapping information* 可选项:类型映射信息 4. Optional: handler chain information* 可选项:处理程序链信息。 5. Optional: namespace mapping information* 可选项:命名空间映射信息。 *This feature is for advanced users.这个功能是给高级用户的。 In a tool configuration file of this type, the <configuration> element must have just one <wsdl> element. 在这种类型的工具配置文件,<configuration>元素必须有一个<wsdl>元素。 Server Configuration File 服务器配置文件 The xrpcc tool also generates a server configuration file for Tomcat. The name of the file is specified by the <init-param> element of the web.xml file, which is the deployment descriptor for a Web application that's packaged in a WAR file. Xrpcc工具为Tomcat产生一个服务器配置文件。文件名被web.xml文件的<init-param>元素指定。这个服务器配置文件是Web应用程序的部署描述文件,放在WAR文件包里。 For example, the web.xml file might contain the following <init-param> element: <init-param> <param-name>configuration.file</param-name> <param-value>/WEB-INF/config.properties</param-value> </init-param> Here's an example of a server configuration file that is generated by the xrpcc tool: 有一个服务器配置文件的例子,由xrpcc工具产生。 port0.tie=hello.HelloIF_Tie port0.servant=hello.HelloImpl port0.name=HelloIF port0.wsdl.targetNamespace=http://hello.org/wsdl port0.wsdl.serviceName=HelloWorld port0.wsdl.portName=HelloIFPort portcount=1 This server configuration file should be copied to the WEB-INF/config.properties file in the Tomcat installation. 在安装Tomcat时服务器配置文件将被复制到WEB-INF/config.properties文件里。 [此贴子已经被作者于2008-5-20 15:56:51编辑过]
|