2
votes

I am using Azure API Management Soap Pass through URL(ENdpoint) It has subscription key for authentication.

But when I add wsdl web endpoint have only base address and not header. And after web service call I am getting the error:

{"The HTTP request is unauthorized with client authentication scheme 'Anonymous'.
The authentication header received from the server was 'Key realm=\"https:\url\",name=\"Key\",type=\"header\"'."}

I guess I am missing passing a header.

How to pass header to call web api endpoint? We cant mention it in web.config.

1
Just to confirm, you are building a Web API, that wants to call an SOAP endpoint. You have imported the WSDL into APIM and when you call APIM from your ASP.NET Web API you are getting the error above back. Is that correct? - Darrel Miller
Not sure if this the same issue that was also reported on MSDN forums but there currently is a bug with APIM Soap Passthrough and using the subscription-key query parameter. We are working on a fix currently. - Darrel Miller

1 Answers

1
votes

Actually you should not use the subscription key for authentication.

I guess APIM will forward all headers by default. But if not, you can try something like this:

<set-header name="Ocp-Apim-Subscription-Key" exists-action="override">
    <value>@(context.Request.Headers.GetValueOrDefault("Ocp-Apim-Subscription-Key", ""))</value>
</set-header>