Recently while I was testing an integration solution on a client that uses a WCF-SAP adapter to receive an IDOC from the SAP system I got the following error:
The Messaging Engine failed to add a receive location “IN_IDOC_SAP” with URL “sap://CLIENT=003;LANG=EN;@a/ip-addres/00?ListenerGwHost=ip-address&ListenerGwServ=sapgw00&ListenerProgramId=name” to the adapter “WCF-SAP”. Reason: “Microsoft.ServiceModel.Channels.Common.ConnectionException: The parameter Program Id required for SAP Inbound Handler was not specified.
I knew I had this error in the past. Still, I couldn’t remember the reason immediately 🙂 – this is one of the main reasons I often blog about the errors I face and solutions I found, my blog serves as my notes, and I’m one of the primary consumers of my blog.
Cause
Of course, and as always, there may be several reasons to face this problem, but in my case, the reason was quite simple.
If you pay attention to the URI on the error message and that highlight below:
- sap://CLIENT=003;LANG=EN;@a/ip-addres/00?ListenerGwHost=ip-address&ListenerGwServ=sapgw00&ListenerProgramId=name
You will see that we are using the ampersand as an HTML entity (&) and we cannot in this case we need to use only the character &.
Solution
To solve this issue, you need to fix the URI to use the character &, instead of the HTML entity (&):
- sap://CLIENT=003;LANG=EN;@a/ip-addres/00?ListenerGwHost=ip-address&ListenerGwServ=sapgw00&ListenerProgramId=name