20

We have OSB services that are currently secured with a username and a password. I get a 401 unauthorized when attempting to generate a service proxy using svcutil. I know you need to set up a svcutil.exe.config file but I cannot find any examples except for one that passes a certificate.

Dows anyone know how to send a username and password using svcutil?

webwires
  • 2,572
  • 3
  • 26
  • 44

3 Answers3

17

I don't think you can do that.

What you can do in this case is either connect to that address in a browser and just download and save the WSDL file to your local disk and call svcutil.exe on that local copy - or ask the publisher of that webservice to either give you an URL which doesn't require authentication, or to simply send you the relevant WSDL and possibly XSD files so you can create a client side proxy for that service.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • I'm validating what you are saying here: http://msdn.microsoft.com/en-us/library/ms733775.aspx Note: You cannot use configuration to set the user name and password. The configuration shown here must be augmented using code to set the user name and password. – webwires Apr 27 '10 at 20:59
12

You can't authenticate in svcutil, but you can set up credentials in Windows for the target machine. Go to your account management page, then to your stored credentials. Add a new entry with the target hostname and credentials. After this, you can use svcutil with the URL.

ggPeti
  • 865
  • 6
  • 15
  • This works! Very Clever. Thanks. However, as a practical matter, I recommend the OP just download the WSDL! Your code is necessarily coupled to the service interface anyways. If the service interface changes, the small manual step of updating the wsdl file will be trivial compared to modifying or testing your code in connection with the actual changes to the service interface. Manually updating the WSDL gives you control of when this happens. The WSDL is a contract, the consuming party should be aware of when it changes. – DanO Jan 17 '13 at 19:03
-3

Try this. This should work with any web page requiring username and password.

svcutil http://user:password@someurl?wsdl
Czenda
  • 103
  • 1
  • 5