HTTP status 400 when trying to add web service reference to a project

10,334

If you go the service in a browser, you will see the following:

enter image description here

The service owner has disabled metadata publishing, so you will not be able to add a service reference through the Add Service Reference dialog.

If the owner of the service can provide you with the WSDL and other metadata files, you can build a proxy using the ServiceModel Meatadata Utility Tool (SvcUtil.exe); otherwise they may have alternative approaches you can use.

That of course, assumes that this service is intended for public consumption.

Share:
10,334
Kris Harper
Author by

Kris Harper

My popout has 28 characters.

Updated on June 04, 2022

Comments

  • Kris Harper
    Kris Harper about 2 years

    I am trying to add this WCF service reference to my Visual Studio 2012 C# project. When I try to load the service through the add service dialog, I get this error

    There was an error downloading 'https://api.onecallnow.com/WebService/3.1/soap.svc/_vti_bin/ListData.svc/$metadata'. The request failed with HTTP status 400: Bad Request. Metadata contains a reference that cannot be resolved: 'https://api.onecallnow.com/WebService/3.1/soap.svc'. Content Type application/soap+xml; charset=utf-8 was not supported by service https://api.onecallnow.com/WebService/3.1/soap.svc. The client and service bindings may be mismatched. The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'.. If the service is defined in the current solution, try building the solution and adding the service reference again.

    I've looked at other questions with this error, but almost all of them suggest changing something about the WCF service configuration, to which I don't have access.

    Someone suggested that the last part of the message means that I am using a different version of SOAP than the service is using, but I don't see any options to change that in the Add Web Service dialog.

    Can someone help me correctly add this service reference?

  • Kris Harper
    Kris Harper over 10 years
    Yeah, it took me a long time to figure out that you can't consume the service without metadata publishing.