WS-I Basic Profile

Web Services-Interoperability (WS-I) Basic Profile 是提升互操作性的一组非专用 Web Service 规范。 WebSphere® Application Server 符合 WS-I Basic Profile V1.1 和 WS-I Basic Security Profile V1.0。

WS-I 基本概要文件由行业领先的公司 (包括 IBM®) 组成的联盟根据 WS-I 组织的指示进行管理。 该概要文件由一组有关形成 Web Service 技术的公开标准的原则组成。 鼓励有兴趣提升 Web Service 之间互操作性的所有组织成为 Web Service 互操作性组织的成员。

Web Service 的合成和实现中使用多个技术组件,包括消息传递、描述、发现和安全性。 这些组件中的每个组件都由规范和标准支持,这些规范和标准包括 SOAP 1.1、可扩展标记语言 (XML) 1.0、HTTP 1.1、Web 服务描述语言 (WSDL) 1.1 和“统一描述、发现和集成”(UDDI)。 WS-I Basic Profile 指定这些技术组件如何一起用于获取互操作性,以及如何在适当时命令每种技术的特定使用。 您可以在 WS-I 组织 Web 站点中读取更多有关 WS-I Basic Profile 的内容。

更新技术组件时,也会在 Web Service 的合成和实现中使用这些技术组件。 一个示例是,现在同时支持 SOAP 1.1 和 SOAP 1.2。

以 WS-I Basic Profile V1.0、WS-I Basic Profile V1.1、Attachment Profile V1.0、Basic Security Profile (BSP) V1.0 和 WS-I Basic Security Profile V1.1 支持为基础,您可以使用此产品通过下列活动 WS-I 概要文件来实现 Web Service:
  • WS-I Basic Profile V1.2 以 WS-I Basic Profile V1.0 和 WS-I Basic Profile V1.1 为基础,并添加 WS-Addressing (WS-A) 和 SOAP 消息传输优化机制 (MTOM) 的支持。 WS-Addressing 规范将启用异步消息交换模式,以便您可以从服务响应中解耦服务请求。 发送方请求的 SOAP 头包含定义端点引用的 wsa:ReplyTo 值,以发送提供程序响应。 从响应解耦请求将启用长整型运行的 Web Service 交互。 现在,利用与 WS-Addressing 相结合的 JAX-WS V2.1 中的异步编程模型支持,您可以利用此功能来创建 Web Service 调用,在该模型支持下客户机无需等待响应返回即可继续进程工作。 这提供了更多的动态有效模型,以调用 Web Service。 使用 MTOM,您可以在 SOAP 消息内优先发送并接收二进制数据。
  • WS-I Basic Profile V2.0 以带有 SOAP 1.2 支持附加物的 Basic Profile V1.2 为基础。
  • WS-I Reliable Secure Profile 1.0 以 WS-I Basic Profile V1.2、WS-I Basic Profile V2.0、WS-I Basic Security Profile V1.0 和 WS-I Basic Security Profile V1.1 为基础,并添加 WS-Reliable 消息传递 1.1、WS-Make Connection 1.0 和 WS-Secure Conversation 1.3 的支持。 WS-Reliable 消息传递 1.1 是为 Web Service 交互提供消息级别可靠性的基于会话的协议。 WS-Make Connection 1.0 由 WS-Reliable 消息传递工作组开发以处理一些方案,在这些方案中,Web Service 端点位于防火墙后面或端点没有可视的端点引用。 如果 Web Service 端点在可靠会话期间失去连通性,那么 WS-Make Connection 将提供一个有效方法以重新建立可靠会话。 另外,WS-Secure Conversation V1.3 是基于会话的安全性协议,该协议使用基于有效对称密钥的消息级安全性加密算法。 WS-I Reliable Secure Profile V1.0 将提供安全可靠的面向会话的 Web Service 交互。

每个技术组件都有一些要求,您可以在 WS-I 组织 Web 站点中详细读取这些要求。 例如,WS-I Basic Profile 要求支持通用转换 格式 (UTF)-16 编码。 UTF-16 是使用 16 位值存储通用字符集 (UCS) 字符的一种 Unicode 编码方案。 UTF-8 是因特网上使用的最常见编码; UTF-16 编码通常用于 Java™ 和 Windows 产品应用程序; UTF-32 由各种 Linux® 和 UNIX 系统使用。 与 UTF-8 不同,UTF-16 具有与大尾数法和小尾数法有关的问题,并且通常包含字节顺序标记 (BOM) 以表明字节存储次序。 BOM 对于 UTF-16 编码是必须的,而且它可以在 UTF-8 中使用。

应用程序服务器只支持 SOAP 消息的 UTF-8 和 UTF-16 编码。

请参阅有关更改 SOAP 消息编码以支持 WSI-Basic Profile 的信息,以了解如何将编码方式从 UTF-8 改为 UTF-16。

表 1. UTF 属性 为 UTF 属性指定相应字节和编码格式。
字节 编码格式
EF BB BF UTF-8
FF FE UTF-16、小尾数法
FE FF UTF-16、大尾数法
00 00 FE FF UTF-32、大尾数法
FF FE 00 00 UTF-32、小尾数法
BOM 写在 XML 文本之前,它对解析器表明 XML 如何编码。 XML 声明包含编码,例如: <?xml version=xxx encoding="utf-xxx"?>。 BOM 与编码配合使用以确定如何解释 XML。 以下是 SOAP 消息以及如何使用 BOM 和 UTF 编码的示例:
POST http://www.whitemesa.net/soap12/add-test-rpc HTTP/1.1
Content-Type: application/soap+xml; charset=utf-16; action=""
SOAPAction:
Host: localhost: 8080
Content-Length: 562

OxFF0xFE<?xml version="1.0" encoding="utf-16"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2002/12/soap-envelope"
      xmlns:soapenc="http://www.w3.org/2002/12/soap-encoding
      xmlns:tns="http://whitemesa.net/wsdl/soap12-test"
      xmlns:types="http://whitemesa.net/wsdl/soap12-test/encodedTypes"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soap:Body>
    <q1:echoString xmlns:q1="http://soapinterop.org/">
      <inputString soap:encodingStyle="http://example.org/unknownEncoding" 
                        xsi:type="xsd:string">
        Hello SOAP 1.2
      </inputString>
    </q1:echoString>
  </soap:Body>
</soap:Envelope>

在示例代码中, 0xFF0xFE 表示字节代码,而 <?xml> 声明是文本表示。

在 OAP 1.2 不支持对 styleEncoding 的支持,因此,以下是 SOAP 消息的同一个示例,但不包含编码信息:
OxFF0xFE<?xml version="1.0" encoding="utf-16"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2002/12/soap-envelope"
      xmlns:soapenc="http://www.w3.org/2002/12/soap-encoding
      xmlns:tns="http://whitemesa.net/wsdl/soap12-test"
      xmlns:types="http://whitemesa.net/wsdl/soap12-test/encodedTypes"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soap:Body>
    <q1:echoString xmlns:q1="http://soapinterop.org/">
      <inputString xsi:type="xsd:string">
        Hello SOAP 1.2
      </inputString>
    </q1:echoString>
  </soap:Body>
</soap:Envelope>

有关受支持的标准和规范的完整列表,请参阅 Web Service 规范和 API 文档。