arun singh

arun singh

  • NA
  • 24
  • 0

Java digest web service call using C#

Nov 20 2015 5:55 AM
We tried below code for calling :
C# code :

WSDL Url: http://XXX.XXX.XXX.XXX/ws/SmartMeteringServices?wsdl

webservice Client=new Client();
NetworkCredential myNetworkCredential = new NetworkCredential("username", "password");
CredentialCache myCredentialCache = new CredentialCache();
myCredentialCache.Add(myUrl, "Digest", myNetworkCredential);
Client.PreAuthenticate = true;
Client.Credentials = myNetworkCredential;
Client.getMeteringSamples(1, 3);

2. But when we tried to invoke any of the method from the service it is showing exception. Below are the error details


"401 The HTTP request is unauthorized with client authentication scheme 'Digest'. The authentication header received from the server was 'Digest realm="Sj7Qsdflq", nonce="Zrmhh9tmi4E0ctnTwFte"'.

Please help me out in anyway if you can.