2013-04-09 58 views
1

我挑起wso2ESB錯誤,以便有一些錯誤的客戶端的控制,而ESB控制檯顯示:如何發送WSO2 ESB錯誤消息或異常,以我的客戶

ERROR {org.wso2.carbon.identity.entitlement.mediator.EntitlementMediator} - Error occurred while evaluating the policy {org.wso2.carbon.identity.entitlement.mediator.EntitlementMediator} 
org.apache.axis2.AxisFault: Access Denied. Authentication failed - Invalid credentials provided. 
... 
... 

客戶端控制檯顯示:

org.apache.axiom.soap.SOAPProcessingException: Transport level information does not match with SOAP Message namespace URI 

我看到在控制檯不同的錯誤,我需要ESB的錯誤信息,以便客戶端代碼可以捕捉到同樣的錯誤ESB

在這一刻,我有我的序列「斷層」配置是這樣的:

<sequence xmlns="http://ws.apache.org/ns/synapse" name="fault" trace="enable"> 
    <makefault version="soap12"> 
    <code xmlns:soap12Env="http://www.w3.org/2003/05/soap-envelope" value="soap12Env:Receiver"/> 
    <reason xmlns:ns="http://org.apache.synapse/xsd" expression="get-property('ERROR_MESSAGE')"/> 
    </makefault> 
    <send/> 
</sequence> 

和順序可以這樣來配置我的代理服務的順序:

<sequence xmlns="http://ws.apache.org/ns/synapse" name="InSequence" trace="enable"> 
    <entitlementService remoteServiceUrl="https://localhost:9443/services/" remoteServiceUserName="srxxx" remoteServicePassword="kiytr"> 
     <onReject/> 
     <onAccept/> 
     <advice/> 
     <obligations/> 
    </entitlementService> 
    <header xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" name="wsse:Security" action="remove"/> 
    <send/> 
    <drop/> 
</sequence> 

我試過幾種方法得到的錯誤在我的客戶端,而不成功,如果有人可以幫助我,我將不勝感激這麼多

+0

貴例外發生在接收或期間發送(序列內)? – FiveO 2013-04-10 07:10:00

+0

例外序列內發生,在我的順序是有權利介體在嘗試使用用戶名和指定的,當然這個用戶沒有在身份服務器存在密碼的WSO2身份服務器進行身份驗證,所以會出現異常 – user1750701 2013-04-10 15:02:30

回答

1

配置一個faultSequence代理服務中如下圖所示。你的情況,你必須使用faultSequence內部故障調停。

<faultSequence> 
    <makefault version="soap12"> 
     <code xmlns:soap12Env="http://www.w3.org/2003/05/soap-envelope" value="soap12Env:Receiver"/> 
     <reason xmlns:ns="http://org.apache.synapse/xsd" expression="get-property('ERROR_MESSAGE')"/> 
    </makefault> 
    <send/> 
</faultSequence> 

對於發送時所需的錯誤消息發送到所述客戶端使用以下單證

更多信息

[1] http://docs.wso2.org/wiki/display/ESB460/Error+Handling+and+Error+Codes

[2] http://docs.wso2.org/wiki/display/ESB460/Fault+Mediator

相關問題