Search code examples
c#jsonwcfbiztalk

Error while posting message to Mule service from BizTalk WCF-WebHttp adapter: Content Type application/json not supported by service


I am trying to post a message to a Mule mocking service which HTTPs binding. I can see the message being converted to the appropriate JSON format before it is posted to the Mulesoft's service.

I have even tried posting this message directly to the service using Postman and it works fine. But when sending the same message through WCF-WebHttp adapter, I keep getting the following error:

Error while posting a message to Mule service from BizTalk WCF-WebHttp adapter: Content Type application/json not supported by service https://anypoint.mulesoft.com/mocking/api/v1/links/uuid/uriparam The client and service bindings may be mismatched. {"code":"INVALID_RESPONSE_ACCEPT_HEADER","message:"Error trying to find response for invalid media type"}*

The WCF-WebHttp adapter is configured to use Security Mode as Transport and Transport client credential type as None since service doesn't require any authentication or certificate.

Please note the same BizTalk application was configured to push message to dummy Mulesoft cloud hub service and it worked fine with HTTP URL for the same message content.


Solution

  • The error looks like related to Accept header. you should set Accept header with value */* while sending the request from BizTalk. postman adds the header automatically.

    If this does not work, then use Postman Console logs to view headers the actual request and response and compare it with BizTalk request and response. To view BizTalk request details use Fiddler (You can set http://localhost:8888 as proxy after running fiddler on machine where you are sending the request from) and then compare both results and correct the mismatch accordingly.