Liberty:ibm-ws-bnd.xml 文件

您可使用 Liberty 中的 ibm-ws-bnd.xml 文件来定制 Web Service 端点以及为 Web Service 提供程序和 Web Service 客户机配置安全设置。必须将此文件存储在 Web 应用程序的 /WEB-INF 目录中,或者存储在 EJB 模块的 /META-INF 目录中。

对于 ibm-ws-bnd.xml 文件中每个元素的描述为如下所示:

<webservice-endpoint-properties>

此元素用来定义同一模块中的所有 Web Service 端点的缺省属性。为一个模块只能指定一个 webservice-endpoint-properties 元素。可以通过 webservice-endpoint-properties 元素的属性来指定适合于 Web Service 端点的任何“名称/值”对。

如果您添加 <enableLoggingInOutInterceptor> 属性,那么可以同时记录客户端和服务器端的 SOAP 请求及响应。

<webservice-endpoint-properties enableLoggingInOutInterceptor="false">  
注: 如果设置 enable LoggingInOutInterceptor="true",您的凭证将显示在 message.log 中。

<webservice-endpoint>

此元素用来指定所指定服务实例的绑定。它有以下属性:
  • port-component-name:此属性是必需属性。此属性用来指定端口组件的名称。
  • address:此属性是可选属性。此属性用来指定服务端点的被覆盖地址。

如果您添加 <enableLoggingInOutInterceptor> 属性,那么可以同时记录客户端和服务器端的 SOAP 请求及响应。

	<webservice-endpoint port-component-name="Hello">         
		<properties enableLoggingInOutInterceptor="true"/>    
	</webservice-endpoint>
注: 如果设置 enable LoggingInOutInterceptor="true",您的凭证将显示在 message.log 中。

<http-publishing>

对所有 Web Service 端点使用 HTTP 协议时,此元素用来指定发布配置。每个模块中只能指定一个 <http-publishing> 元素。它具有以下属性:
  • context-root:此属性是可选属性。此属性用来指定基于 EJB 的 JAX-WS 应用程序的 EJB 模块的上下文根。

<webservice-security>

此元素用来为 POJO Web Service 及基于 EJB 的 Web Service 配置基于角色的授权。它有以下属性:
  • security-constraint:此属性是可选属性。此属性用来使安全性约束与一个或多个 Web 资源集合相关联,并且仅用作 Web 应用程序中部署描述符或注释的补充配置。
  • security-role:此属性是可选属性。此属性包含安全角色的定义,并且仅用作 Web 应用程序中部署描述符或注释的补充配置。
  • login-config:此属性是可选属性。此属性用来配置认证方法和域名,并且仅对 JAR 文件中基于 EJB 的 Web Service 起作用。如果在部署描述符文件中指定了同一属性,那么将使用该部署描述符中的值。此属性的值必须为 BASICCLIENT_CERT

<service-ref>

此元素用来定义 Web Service 客户机的 Web Service 引用配置。它有以下属性:
  • name:此属性是必需属性。此属性用来指定 Web Service 引用的名称。
  • component-name:此属性是可选属性。如果在 EJB 模块中使用了服务引用,那么此属性用来指定 EJB Bean 名称。
  • port-address:此属性是可选属性。如果所引用的 Web Service 只有一个端口,那么此属性用来指定 Web Service 端口的地址。
  • wsdl-location:此属性是可选属性。此属性用来指定要覆盖的 WSDL 的 URL。

<port>

