IBM 专有 SOAP over JMS 协议(不推荐)

可以使用 SOAP over Java™ 消息服务 (JMS) 传输,作为 HTTP 的替代方法,以在客户机和服务器之间传递 SOAP 消息。Web Service 引擎支持使用 IBM® 专有实现以及业界标准实现。

不推荐使用的功能部件 不推荐使用的功能部件: 在较早版本的应用程序服务器中,支持将 IBM 专有的 SOAP over JMS 协议用于 Java API for XML-based RPC (JAX-RPC) 应用程序。在 WebSphere® Application Server 7.0 和更高版本中,现在已不推荐使用此专有的 SOAP over JMS 协议,而是支持使用新兴的符合业界标准的 SOAP over JMS 协议。虽然还是可以对 Java API for XML Web Services (JAX-WS) 或 JAX-RPC Web Service 使用 IBM 专有的 SOAP over JMS 协议,但是,建议使用新兴的标准 SOAP over JMS 协议。如果客户机应用程序调用较低版本的 WebSphere Application Server 支持的基于企业 Bean 的 Web Service,那么您必须继续使用 IBM 专有的 SOAP over JMS 协议来访问这些 Web Service。depfeat

如果需要为客户机或服务器组件提供实现,并且需要确保这些实现可与应用程序服务器中的 Web Service 引擎提供的客户机和服务器组件互操作,那么可以使用 SOAP over JMS 传输。IBM 专有 SOAP over JMS 协议描述客户机和服务器组件的特定消息交换需求,以便它们可以通过使用应用程序服务器所支持的 JMS API 来交换 SOAP 请求和响应消息。

在遵循以下协议约束的情况下,客户机组件负责发送 SOAP 请求消息和接收 SOAP 响应消息:
  • 客户机必须使用 JMS TextMessage 对象(例如,javax.jms.TextMessage)或 BytesMessage 对象(例如,javax.jms.BytesMessage)才能将 SOAP 请求消息发送到服务器。如果请求消息包含附件,那么必须使用 BytesMessage 对象。如果请求消息不包含附件,那么客户机可以使用 TextMessage 或 BytesMessage 对象。由于可能需要传送附件,因此应用程序服务器客户机实现只将 BytesMessage 对象用于请求消息。
  • 在将 JMS 请求消息发送到目标队列或主题之前,客户机必须对该消息设置下列属性:
    • contentType:此属性与 HTTP 消息中出现的 Content-Type 头相似,用来描述消息的内容类型。纯文本 SOAP 消息(例如,不带附件的消息)的编写如下所示:
      text/xml; charset="UTF-8"
      包含附件的 SOAP 请求消息中的 contentType 属性必须按如下所示设置:
      multipart/related; type="text/xml"; start="<...content-id of first part...>" 
      此示例表示一条多重部件消息,其中第一个部件类型为 text/xml 且包含 SOAP 消息。该多重部件消息的其他部件包含不同附件。HTTP 1.1 规范包含有关 Content-Type 头的更多信息。
    • enableTransaction:如果服务器组件要在用于接收来自目标队列或主题的消息的事务下处理 Web Service 请求,那么对出局 SOAP over JMS 请求消息将此可选属性设为 True。客户机组件仅应该对单向请求将此属性设为 True,以避免双向 Web Service 请求中会出现的同步问题。如果此属性未设置或者设为缺省值 False,那么服务器在调用 Web Service 引擎以处理请求之前,将暂挂用于从目标队列或主题接收请求消息的事务。
      避免故障 避免故障: 客户机组件仅应该对单向请求将此属性设为 True。由于同步问题,不支持对双向 Web 服务器请求将此属性设置为 Truegotcha
    • endpointURL:此属性必须设为与请求相关联的 JMS 端点 URL。
    • soapAction:对出局 SOAP over JMS 请求消息设置此可选属性,以指示与 Web Service 请求相关联的 soapAction 值。此属性类似于在通过 HTTP 传输来传输 Web Service 请求时所使用的 SOAPAction HTTP 头。soapAction 属性的值是一个标识 SOAP 请求的意图的 URI。如果 soapAction 属性已指定,那么服务器组件将使用它来确定请求的目标。SOAP 规范未对 URI 的格式或特异性作出任何限制,只要 URI 可解析即可。通常,此属性设置为 WSDL 文档中的 soapAction 值。
    • targetService:此属性必须设为 targetService 属性值,该值出现在请求的 JMS 样式端点位置 URL 中。当分派请求时,服务器组件使用此值来确定目标中的端口组件。
    • transportVersion:此属性指示客户机和服务器使用的协议的版本号。请将该值设为 1。
  • 如果 SOAP 请求消息表示双向请求,那么客户机组件必须设置 JMS 消息的 replyTo 属性来指定用于应答消息的队列。为此,使用 JMS 消息的 setJMSReplyTo 方法。在客户机上配置永久 replyTo 队列比较有益,因为这样做可以使客户机不必在每次作出 Web Service 请求时设置 JMS 消息的 replyTo 属性.
  • 如果 SOAP 请求消息表示单向请求,那么客户机组件不能设置 JMS 消息的 replyTo 属性。
  • 客户机组件必须准备就绪,以处理类型为 BytesMessage 或 TextMessage 对象的应答消息,而不必考虑用来发送 SOAP 请求的 JMS 消息的类型。除非响应包含附件且必须使用 BytesMessage 对象,否则应用程序服务器组件会以从客户机接收到的相同类型的 JMS 消息作出响应。
  • 客户机组件可假定应答消息相关标识与原始请求消息标识相匹配。
