當您執行 BizTalk Web 服務發布精靈時,您會將 SOAP 標頭新增至 Web 服務。 當您發佈支援 SOAP 標頭的 Web 服務時,協調流程和管線元件可以使用標頭做為內容屬性,其中包含 SOAP 標頭的字串表示。
定義的SOAP標頭
當您使用精靈新增定義的SOAP標頭時,精靈會建立內容屬性,其名稱會對應至SOAP標頭的根元素。 所有定義的 SOAP 標頭內容屬性都有 命名空間 http://schemas.microsoft.com/BizTalk/2003/SOAPHeader。 當 SOAP 配接器將 SOAP 要求轉換為 BizTalk 訊息時,它會建立一個 SOAP 標頭內容屬性。
下列範例顯示簡單的 SOAP 要求:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header>
<OrigDest xmlns="http://SOAPHeaderWS.ItemAvailability">
<Origination>Work</Origination>
<Destination>Home</Destination>
</OrigDest>
</soap:Header>
<soap:Body>
</soap:Body>
</soap:Envelope>
針對簡單的SOAP要求,SOAP配接器會使用一個SOAP標頭內容屬性 OrigDest 和字串建立 BizTalk 訊息。
下列範例顯示 SOAP 配接器所建立的字串:
"<?xml version="1.0" encoding="utf-16"?><OrigDest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://SOAPHeaderSchemas.OrigDestSOAPHeader"><Origination xmlns="">Home</Origination><Destination xmlns="">Work</Destination> </OrigDest>"
未知的 SOAP 標頭
如果您選擇在精靈中支援未知的SOAP標頭,精靈會建立名為 UnknownHeaders 和命名空間 http://schemas.microsoft.com/BizTalk/2003/soap-properties的內容屬性。
UnknownHeaders 內容屬性包含所有收到的未知 SOAP 標頭。
例如,如果您收到具有根元素名稱 CustomerGroup 的未知 SOAP 標頭, UnknownHeaders 內容屬性會包含字串:
"<?xml version="1.0" encoding="utf-16"?><UnknownHeaders><CustomerGroup xmlns="http://SOAPHeaderWS/CustomerGroup"><Id xmlns="">My Customer</Id>
</CustomerGroup></UnknownHeaders>"
如需新增已定義 SOAP 標頭或支援未知 SOAP 標頭的詳細資訊,請參閱 將協調流程發佈為 Web 服務。 另請參閱 將架構發佈為 Web 服務。