In the last few weeks, I have been playing around with the WCF-SAP adapter. I have many things to write about 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 was 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)
at System.ServiceModel.Channels.CommunicationObject.Close()
at System.ServiceModel.Dispatcher.ErrorHandlingReceiver.Close()”.
“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.Design.AdapterAsyncResult.End()
at Microsoft.ServiceModel.Channels.Common.Channels.AdapterReplyChannel.EndTryReceiveRequest(IAsyncResult result, RequestContext& requestContext)
at Microsoft.Adapters.Internal.LayeredChannelBindingElement.LayeredInboundChannel`1.
System.ServiceModel.Channels.IReplyChannel.EndTryReceiveRequest(IAsyncResult result, RequestContext& context)
at System.ServiceModel.Dispatcher.ReplyChannelBinder.EndTryReceive(IAsyncResult result, RequestContext& requestContext)”

📝 One-Minute Brief
When a BizTalk WCF-SAP Receive Location stays enabled but fails to pick up IDOCs, you may see a “CommunicationObjectFaultedException” in the Event Viewer. This generic error often masks a permission issue on the SAP side. While your BizTalk configuration may be correct, you likely need the SAP team to authorize the BizTalk Server’s Program ID on the SAP Gateway.
Cause
Well. Unfortunately, these errors are generic error messages and do not provide what the real problem is.
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.
In 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*.

Solution
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 with 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 disconnected straight away.
So, to solve this problem, you must contact your SAP team to properly configure the access. Once it is done, everything will work fine, at least in this case, it solved my problems.
Hope you find this helpful! If you liked the content or found it useful and would like to support me in writing more, consider buying (or helping to buy) a Star Wars Lego set for my son.
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.
Hi Sandro,
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.
Kent
Likely the problem is this:
https://blogs.sap.com/2013/06/06/registration-of-external-program-on-sap-gateway-not-allowed/