本文描述OSB Message-Level Custom Security的實現過程(demo)
1、創建test.wsdl文件,其中包括傳遞進來用於驗證身份的用戶名和密碼:user,pwd. 如下圖所示:
2、創建兩個proxyservices:psSyncData.proxy和psStar.proxy
其中psSyncData.proxy主要用於處理業務邏輯和驗證身份,psStar.proxy則是爲psSyncData.proxy提供驗證信息的信息提供者
對於psStar.proxy的設置如下:
1)在Message Flow中設置Routing,Routing的service指向psSyncData.proxy;
2)在Request Action中設置兩個insert,向header變量中插入兩個參數user和pwd,這倆參數會在psSyncData.proxy的security中被引用;
psSyncData.proxy需要做設置如下:
1)Service Type選擇:Any Type SOAP Service
2)在security tab中,選擇Custom User Name and Password並定義User Name/Password XPath,如下圖:
3)在Mssage Flow中,調用業務處理所用的businessServices,並將Soap的header替換還原成正確的,否則可能會引起Internal Server Error
以上傳入的用戶名和密碼是用weblogic進行驗證的,因此用戶名和密碼需要預先在weblogic的安全域裏設置好。
以上爲Message -Level Custom Security的簡單設置步驟
常見報錯:
soapenv:Server
BEA-386101: Missing authentication token
原因爲:在ProxyServices中設置的user和password與soap header中設置token不一致。
如在soap header中設置如下: