XML digital signature interface
Posted
by yeekang
on Stack Overflow
See other posts from Stack Overflow
or by yeekang
Published on 2010-06-01T12:03:39Z
Indexed on
2010/06/01
12:23 UTC
Read the original article
Hit count: 201
I am trying to call a WebService and it requires me to prepare an XML digital signature interface. I came across this website and it shows how to sign an XML document. My problem now is that I do not create the XML document myself. My code is as follows:
string myResult;
GenericWS.ServicesService a = new GenericWS.ServicesService();
GenericWS.Service2 b = new GenericWS.Service2();
b.Something = "3";
X509Certificate cert = X509Certificate.CreateFromCertFile("C:\\somepath\\somecert.cer");
a.ClientCertificates.Add(cert);
ServicePointManager.ServerCertificateValidationCallback = delegate
(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{ return true; };
myResult= a.WSRequest(b).WSReturnValue.ToString();
Label1.Text = myResult;
Basically, the WSRequest() will generate the body of the SOAP message. However, in order to sign the SOAP message, I need to pass in the XML file that needs to be signed.
I tried to serialize the object and cast it as XML and pass it into the signature interface but I do not have another method that I can invoke to call the webmethod.
Is there any other solution?
© Stack Overflow or respective owner