我遇到了一個小問題..有My Mule流程.. 我將一個SOAP有效內容從Message Enricher組件傳遞到外部Web服務,的想法是讓來自外部Web服務的響應特定的屬性值和值存儲在流量變量... 現在,外部web服務響應的響應如下: -如何使用Enricher將外部Web服務響應值存儲在流變量中
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<getDesignationResponse xmlns="http://services.test.getDesignation.com/schema/MainData/V1">
<DesignationCodeResult>Junior Developer</DesignationCodeResult>
<Code>Success</Code>
</getDesignationResponse>
</soap:Body>
</soap:Envelope>
現在這裏是我的流程: -
<flow name="testFlow1" doc:name="testFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="test" doc:name="HTTP"/>
<set-payload value="<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://services.test.getDesignation.com/schema/MainData/V1"><soapenv:Header/><soapenv:Body><v1:getDesignationRequest><v1:DesignationCode>jd</v1:DesignationCode></v1:getDesignationRequest></soapenv:Body></soapenv:Envelope>" doc:name="Set Payload"/>
<enricher source="#[xpath://getDesignationResponse/DesignationCodeResult]" target="#[variable:myVal]" doc:name="Message Enricher">
<processor-chain doc:name="Processor Chain">
<http:outbound-endpoint exchange-pattern="request-response" method="POST" address="http://localhost:8090/designation" responseTimeout="100000" doc:name="HTTP" />
<mulexml:dom-to-xml-transformer doc:name="DOM to XML"/>
<logger message="Value from response #[xpath://getDesignationResponse/DesignationCodeResult]" level="INFO" doc:name="Logger"/>
</processor-chain>
</enricher>
</flow>
現在你可以看到我想要的價值#[xpath://getDesignationResponse/DesignationCodeResult]
存儲到流量變量設爲myVal ..
現在我得到以下異常: -
Exception stack is:
1. Expression Evaluator "header" with expression "invocation:myVal" returned null but a value was required. (org.mule.api.expression.RequiredValueException)
org.mule.expression.ExpressionUtils:235 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/expression/RequiredValueException.html)
2. Expression Evaluator "header" with expression "invocation:myVal" returned null but a value was required. (org.mule.api.expression.RequiredValueException). Message payload is of type: String (org.mule.api.MessagingException)
org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor:32 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
org.mule.api.expression.RequiredValueException: Expression Evaluator "header" with expression "invocation:myVal" returned null but a value was required.
at org.mule.expression.ExpressionUtils.getPropertyInternal(ExpressionUtils.java:235)
at org.mule.expression.ExpressionUtils.getProperty(ExpressionUtils.java:85)
at org.mule.expression.ExpressionUtils.getProperty(ExpressionUtils.java:72)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
但我已經把記錄器內的富集<logger message="Value from response #[xpath://getDesignationResponse/DesignationCodeResult]" level="INFO" doc:name="Logger"/>
,我所獲得的價值有.. 不過,我不能把使用濃縮塔... 在流量變量提取值請幫助..
如果刪除記錄器是什麼?我想知道如果你正在使用記錄器的HTTP響應輸入流,從而使它不可用的豐富... – 2014-09-29 13:50:37
試圖從Enricher刪除記錄器...我得到相同的例外 – 2014-09-29 14:08:10