Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot add service reference

I'm trying to consume a SOAP web-service, specifically:

http://api.affiliatewindow.com/v4/AffiliateService?wsdl

However - after using the standard Webservices dialog to add a service reference - none of the operations are available on the generated classes - it's just empty:

Empty sadness

I've tried changing all different combinations of options on the 'add reference' dialogue.

Is there another approach to adding references of this type?

(note: in order to actually invoke the operations, the service is expecting a username/password header - Perhaps I need to include that whilst generating the classes? If so - how?)

like image 377
Dave Bish Avatar asked Sep 14 '15 18:09

Dave Bish


People also ask

How do I add a service reference in class library?

In the Solution Explorer right-click on YourSolution/YourProject/References. Select "Add Service Reference..." from the context menu. In the Add Service Reference dialog, enter the service metadata endpoint URL in Address line and press Go button. Select a service from the list and specify Namespace.

How do I add a service reference in net standard project?

NET Standard project, this option is available when you right-click on the Dependencies node of the project in Solution Explorer and choose Manage Connected Services.) On the Connected Services page, select Add Service Reference.


1 Answers

I used the Web Services Description Language Utility (Wsdl.exe) to generate the proxy class manually.

wsdl http://api.affiliatewindow.com/v4/AffiliateService?wsdl /namespace:AffiliateWindow

I like using namespace option so none of the objects with have a conflict with my current solution.

wsdl command line

Then I can add the resulting code file to your solution. I have attached a screenshot of the Object Browser from the solution:

object browser

Now, you can instantiate the service as you wish:

// I don't know anything about Affiliate Window - but I am assuming you would use it
// like the following code below

AffiliateWindow.UserAuthentication auth = new AffiliateWindow.UserAuthentication();
auth.sType = AffiliateWindow.UserType.affiliate;
auth.sPassword = "123456";

AffiliateWindow.ApiService svc = new AffiliateWindow.ApiService();
svc.UserAuthenticationValue = auth;
like image 91
Black Frog Avatar answered Oct 04 '22 06:10

Black Frog