Reputation: 1033
I'm having trouble understanding how to consume an existing ServiceStack based web service (https://cert.web.transaction.transactionexpress.com/TransFirst.Transaction.Web/api/). I am using a standard vstudio .net 4.6 aspnet website c# form.
I tried adding the base service uri as a service reference to my existing project (Website > Add Service Reference > URI) but on building my solution I receive error: [Error: failed to generate code for the service reference. Cannot import wsdl:portType...].
I would like to think that I can interact with this service without manually building object definitions, so I must be missing a step.
Two questions:
1. Has anyone else worked with this particular service? Or can you suggest how to generate object definitions from this service?
2. Am I incorrectly assuming that generating the object definitions will give me full VStudio intellisense on my httpclient?
Upvotes: 1
Views: 253
Reputation: 143319
Since this is a ServiceStack Web Service you can use C# Add ServiceStack Reference to generate a Typed API in C# which you can use with ServiceStack's C# Service Clients.
The BaseUrl
for this Service is:
https://cert.web.transaction.transactionexpress.com/TransFirst.Transaction.Web/api/
So if you install ServiceStack VS from VS.NET Extension gallery:
You can create a Typed C# API by clicking on Add ServiceStack Reference on your project:
Then you can use the Typed DTOs with ServiceStack's generic Service Clients, e.g:
var baseUrl = "https://cert.web.transaction.transactionexpress.com/TransFirst.Transaction.Web/api/";
var client = new JsonServiceClient(baseUrl);
var response = client.Post(new CreateCustomReport { ... });
Upvotes: 3