Hello
I’m trying to setup a service reference within Visual Studio to write code against the API.
The last time I worked with web services a few years ago I entered a WSDL url in order to generate all the methods within visual studio.
I’ve tried entering the companies house api url in the service details. I get prompted for credentials but it doesn’t accept my key
Can anyone advise if I’m going about this the right way?
Many thanks
Caveat: I don’t use Visual Studio and I’m just another forum user
Short: there currently isn’t a WSDL file for this API that I know of, or indeed any automatically discoverable specification. (Anyone who does know of one please post!) So it’s read the documentation and build it yourself. The documentation has errors (search forum) but the Authorisation documents work plus there are plenty of examples for various languages searchable on this forum.
Longer: some time ago (early 2016) CH advised that they used Swagger - at least for generating the CH documentation. This would be the equivalent of WSDL - I believe it’s now termed the Open API Specification (OAS). CH never released their spec. Intentions to do so were mentioned in:
http://forum.aws.chdev.org/t/swagger-specification/471
There was another mention in 2017, but nothing since, and the documentation doesn’t seem to be updated:
http://forum.aws.chdev.org/t/swagger-specifications-for-ch-api/924
If this were available you could probably use Swagger’s Codegen tool to create stub code for the service. There are about 40 language generators listed for Swagger Codegen including c++, C#, C#.NET etc.
I’m sure people are rolling their own (OAS) for parts of CH, and we may eventually run their process in reverse e.g. CH documentation → (patch errors) → Swagger / OAS.
An alternative route would be to go down the XML / SOAP path with the (subscription-based) XML API (Companies House Gateway). I presume there’s the full WSDL etc. There’s an overview at About our services - Companies House - GOV.UK, documentation at http://xmlgw.companieshouse.gov.uk/ and a forum at http://xmlforum.aws.chdev.org/
Hope this helps,
Chris