2
votes

Dear friends. I encountered the following problem: I developed a system service using Mule ESB. The aim was to processing a large number of records and therefore during process there were frequent connections to MS CRM Dynamics Onpremise. However, in the middle of treatment (after about 30 min, although this time varies) each subsequent request ends with the following error:


Exception stack is: 1. The security context token is expired or is not valid. The message was not processed. (org.apache.cxf.binding.soap.SoapFault)    org.apache.cxf.binding.soap.interceptor.Soap12FaultInInterceptor: 133 (null) 2. The security context token is expired or is not valid. The message was not processed. (javax.xml.ws.soap.SOAPFaultException)    org.apache.cxf.jaxws.JaxWsClientProxy: 156 (http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/xml/ws/soap/SOAPFaultException.html) 3. Failed to invoke retrieveMultipleByQuery. Message payload is of type: HashMap (org.mule.api.MessagingException)    org.mule.module.dynamicscrmonpremise.processors.RetrieveMultipleByQueryMessageProcessor: 141 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)


Could you tell me where I could make a mistake and how to fix it?

1

1 Answers

0
votes

This in in the Best Practices section of the CRM development SDK.

https://msdn.microsoft.com/en-us/library/gg509027.aspx

To summarize, you'll have a class that is checking your WCF security token to make sure its valid, and to refresh it before it expires.

In addition, monitor your WCF security token (Token) and refresh it before it expires so that you do not lose the token and have to start over with authentication. To check the token, create a custom class that inherits from the OrganizationServiceProxy or DiscoveryServiceProxy class and that implements the business logic to check the token. Or wrap the proxy classes in a new class. Another technique is to explicitly check the token before each call to the web service. Example code that demonstrates these techniques can be found in the ManagedTokenDiscoveryServiceProxy, ManagedTokenOrganizationServiceProxy, and AutoRefreshSecurityToken classes in the Helper code: ServerConnection class topic.