1

I've created a new solution with a webservice project and a WPF project in it. After that I've added the webservice reference to the WPF project. This works perfectly in visual studio and I'm able to display data on my WPF application which I've got from the webservice.

Now is my question if I release my webservice to a server where in my WPF do I have to configure the URL of my webservice?

I've already tried the stuff of the following stackoverflow question’s, but nothing worked:

Dynamically switch WCF Web Service Reference URL path through config file - My service class doesn't have an Endpoint property which I could use.

How to Change Web service Address at Runtime? - My service class also doesn't have an URL property which I could change.

Consume a SOAP web service without relying on the app.config - I've added those lines in my config but it's still not connecting to an another webservice.


What am I doing wrong? Or what am I not understanding? I'm new with .NET so i think this could be a beginner fail. Or is the usage of a SOAP Webservice in a WPF project not a good idea?

thmspl
  • 2,437
  • 3
  • 22
  • 48
  • Why aren't you using web api and an inherently url based approach? – Andy Sep 18 '19 at 19:40
  • How are you currently calling the web service from your WPF application? – mm8 Sep 19 '19 at 12:36
  • @Andy I thought the webservice approach would be the better one but I'm a beginner with .NET could be that I've chosen the wrong approach. – thmspl Sep 19 '19 at 13:09
  • @mm8 I'm calling it like this: "Service service = new Service()" and then something like "service.getObjects()". – thmspl Sep 19 '19 at 13:10
  • Do you have any endpoints configured in your `App.config` or where do you set up these? – mm8 Sep 19 '19 at 13:17
  • 1
    Web api just has a url you're going to httppost get, put or delete to. They are rest. The url is just a string so it's trivial to switch out. An "endpoint" is just a public method on a public class inherits from controller. You use httplclient to call one. They are easy because they're simple. Web api is currently the recommended way to offer a web service for these reasons. Nobody uses soap if they can avoid it and wcf is deprecated. https://learn.microsoft.com/en-us/aspnet/web-api/overview/advanced/calling-a-web-api-from-a-net-client – Andy Sep 19 '19 at 14:43

0 Answers0