要设置“文档流定义”,请上载用于定义 Web Service 的 WSDL(Web Service 定义语言)文件,如配置中心所述。 或者,您也可以通过社区控制台手工输入相同的“文档流定义”。
要手工输入相同的“文档流定义”,请遵循创建文档定义流中的步骤。 您还必须在协议 Web Service 下逐一创建文档流、活动和操作各项(如下所述),并要特别注意对于操作及其与收到的 SOAP 消息的关系有何要求。
根据“文档流定义”的包/协议/文档流/活动/操作的层次结构,一个受支持的 Web Service 表示如下:
包:无(名称和代码),版本 N/A
协议:Web Service(名称和代码),版本 1.0
文档流:'{<web service namespace>}:<web
service name>'(名称和代码),这要求在在 Web Service 协议的文档流中是唯一的。这通常是
WSDL 的名称空间和名称。
活动:每个活动对应一个 Web Service 操作,名称和代码为:
'{<operation namespace>}:<operation name>'
操作:每个操作对应一个 Web Service 操作的输入消息,名称和代码为:
'{<namespace of identifying xml element = first child of soap:body>}:<name of identifying xml element = first child of soap:body>'
“操作”是关键的定 义,因为 WebSphere Business Integration Connect 将使用“操作”的名称空间和名称来识别入站 Web Service 请求 SOAP 消息,并根据已定义的参与者连接来正确地路由该消息。 收到的 SOAP 消息 soap:body 元素的第一个 XML 子元素的名称空间和名称必须与 WebSphere Business Integration Connect 文档流定义中某个已知“操作”的名称空间和名称相匹配。
例如,如果 Web Service 请求 SOAP 消息如下(Document-Literal SOAP 绑定):
<?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd= "http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/ 2001/XMLSchema-instance"> <soapenv:Body> <nameAndAddressElt xmlns="http://www.helloworld.com/xsd/helloDocLitSchema"> <titleElt xmlns="">Mr</titleElt> <nameElt xmlns="">Joe Smith</nameElt> <addressElt xmlns=""> <numberElt>123</numberElt> <streetElt>Elm St</streetElt> <cityElt>Peoria</cityElt> </addressElt> </nameAndAddressElt> </soapenv:Body> </soapenv:Envelope>
然后,WebSphere Business Integration Connect 将用下列代码来查找已定义的 Web Service 操作:
{http://www.helloworld.com/xsd/helloDocLitSchema}:nameAndAddressElt
对于 RPC 绑定样式的 SOAP 请求消息,示例如下:
<?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd= "http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/ 2001/XMLSchema-instance"> <soapenv:Body> <ns1:helloWorldRPC soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/ encoding/ xmlns:ns1="http://www.helloworld.com/helloRPC"> <name xsi:type="xsd:string">Joe Smith</name> </ns1:helloWorldRPC> </soapenv:Body> </soapenv:Envelope>
WebSphere Business Integration Connect 将用下列代码来查找已定义的 Web Service 操作:{http://www.helloworld.com/helloRPC}:helloWorldRPC
对于 RPC 绑定,SOAP 请求消息的 soap:body 元素的第一个子元素的名称空间和名称 应该是可用的 Web Service 操作的名称空间和名称。
对于 Document-Literal 绑定,SOAP 请求消息的 soap:body 元素的第一个子元素的名称空间和名称 应该是 Web Service 定义“input”元素“message”属性中“part”元素“element”属性的名称空间和名称。
Web Service 的定义应包含在一个主 WSDL 文件(扩展名为“.wsdl”)中,该文件可能通过“import”元素 导入其它 WSDL 文件。如果有要导入的文件,可以通过下列方法之一将这些文件与主文件一起上载:
例如:
主 WSDL 文件“helloworldRPC.wsdl”包含
“<import namespace="http://www.helloworld.com/wsdl/helloRPC.wsdl" location= "bindingRPC.wsdl"/>”
导入的 WSDL 文件“bindingRPC.wsdl”包含
“<import namespace="http://www.helloworld.com/wsdl/helloRPC.wsdl" location= "port/porttypeRPC.wsdl"/>”
zip 文件应包含以下内容:
名称 路径 helloworldRPC.wsdl bindingRPC.wsdl porttypeRPC.wsdl port\
当上载 Web Service 的 WSDL 文件定义时,原来的 WSDL 保存为“验证映射”。(WebSphere Business Integration Connect 并不真正验证 Web service 消息。 它们直接通过 WebSphere Business Integration Connect,仍使用原来的服务端点 URL。)这称为专用 WSDL。
另外,会用有目标 URL 替换的专用 URL 保存公共 WSDL,就象用户在“文档流上载”输入中所提供的那样。公共 WSDL 将被提供给 Web Service 的用户,用户将在目标 URL(公共 URL)调用 Web Service。WebSphere Business Integration Connect 将把 Web Service 请求路由到网关,该网关具有原始 Web Service 提供者的专用 URL。 WebSphere Business Integration Connect 充当代理,将 Web Service 请求转发到专用的提供者 URL,该 URL 对于 Web Service 用户是隐藏的。
在上载 WSDL 之后,可以从社区控制台下载专用和公共的 WSDL(包括任何导入的文件)。
Business Integration Connect 提供了一种导入 WSDL 文件的方法。如果在一个 WSDL 文件中定义 Web Service,则您可以直接上载该 WSDL 文件。如果使用多个 WSDL 文件定义 Web Service(当您在一个主 WSDL 文件中引入)ZIP 归档的方式上载这些文件。
要点: ZIP 归档中包含的 WSDL 文件必须位于 WSDL import 元素指定的目录中。例如,对于以下 import 元素:<import namespace="http://www.helloworld.com/wsdl/helloRPC.wsdl" location="path1/bindingRPC.wsdl"/>,ZIP 归档内的目录结构将是 path1/bindingRPC.wsdl。 对于另一个示例:<import namespace="http://www.helloworld.com/wsdl/helloRPC.wsdl" location="bindingRPC.wsdl"/>,bindingRPC.wsdl 文件将位于 ZIP 归档的根目录。
要上载单个 WSDL 文件或 ZIP 归档,请使用下列过程。
对于参与者所提供的 Web Service(将被社区管理者所调用),输入带有查询字符串的参与者公共 URL。 例如,http(s)://<target host:port>/bcgreceiver/Receiver?to=<participant business ID>。
在 Business Integration Connect 安装介质上提供了一组 XML 模式,它们描述了可以通过控制台 上载的 XML 文件。将根据这些模式验证上载文件。当不符合标准的 XML 导致不能上载文件时,这些模式文件是确定错误源的有效 参考。这些文件是:wsdl.xsd、wsdlhttp.xsd 和 wsdlsoap.xsd,它们包含描述有效 Web Service 定义语言(WSDL)文件的模式。
这些文件位于:B2BIntegrate\packagingSchemas
为新的 Web Service 创建必需的文档流的最后一步:设置交互,并将同一 Web Service 文档流操作同时作为“源”和“目标”。
要创建交互,请使用下列过程。