Search code examples
digital-signaturecosign-api

CoSign API: Setting Date Format Using DSS Web Service


I'm running into a problem when trying to specify the date format for a signature field using the DSS web service. Here is my code:

Req = new RequestBaseType();
Req.OptionalInputs = new RequestBaseTypeOptionalInputs();
Req.OptionalInputs.SAPISigFieldSettings = new SAPISigFieldSettingsType();
TimeDateFormatType tf = new TimeDateFormatType();
tf.DateFormat = "dd MMM yyyy";
Req.OptionalInputs.SAPISigFieldSettings.TimeFormat = tf;

I attempt to sign the document as follows:

DSS service = new DSS();
service.Url = "https://cosign:8080/sapiws/dss.asmx";
SignRequest sreq = new SignRequest();
sreq.InputDocuments = Req.InputDocuments;
sreq.OptionalInputs = Req.OptionalInputs;
Resp = service.DssSign(sreq);

And I get the following response from the ResponseBaseType object:

urn:oasis:names:tc:dss:1.0:resultmajor:Insufficient Information Error parsing OptionalInput SAPISigFieldSettings

If I don't specify the date format, it works OK. Any ideas?


Solution

  • Even though you want to display just the date and not the time, you need to set TimeFormat to an empty string. It is null by default.