SignPadesMultiFieldName
The SOAP request for create Cades Pades signature using signatures field:
Code Block |
---|
language | xml |
---|
title | signCadessignPadesMultiFieldName |
---|
|
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.ws.nam/">
<soapenv:Header/>
<soapenv:Body>
<ser:signCAdES>signPAdES>
<credentials>
<password>YOUR-DEVICE-PASSWORD</password>
<username>YOUR-DEVICE-NAME</username>
<sessionKey>SESSION_KEY_RECEIVED_FROM_OPEN_SESSION</sessionKey>
< </credentials>
<buffer>VGhpcyBpcyB0aGUgZmlsZSB0byBiZSBzaWduZWQgZm9yIHRlc3Qu<<buffer>BASE64-TO-SIGN</buffer>
<PAdESPreferences>
<CAdESPreferences> <level>B</level>
<level>B</level><signerImage>
</CAdESPreferences>
</ser:signCAdES>
</soapenv:Body>
</soapenv:Envelope> |
In this example the buffer to sign is "txt" files.
The SOAP response will be:
Code Block |
---|
language | xml |
---|
title | SOAP-response-signCades |
---|
|
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<fieldsNameList>SignatureField-1</fieldsNameList>
<fieldsNameList>SignatureField-2</fieldsNameList>
<!-- THIS OPTION set to true allow to sign all signatures fields available -->
<!-- <signAllFields>false</signAllFields> -->
<signerName>NAME OF SIGNER</signerName>
</signerImage>
<withSignatureField>true</withSignatureField>
</PAdESPreferences>
</ser:signPAdES>
</soapenv:Body>
</soapenv:Envelope> |
At this link is possible to see the full example (with file to sign and logo image) of signature Pades with appereance.
NOTE: in this example the signatures fields: "SignatureField-1" and "SignatureField-2" already exist in a PDF
The response will be the complex object: "PadesWithMultiFieldName" or generate a WSException if don't sign at least one signature field.
Below the response ok, when all elements of "fieldsNameList" are signed (the file is fully signed):
Code Block |
---|
title | SOAP-response-signPadesMultiFieldName-output-fully-signed |
---|
|
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:signPAdESMultiFieldNameResponse xmlns:ns2="http://service.ws.nam/">
<return>
<signedContent>BASE-64-OF-PDF-WITH-ELEMENTS-OF-LIST-FIELDSNAMELIST</signedContent>
</return>
</ns2:signPAdESMultiFieldNameResponse>
</soap:Body>
</soap:Envelope> |
While if the field are signed partially (for example the session key has expired) therefore the file is partially signed, the response will be:
Code Block |
---|
title | SOAP-response-signPadesMultiFieldName-output-partially-signed |
---|
|
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:signPAdESMultiFieldNameResponse xmlns:ns2="http://service.ws.nam/">
<return>
<signedContent>BASE-64-OF-PDF-WITH-ELEMENTS-OF-LIST-FIELDSNAMELIST</signedContent>
<serviceError>
<code>69</code>
<message>Session key scaduta</message>
</serviceError>
<remainingFieldNames>SignatureField-2</remainingFieldNames>
</return>
</ns2:signPAdESMultiFieldNameResponse>
</soap:Body>
</soap:Envelope> |
The tag:
- "signedContent" contains the partially signed file, because not all fields in a list have been signed
- "serviceError" contains the details about the cause because all signatures fields have been signed
- "remainingFieldNames" contains the list of field remaining to sign
In this case, the response will be the input of the new "signPadesMultiFieldName" request
While if you insert credentials.password, credentials.sessionKey, signature field not exist. In output will obtain a WSException like this:
Code Block |
---|
title | SOAP-response-signPadesMultiFieldName-output-partially-signed |
---|
|
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>Richiesta non valida</faultstring>
<detail>
<ns2:WSException xmlns:ns2="http://service.ws.nam/">
<error>105</error>
<message>Richiesta non valida</message>
</ns2:WSException>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope> |