在遵循以下协议约束的情况下,服务器组件负责接收 SOAP 请求消息和发送 SOAP 响应消息:
  • 服务器必须准备就绪,以接收 TextMessage 或 BytesMessage。如果请求包含附件,那么必须使用 ByteMessage。除非响应包含附件且使用 BytesMessage,否则在将应答消息发送回客户机时,服务器组件的 WebSphere 产品实现会以同样的方式作出响应。
  • 服务器组件必须正确处理 SOAP 请求,以产生适当的 SOAP 应答消息。
  • 仅当设置了 JMS 请求消息的 replyTo 属性时,服务器组件才需将应答消息发送回客户机。
  • 在将 JMS 应答消息发送到 replyTo 队列之前,服务器组件必须设置该消息中的下列属性:
    • contentType:请参阅客户机职责部分中对此属性的描述。
    • 将 JMS 应答消息的相关标识设为原始 JMS 请求消息的消息标识。通过调用 JMS 消息的 setJMSCorrelationID 方法来完成此操作。
    • transportVersion:此属性指示客户机和服务器使用的协议的版本号。请将该值设为 1。

对于不带附件的请求消息,以下示例显示了调用 JMS 消息的 toString 方法的结果:

JMSMessage class: jms_bytes
JMSType:          null
JMSDeliveryMode:  2
JMSExpiration:    0
JMSPriority:      4
JMSMessageID:     ID:d438eebf04cb124aa25c5821110a134f0000000000000001
JMSTimestamp:     1092110476167
JMSCorrelationID: null
JMSDestination:   topic://NewsGroupTopic?topicSpace=FvtTopicSpace
JMSReplyTo:       null
JMSRedelivered:   false
JMS_IBM_System_MessageID: 6B6765B36943A18C_11000001
transportVersion: 1
JMSXUserID:
targetService: NGConsumerJMS
JMSXAppID: Service Integration Bus
endpointURL: jms:/topic?destination=jms/NewsGroupTopic&connectionFactory;=jms/NewsGroupTCF&targetService;=NGConsumerJMS

contentType: text/xml; charset=utf-8
3c736f6170656e763a456e76656c6f706520786d6c6e733a736f6170656e763d22687474703a2f2f
736368656d61732e786d6c736f61702e6f72672f736f61702f656e76656c6f70652f2220786d6c6e
...
JMSMessage class: jms_bytes
JMSType:          null
JMSDeliveryMode:  2
JMSExpiration:    0
JMSPriority:      4
JMSMessageID:     ID:d438eebf04cb124aa25c5821110a134f0000000000000001
JMSTimestamp:     1092110476167
JMSCorrelationID: null
JMSDestination:   topic://NewsGroupTopic?topicSpace=FvtTopicSpace
JMSReplyTo:       null
JMSRedelivered:   false
JMS_IBM_System_MessageID: 6B6765B36943A18C_11000001
transportVersion: 1
JMSXUserID:
targetService: NGConsumerJMS
JMSXAppID: Service Integration Bus
endpointURL: jms:/topic?destination=jms/NewsGroupTopic&connectionFactory;
  =jms/NewsGroupTCF&targetService;=NGConsumerJMS