此元素用来定义与 Web Service 引用相关联的端口配置。可以在 service-ref 元素中定义多个 port 元素。它有以下属性:
  • name:此属性是必需属性。此属性用来指定 Web Service 端口的名称。
  • namespace:此属性是可选属性。此属性用来指定 Web Service 端口的名称空间。如果存在 namespace 属性,那么会将绑定应用于具有相同名称和名称空间的端口。否则,会将绑定应用于具有相同名称的端口。
  • address:此属性是可选属性。此属性用来指定 Web Service 端口的地址。如果存在此属性,那么它将覆盖在 service-ref 元素中定义的 port-address 属性的值。
  • username:此属性是可选属性。此属性用来指定用于基本认证的用户名。
  • password:此属性是可选属性。此属性用来指定用于基本认证的密码。可以对密码进行编码。
  • ssl-ref:此属性是可选属性。它使用 id 属性来引用在 server.xml 文件中配置的 ssl 元素。如果未指定此属性,但是服务器通过启用 ssl-1.0 功能部件而支持传输级别安全性,那么服务客户机将使用 Liberty 的缺省 SSL 配置。
  • key-alias:此属性是可选属性。此属性用来指定客户机证书的别名。如果未指定此属性,并且 Web Service 提供程序支持客户机证书,那么密钥库中的第一个证书将用作此属性的值。此属性还可以覆盖在 server.xml 文件的 ssl 元素中定义的 clientKeyAlias 属性。

<properties>

此元素用来定义 Web Service 端点或客户机的属性。属性可以是任意名称和任意值。
  • 对于 Web Service 客户机,您可以指定 client.ConnectionTimeoutauthorization.UserNametlsClientParameters.disableCNcheck 以及其他属性。
  • 对于 Web Service 端点,您可以指定 publishedEndpointUrlorg.apache.cxf.wsdl.create.imports 以及其他属性。
以下示例说明了 ibm-ws-bnd.xml 文件的典型配置:
<?xml version="1.0" encoding="UTF-8"?>
<webservices-bnd xmlns="http://websphere.ibm.com/xml/ns/javaee" 
					  	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
					  		xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-ws-bnd_1_0.xsd"
						version="1.0">
    
    <!-- optional Web service endpoint default properties -->
    <webservice-endpoint-properties org.apache.cxf.wsdl.create.imports="true" ... />

    <!-- 0 to many endpoint descriptions -->
    <webservice-endpoint port-component-name="..." address="optional override address">
        <!-- optional Web service endpoint properties -->
        <properties publishedEndpointUrl="http://www.example.com/services/hello" 
								userPassword="security" /> 
    </webservice-endpoint>
    ...

    <!-- optional http publishing module overrides -->
    <http-publishing context-root="optional override of module's context root">
        <!-- optional web.xml fragment for security -->
        <webservice-security>    
            <!-- SECURITY CONSTRAINTS -->
            <security-constraint>
                <web-resource-collection>
                    <web-resource-name>SayHelloServiceName</web-resource-name>
                    <url-pattern>/SayHelloService</url-pattern>
                </web-resource-collection>
                <auth-constraint>
                    <description>SayHelloServiceAuth</description>
                    <role-name>group123</role-name>
                </auth-constraint>
                <user-data-constraint>
                    <transport-guarantee>CONFIDENTIAL</transport-guarantee>
                </user-data-constraint>
            </security-constraint>
            <!-- SECURITY CONSTRAINTS -->
            <security-constraint>
                <web-resource-collection>
                    <web-resource-name>SecuredSayHelloServiceName</web-resource-name>
                    <url-pattern>/Secured*</url-pattern>
                </web-resource-collection>
                <auth-constraint>
                    <description>SecuredSayHelloServiceAuth</description>
                    <role-name>group123</role-name>
                </auth-constraint>
                <user-data-constraint>
                    <transport-guarantee>CONFIDENTIAL</transport-guarantee>
                </user-data-constraint>
            </security-constraint>
            <!-- SECURITY ROLES -->
            <security-role id="group123_id">
                <role-name>group123</role-name>
            </security-role>
            <!-- AUTHENTICATION METHOD: Client certificate or basic authentication -->
            <login-config>
                <auth-method>BASIC</auth-method>
            </login-config> 
        </webservice-security>
    </http-publishing>
       
    <!-- 0 to many client refs -->
    <service-ref name="services/sayHelloService" 
			port-address="http://productServer:productPort/context-root/SayHelloService"/>
    <service-ref name="services/securedSayHelloService" port-address="http://productServer:productPort/context-root/SecuredSayHelloService" wsdl-location="optional override of WSDL document" />
</webservices-bnd>

用于指示主题类型的图标 参考主题



时间戳记图标 最近一次更新时间: Tuesday, 6 December 2016
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=rwlp_jaxws_bnd
文件名:rwlp_jaxws_bnd.html