dotnet / dotnet/wcf

HttpStatusCode not exposed in API when generating Web Service proxy through Svcutil

Open
#5,263 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1.8k
Forks
576
Avg merge
6d 9h
Merged PRs (30d)
2

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

The [dotnet-svcutil.exe](https://www.nuget.org/packages/dotnet-svcutil) tool is very useful when generating a C# proxy client for an existing webservice using it's exposed WSDL file. I believe that Visual Studio might be using the same tool to generate the proxy client under the hood but it is just my guess. However I don't find any way to access the HttpStatusCode that is sent back by the server from the generated proxy. The proxy throws a FaultException in case not HttpStatusCode 200 (ok) that gives you the state of the SOAP based exception information from the generated proxy, but nothing AFAIK from the underlying HTTP connection and what StatusCode it was. It is useful information for the client application to be able to get hold of the HttpStatusCode. For instance HTTP 403 would signify that the client is overloading the web service and need to reduce the number of calls. So the generated Web Service proxy should not hide this information.

### Describe the solution you'd like

The only viable workaround now I see is to use an HttpClient from the .NET Framework and skip the SOAP implemented logic that the dotnet-svcutil.exe provides (the domain model can still be used).

**But perhaps there is another workaround or that dotnet-svcutil.exe could be enhanced to also expose the HttpStatusCode?**

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.