contentType: text/xml; charset=utf-8
3c736f6170656e763a456e76656c6f706520786d6c6e733a736f6170656e763d22687474703a2f2f
736368656d61732e786d6c736f61702e6f72672f736f61702f656e76656c6f70652f2220786d6c6e
...
以下 SOAP V1.1 示例显示了先前消息示例中的有效内容:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
	xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<postMessage><ngName xsi:type="xsd:string">news.current.events</ngName>
<msg xsi:type="xsd:string">This is a sample news item.</msg>
</postMessage>
</soapenv:Body>
</soapenv:Envelope>
对于 SOAP V1.2,encodingStyle 参数不受支持,因此该示例看起来为如下所示:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
	xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<postMessage><ngName xsi:type="xsd:string">news.current.events</ngName>
<msg xsi:type="xsd:string">This is a sample news item.</msg>
</postMessage>
</soapenv:Body>
</soapenv:Envelope>
对于带附件的请求消息,以下示例显示了调用 JMS 消息的 toString 方法的结果:
JMSMessage class: jms_bytes
JMSType:          null
JMSDeliveryMode:  1
JMSExpiration:    1092086312310
JMSPriority:      4
JMSMessageID:     ID:4bb64ed64e7d813d59ba5fec110a134f0000000000000001
JMSTimestamp:     1092086012310
JMSCorrelationID: null
JMSDestination:   queue://Logger_Q
JMSReplyTo:       queue://_Q_6B6765B36943A18C_00000385
JMSRedelivered:   false
JMS_IBM_System_MessageID: 6B6765B36943A18C_10000001
transportVersion: 1
JMSXUserID:
targetService: WSLoggerJMS
JMSXAppID: Service Integration Bus
endpointURL: jms:/queue?
destination=jms/Logger_Q&connectionFactory=jms/Logger_CF&targetService=WSLoggerJMS
contentType: multipart/related; type="text/xml"; 
start="<945414389.1092086011970.IBM.WEBSERVICES@myhost1>";     
boundary="----=_Part_0_247953397.1092086011970"
0d0a2d2d2d2d2d2d3d5f506172745f305f3234373935333339372e31303932303836303131393730
0d0a436f6e74656e742d547970653a20746578742f786d6c3b20636861727365743d5554462d380d
...
以下显示了先前消息示例中的有效内容:
Content-Type: multipart/related; type="text/xml";

       start="<945414389.1092086011970.IBM.WEBSERVICES@myhost1>";

       boundary="----=_Part_0_247953397.1092086011970"

 

------=_Part_0_247953397.1092086011970
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: binary
Content-Id: <945414389.1092086011970.IBM.WEBSERVICES@myhost1>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<p499:InternationalizationContext soapenv:mustUnderstand="0"
	xmlns:p499="http://www.ibm.com/webservices/InternationalizationContext">
<Locales>
	<Locale>
		<LanguageCode>en</LanguageCode>
		<CountryCode>US</CountryCode>
	</Locale>
</Locales>
<TimeZoneId>America/Chicago</TimeZoneId>
</p499:InternationalizationContext>
</soapenv:Header>
<soapenv:Body>
	<sendJpegImage/>
</soapenv:Body>
<soapenv:Envelope>
------=_Part_0_247953397.1092086011970
Content-Type: image/jpeg
Content-Transfer-Encoding: binary
Content-ID: <jpegImageRequest=81380956150.1092086011880.IBM.WEBSERVICES@myhost1>
<...contents of jpeg image file...>
对于 SOAP 应答消息,以下示例显示了调用 JMS 消息的 toString 方法的结果:
JMSMessage class: jms_bytes
JMSType:          null
JMSDeliveryMode:  2
JMSExpiration:    0
JMSPriority:      4
JMSMessageID:     null
JMSTimestamp:     0
JMSCorrelationID: ID:cdddb857f078a266eb9a972f110a134f0000000000000001
JMSDestination:   null
JMSReplyTo:       null
JMSRedelivered:   false
contentType:
  multipart/related;
  type="text/xml"; 
  start="<961368106530.1092112854745.IBM.WEBSERVICES@yackerjr>";
  boundary="----=_Part_0_1655006754.1092112854745"
0d0a2d2d2d2d2d2d3d5f506172745f305f313635353030363735342e313039323131323835343734
350d0a436f6e74656e742d547970653a20746578742f786d6c3b20636861727365743d5554462d38
...

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



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