Search code examples
c#wcfbiztalk

Getting Error (405) "MethodNotAllowed" when calling a web service with "PUT" method from Biztalk WCF-WebHttp adapter in send port


I am trying to consume a rest-service which supports PUT operation method type. And I am trying this using BizTalk WCF-WebHttp static send port. But Always it returns error as

System.Net.WebException: The remote server returned an unexpected response: (405) MethodNotAllowed.

Not getting what am I doing wrong or did I miss anything.

I tried consuming the same rest service using Postman and it is working.

Also I tried with consuming the service using BizTalk dynamic ports and it works.

I have configured "HTTP Method and URL Mapping" as below:

<BtsHttpUrlMapping><Operation Method = "PUT" /></BtsHttpUrlMapping>
Security Mode : None
Content-Type: application/json

I want this to work with static BizTalk send port using WCF-Webhttp adapter.


Solution

  • In your "HTTP Method and URL Mapping" you either need to just have just

    PUT
    

    or

    <BtsHttpUrlMapping><Operation Name="OpName" Method = "PUT" /></BtsHttpUrlMapping>
    

    where OpName matches the Operation context property on the message.