In the last few weeks I have been playing around with WCF-SAP adapter, I have many things to write about it in terms of installation, configuration, communication and so on but I will start with this topic/problem.
While trying to create a WCF-SAP Receive port to be able to listener incoming IDOC from the SAP system and despite the receive location be and stay enable in the BizTalk Administration Console I soon realized that the documents were not being picked up by BizTalk.
When I consulted the Event Viewer to check if there were additional information about the causes that were happening I found these three warning messages:
“The adapter “WCF-SAP” raised an error message. Details “System.ServiceModel.CommunicationObjectFaultedException: The communication object, Microsoft.Adapters.Internal.LayeredChannelBindingElement.LayeredInboundChannel`1[System.ServiceModel.Channels.IReplyChannel], cannot be used for communication because it is in the Faulted state.
at System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)
“The adapter “WCF-SAP” raised an error message. Details “The WCF service host at address “sap://CLIENT=[SAPClientID];LANG=[LANG];@A/[SAPServer]/[SystemID]?ListenerGwServ=[GWServer]&ListenerGwHost=[GwHost]&ListenerProgramId=[ProgID]&RfcSdkTrace=True&AbapDebug=False” has faulted and as a result no more messages can be received on the corresponding receive location. To fix the issue, BizTalk Server will automatically attempt to restart the service host.”
“The adapter “WCF-SAP” raised an error message. Details “Microsoft.Adapters.SAP.RFCException: Details: ErrorCode=RFC_FAILURE. AdapterErrorMessage=An exception has occurred on the listener while executing RfcWaitForRequest..
at Microsoft.ServiceModel.Channels.Common.Channels.AdapterReplyChannel.EndTryReceiveRequest(IAsyncResult result, RequestContext& requestContext)
System.ServiceModel.Channels.IReplyChannel.EndTryReceiveRequest(IAsyncResult result, RequestContext& context)
at System.ServiceModel.Dispatcher.ReplyChannelBinder.EndTryReceive(IAsyncResult result, RequestContext& requestContext)”
Well. unfortunately, these errors are generic error messages and do not provide what is really the problem.
So my advice is to first check all the port configurations for any possible configuration mistakes. After that, you should use external network tools that let you dig deep into network traffic and inspect individual packets, for example, Wireshark.
On this particular case I found that the BizTalk Server didn’t have the proper authorization to connect with that particular SAP program id:
ERR*.1.registration of tp [PROGRAM ID] from host [BIZTALK SERVER] not allowed.720.SAP-Gateway.721.2.gwxxrd.c.3644..Thu Feb 5 18:46:11 2015….33844.SAP-Gateway on host [SAP SERVER] / [GWServer]…..*ERR*.
Unfortunately, I’m not an SAP expert and I don’t know exactly what to do in SAP, what I can tell you is that there is nothing wrong in your configuration, this is not a BizTalk problem. What I could see in one of the SAP tools was that BizTalk was trying to connect but it was straight away disconnected.
So to solve this problem you must contact your SAP team to properly configure the access. Once is done everything will work fine, at least in this case it solved my problems.
4 thoughts on “The adapter “WCF-SAP” raised an error message. Details “System.ServiceModel.CommunicationObjectFaultedException: The communication object, Microsoft.Adapters.Internal.LayeredChannelBindingElement.LayeredInboundChannel cannot be used for communication because it is in the Faulted state.”
The message at eventviewer it’s not clear but, Faulted state means there has been an unexpected exception on the server side. means SAP side! LoL.
I actually faced the same issue with the exact same error message. However, the way I used to find the error was different. I enabled the RfcSdkTrace in the WCF-SAP port configuration and was able to see all the traces. It’s good to know that we can also use WireShark to troubleshoot this kind of issues.
I also tend to leverage RfcSdkTrace when I have issues with SAP. Unusually uncovers a vital clue.
Likely the problem is this: