Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Need to call a web service using certificates!

Reply
Thread Tools

Need to call a web service using certificates!

 
 
jens Jensen
Guest
Posts: n/a
 
      03-21-2006

Hello,

I'm developing a solution on my win xp and need to connect to webservice
that just uses xml over http.
I'm provided with a pair of certificates.

My code start with the following:

store.Certificates.Find(

X509FindType.FindBySubjectDistinguishedName,

"CN=Mario, CN=Szpuszta", false);



From the pair of certificates, how do idenfy CN , and CN?



Maybe i just need basic understand of x509 certs.





Many thanks in advance:



Here the entire code;



// Read the certificate from the store

X509Store store = new X509Store(StoreName.My, StoreLocation.LocalMachine);

store.Open(OpenFlags.ReadOnly);

try

{

// Try to find the certificate

// based on its common name

X509Certificate2Collection Results =

store.Certificates.Find(

X509FindType.FindBySubjectDistinguishedName,

"CN=Mario, CN=Szpuszta", false);

if (Results.Count == 0)

throw new Exception("Unable to find certificate!");

else

{

Certificate = Results[0];

HttpWebRequest req =
(HttpWebRequest)HttpWebRequest.Create(Configuratio nManager.AppSettings["URI"]);

req.ClientCertificates.Add(Certificate);

req.Proxy = new
System.Net.WebProxy(ConfigurationManager.AppSettin gs["ProxyString"], true);

req.ContentType = "application/x-www-form-urlencoded";

req.Method = "POST";

byte[] bytes = System.Text.Encoding.ASCII.GetBytes(message);

req.ContentLength = bytes.Length;

System.Net.WebResponse resp = req.GetResponse();

// if (req == null) return null;

System.IO.StreamReader sr = new
System.IO.StreamReader(resp.GetResponseStream());

// return ;

}

}

catch

{

//Error logging



}

finally

{

store.Close();

}


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Web service autentication problem when call another web service Redhot ASP .Net Web Services 0 07-18-2009 09:43 PM
'web service call failed: 500' using ajax hovermenu and web service Not Me ASP .Net 1 06-05-2007 03:09 PM
InvocationTargetException when calling "new Service()" in Axis web service to call another web service Michael Averstegge Java 0 01-10-2006 11:05 PM
Web service slow on first call? In memory or cache option for web service? RJ ASP .Net Web Services 4 09-22-2005 09:07 PM
help: need to call call web service from java bill sandner Java 1 07-01-2004 02:57 PM



Advertisments