Layer7 API Management

Expand all | Collapse all

.Net Custom Binding Implementation

Jump to Best Answer
  • 1.  .Net Custom Binding Implementation

    Posted 04-24-2017 02:58 AM

    Hi guys,

     

    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.

     

    Regards.

    <?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>






  • 2.  Re: .Net Custom Binding Implementation
    Best Answer

    Posted 04-24-2017 09:41 AM

    Hello,

     

    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.

     

    Regards,

    Azad



  • 3.  Re: .Net Custom Binding Implementation

    Posted 04-24-2017 10:01 AM

    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?



  • 4.  Re: .Net Custom Binding Implementation

    Posted 05-04-2017 12:35 AM

    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).

     

    Sincerely,

     

    Stephen Hughes

    Director, CA Support