We are facing a problem while consuming a web service.
We have a VPN Connection with a company and trying to consume their web services.
I have the following custom binding in my application(.Net) and it works without problem.
However when I publish this service on our API Gateway, the service returns 415 error.
Any help would be appreciated.
<?xml version="1.0" encoding="utf-8"?><configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" /> </startup> <system.serviceModel> <bindings> <customBinding> <binding name="myUsernameOverHttpBinding02"> <textMessageEncoding messageVersion="Soap12WSAddressingAugust2004" /> <security authenticationMode="UserNameOverTransport" allowInsecureTransport="False " /> <httpsTransport /> </binding> </customBinding> </bindings> <client> <endpoint address="https://***" binding="customBinding" bindingConfiguration="myUsernameOverHttpBinding02" contract="yyy.myContract" name="myUsernameOverHttpBinding02" /> </client> </system.serviceModel> <system.net> <defaultProxy enabled="false" useDefaultCredentials="false"> <bypasslist> <add address="https://***"></add> </bypasslist> </defaultProxy> </system.net></configuration>
A response code of 415 means that the media type is unsupported. The most likely case is that you are either missing the Content-Type header in your request, or it's incorrect.
I have tried various content types(text/xml, application/xml, etc.), but no luck.
What should I do in this case?
Should I track the requests via fiddler and find the correct content-type which .Net generates?
When using custom bindings, if I choose gateway not to modify headers, does gateway pass these configurations to the provider service?
Tracking the request payload and headers with tools like Fiddler or Wireshark help expose what is being sent through to the endpoint. From reviewing the code it appears that you are using WS Addressing in the message along with Username and Password at the transport layer (Authentication Header).
As for the modification of headers if you choose to route all HTTP Headers in the HTTP Routing assertion then everything sent it should be transmitted to the back-end minus a few outlined on this documentation page ( Route via HTTP(S) Assertion - CA API Gateway - 9.2 - CA Technologies Documentation https://docops.ca.com/ca-api-gateway/9-2/en/policy-assertions/assertion-palette/message-routing-assertions/route-via-http-s-assertion#RouteviaHTTP(S)Assertion-Configuringthe[Headers]Tab).
Director, CA Support