在使用SOAP和SugarCRM Connector(http://mulesoft.github.io/sugarcrm-connector/)的应用程序Mule上发生错误Invalid Session ID
。
但是在这种情况下会出现此错误:
修改
2016-03-24 12:31:30,470 [pool-106-thread-1]错误 org.mule.retry.notifiers.ConnectNotifier - 失败 连接/重新连接:工作描述符。 Root Exception是:无效 会话ID。键入:class org.apache.cxf.binding.soap.SoapFault 2016-03-24 12:31:30,471 [pool-106-thread-1]错误 org.mule.exception.DefaultMessagingExceptionStrategy - ************************************************** ******************************消息:无法调用getEntryList。消息负载 是类型:GetEntryListRequest代码: MULE_ERROR-29999 -------------------------------------------------- ------------------------------异常堆栈是: 1.无效的会话ID(org.apache.cxf.binding.soap.SoapFault)org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor:84 (空值) 2.无效的会话ID(javax.xml.ws.soap.SOAPFaultException)org.apache.cxf.jaxws.JaxWsClientProxy:158 (http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/xml/ws/soap/SOAPFaultException.html) 3.无法调用getEntryList。消息有效内容的类型为:GetEntryListRequest(org.mule.api.MessagingException)
org.mule.devkit.processor.DevkitBasedMessageProcessor:133 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html) -------------------------------------------------- ------------------------------ Root异常堆栈跟踪:org.apache.cxf.binding.soap.SoapFault: 会话ID无效 org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:84) 在 org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:51) 在 org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:40) + 3个以上(设置调试级别日志记录或'-Dmule.verbose.exceptions = true'用于所有内容)2016-03-24 12:31:40,471 [pool-106-thread-1]错误 org.mule.retry.notifiers.ConnectNotifier - 失败 连接/重新连接:工作描述符。 Root Exception是:无效 会话ID。键入:class org.apache.cxf.binding.soap.SoapFault 2016-03-24 12:31:40,472 [pool-106-thread-1]错误 org.mule.exception.DefaultMessagingExceptionStrategy - ************************************************** ******************************消息:无法调用getEntryList。消息负载 是类型:GetEntryListRequest代码: MULE_ERROR-29999 -------------------------------------------------- ------------------------------异常堆栈是: 1.无效的会话ID(org.apache.cxf.binding.soap.SoapFault)org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor:84 (空值) 2.无效的会话ID(javax.xml.ws.soap.SOAPFaultException)org.apache.cxf.jaxws.JaxWsClientProxy:158 (http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/xml/ws/soap/SOAPFaultException.html) 3.无法调用getEntryList。消息有效内容的类型为:GetEntryListRequest(org.mule.api.MessagingException)
org.mule.devkit.processor.DevkitBasedMessageProcessor:133 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html) -------------------------------------------------- ------------------------------ Root异常堆栈跟踪:org.apache.cxf.binding.soap.SoapFault: 会话ID无效 org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:84) 在 org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:51) 在 org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:40) + 3个以上(设置调试级别日志记录或'-Dmule.verbose.exceptions = true'用于所有内容)
我根据下图配置了重新连接,但没有错误继续。
修改
XML配置(简化)
<db:oracle-config name="Oracle_Configuration" host="${db.host}" port="${db.port}" instance="${db.instance}" user="${db.user}" password="${db.password}" doc:name="Oracle Configuration">
<db:pooling-profile/>
</db:oracle-config>
<sugar:config name="Sugar__Configuration" username="${crm.ws.user}" password="${crm.ws.password}" endpoint="${crm.ws.endpoint}" doc:name="Sugar: Configuration">
<sugar:connection-pooling-profile initialisationPolicy="INITIALISE_ONE" exhaustedAction="WHEN_EXHAUSTED_GROW"/>
<reconnect-forever frequency="60000"/>
</sugar:config>
<flow name="produto-precoFlow" processingStrategy="synchronous">
<poll doc:name="Poll" doc:description="Produto">
<fixed-frequency-scheduler frequency="10000"/>
<watermark variable="carimboTempo" default-expression="2016-02-24 00:00:00" selector="MAX" selector-expression="#[message.payload.datalt]"/>
<db:select config-ref="Oracle_Configuration" doc:name="Database">
<db:parameterized-query><![CDATA[SELECT * FROM PRODUTO WHERE TO_CHAR(DATALT, 'yyyy-mm-dd hh24:mi:ss') > #[flowVars.carimboTempo]]]></db:parameterized-query>
</db:select>
</poll>
<foreach doc:name="For Each">
<enricher target="#[payload.produtoPrecoSugar]" doc:name="Message Enricher Produto">
<flow-ref name="produto-precoSub_FlowProduto" doc:name="produto-precoSub_FlowProduto"/>
</enricher>
// [...] mode code here (original)
<scripting:component doc:name="Groovy Inserir/Alterar">
<scripting:script engine="Groovy"><![CDATA[import org.mule.modules.sugarcrm.request.SetEntryRequest;
import com.sugarcrm.sugarcrm.NameValue;
req = new SetEntryRequest();
req.setModuleName("AOS_Products");
nameValues = [];
for ( e in message.payload ) {
nameValue = new NameValue();
nameValue.setName(e.key);
nameValue.setValue(e.value.toString());
nameValues.add(nameValue);
}
req.setNameValueList(nameValues);
return req;]]></scripting:script>
</scripting:component>
<sugar:set-entry config-ref="Sugar__Configuration" doc:name="Sugar Inserir/Alterar"/>
</foreach>
</flow>
<sub-flow name="produto-precoSub_FlowProduto">
<scripting:component doc:name="Groovy Id Produto">
<scripting:script engine="Groovy"><![CDATA[import org.mule.modules.sugarcrm.request.GetEntryListRequest;
req = new GetEntryListRequest();
req.setModuleName("AOS_Products");
whereQuery = "aos_products.deleted = 0";
for ( e in message.payload ) {
if (e.key == "sapiens_codtpr_c" || e.key == "sapiens_datini_c" || e.key == "sapiens_codser_c") {
whereQuery = whereQuery + " and " + e.key + " = '" + e.value.toString() + "'";
} else if (e.key == "sapiens_codemp_c" || e.key == "sapiens_qtdmax_c") {
whereQuery = whereQuery + " and " + e.key + " = " + e.value.toString();
}
}
req.setQuery(whereQuery);
req.setSelectFields(["id"]);
req.setDeleted(0);
return req;
]]></scripting:script>
</scripting:component>
<sugar:get-entry-list config-ref="Sugar__Configuration" doc:name="Sugar Id Produto e Preço"/>
</sub-flow>
可能是什么?有没有表格可以解决这个问题?
答案 0 :(得分:0)
查看Source,我们可以看到只有会话ID存在才认为Sugar连接有效:
@ValidateConnection
public boolean isConnected() {
return sessionId != null;
}
这意味着即使会话过期,连接也将被视为活动状态。这可能被视为一个错误,并报告给MuleSoft。
请注意,在重新连接策略到位后,预期的行为将是:
如果您没有观察到这种行为,即如果重新连接策略在失败的出站操作后没有启动,这可能是需要向MuleSoft报告的错误。