這份 XSD 描述了一個內容管理(WCM)前端服務的 SOAP 介面契約,targetNamespace 為 https://content.front.wcm.it.huawei.com,並同時引入搜尋(search)與業務(busi)兩個命名空間的型別。
<schema xmlns="https://www.w3.org/2001/XMLSchema"
xmlns:tns2="https://busi.wcm.it.huawei.com"
xmlns:tns3="https://search.wcm.it.huawei.com"
xmlns:wsdl="https://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="https://www.w3.org/2001/XMLSchema"
targetNamespace="https://content.front.wcm.it.huawei.com">
<import namespace="https://search.wcm.it.huawei.com"/>
<import namespace="https://busi.wcm.it.huawei.com"/>
每個 element 都成對出現:請求(如 searchUCM)與回應(如 searchUCMResponse)。整體可歸為四類:
檢索類:searchUCM 傳入 WcmContentVO,回傳 WcmContentVO 陣列;searchBusiInfo 與 searchAll 則以 StructuremetaFieldVO 作為查詢條件,回傳同型別的欄位定義陣列。
內容取用類:getContentByDynamicConversion、getContentFromPlaceholder 皆傳入 WcmContentVO 並回傳字串;getFileInfo 傳入 WcmContentVO 並回傳同型別物件;getRelatedContent 回傳 RelatedContentVO 陣列。
快取與生命週期:clearCache 無參數,回傳字串;init 接收 xsd:anyType 型別的 obj;init 與 destroy 的回應都是空序列,屬於無回值的生命週期方法。
值得注意的一點:所有回傳元素都標記為 nillable="true",代表呼叫端必須把 null 當成合法結果來處理,不能假設一定拿得到資料。
三個陣列型別都用同一種寫法:maxOccurs="unbounded" 搭配 minOccurs="0",語意上就是「零到多筆」的清單。
<complexType name="ArrayOf_tns2_nillable_WcmContentVO">
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="WcmContentVO"
nillable="true" type="tns2:WcmContentVO"/>
</sequence>
</complexType>
<complexType name="ArrayOf_tns3_nillable_StructuremetaFieldVO">
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="StructuremetaFieldVO"
nillable="true" type="tns3:StructuremetaFieldVO"/>
</sequence>
</complexType>
<complexType name="ArrayOf_tns2_nillable_RelatedContentVO">
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="RelatedContentVO"
nillable="true" type="tns2:RelatedContentVO"/>
</sequence>
</complexType>
由於元素同時允許 nillable 且允許 0 筆,產生 SOAP 訊息時會出現「空陣列」與「含 null 元素的陣列」兩種情形,客户端反序列化時最好統一處理成空集合,避免後續遍历時出錯。
這份契約把「查詢條件」與「內容載體」都收斂到少數幾個 VO 上:WcmContentVO 既是查詢入參也是回傳結果,StructuremetaFieldVO 負責結構 metadata 的描述。好處是型別數量精簡、擴充欄位方便;代價則是單一 VO 欄位極多(可參考 WcmContentVO 與 RelatedContentVO 的定義),實際呼叫時多數欄位會是 null,需要依情境挑用。
另外,命名空間前綴在文件中混用了 impl: 與 tns2:、tns3:,這是不同工具產生 WSDL 時留下的痕跡。前綴本身不影響語意,但閱讀時要對照宣告處確認實際指向哪個 namespace。