【发布时间】:2015-07-21 16:50:40
【问题描述】:
我遇到了一个小问题 .. 有 My Mule 流程 .. 我将 SOAP 有效负载从 Message Enricher 组件传递给外部 Web 服务,想法是从外部 Web 服务响应中获取特定属性值并将该值存储在流变量中...... 现在,外部 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)
********************************************************************************
但我已经在 Enricher <logger message="Value from response #[xpath://getDesignationResponse/DesignationCodeResult]" level="INFO" doc:name="Logger"/> 中放置了一个记录器,我在那里得到了价值..
但是我无法使用 Enricher 在流变量中分配提取的值...
请帮忙..
【问题讨论】:
-
如果删除记录器会怎样?我想知道您是否正在使用记录器使用 HTTP 响应输入流,从而使其对浓缩器不可用...
-
尝试从 Enricher 中删除记录器......我得到了同样的异常
标签: mule mule-studio