e.Toscana Compliance
Request for Comments:
Del: 15/12/2009
Categoria: Applicativa
Destinatari: Regione Toscana, Tribunali, Avvocati

Integrazione Gateway PEC con Cancelleria Telematica


Abstract
========
L'obiettivo di questo documento  quello di concordare i contenuti legati al processo di invio di mail di posta certifcata
mediante gli applicativi della Cancelleria Telematica.
========


Indice
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1. Contesto di riferimento
2. Obiettivi
3. Analisi
3.1 Attori coinvolti
3.1.1. Casi d'uso
3.1.1.1 UC01
3.1.1.2 UC02
3.1.1.3 UC03
3.1.1.4 UC04
3.1.1.5 UC05
3.1.2. Servizi esposti dal proxy applicativo
3.1.2.1 WSDL del proxy applicativo
4. Prodotti attesi
5. Bibliografia

1. Contesto di riferimento
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Attualmente dall'applicativo della Cancelleria Telematica vengono spedite mail agli avvocati ed alle cancellerie contestualmente
all'upload dei documenti sul portale. I messaggi inviati non rientrano nella categoria della posta certificata (PEC).

2. Obiettivi
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Poich gli avvocati si stanno dotando di caselle di posta certificata,  nostro scopo implementare un meccanismo per la spedizione di mail certificate
dagli applicativi della Cancelleria Telematica.
Il processo sar concretizzato mediante l'interazione fra diverse componenti:
- il pubblicatore degli applicativi della Cancelleria Telematica ed il proxy applicativo responsabile di inoltrare i messaggi verso l'infrastruttura CART
- il proxy applicativo ed i servizi di Integration Manager del CART
- il modulo gateway PEC ed i servizi di Integration Manager del CART

3. Analisi
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

3.1 Attori coinvolti
---------------------
a. Il sistema informativo locale che richiede l'invio di una mail certificata
b. Il proxy applicativo che ha la responsabilità di veicolare la richiesta verso il CART
c. Il modulo gateway PEC che recupera l'informazione dall'infrastruttura CART ed invia la mail PEC

Di seguito un possibile flusso di utilizzo:

1 - Il SIL mittente invia una richiesta tramite un messaggio applicativo al proxy mittente
2 - Il proxy mittente inoltra la chiamata, attraverso Integration Manager, verso l'infrastruttura CART
3 - Il modulo gateway legge, attrverso Integration Manager, i messaggi applicativi di sua competenza dall'infrastruttura CART
4 - Il modulo gateway invia una mail PEC (certificata) avente come mittente il valore specificato nel campo mittente del messaggio applicativo e
    come destinatario quello specificato nel campo destinatario

A fronte di un invio, il modulo gateway legge le ricevute relative al messaggio inviato e le inoltra sull'infrastruttura CART.
A questo punto:

5 - Il proxy applicativo legge, attraverso Integration Manager, le ricevute inviate dal modulo gateway
6 - Il SIL recupera dal proxy applicativo le ricevute

Il formato del messaggio applicativo e' descritto dallo schema XML seguente:

<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://cart.rete.toscana.it/gw" elementFormDefault="qualified">
    <xs:complexType name="GwMessageType">
	<xs:sequence>
	    <xs:element name="messageID" type="xs:string">
		<xs:annotation>
		    <xs:documentation>
			Identificativo univoco relativo ai messaggi inoltrati e alle ricevute generate dal server destinatario.
		    </xs:documentation>
		</xs:annotation>
	    </xs:element>
	    <xs:element name="from" type="xs:string">
		<xs:annotation>
		    <xs:documentation>
			Riferimenti del mittente del messaggio
		    </xs:documentation>
		</xs:annotation>
	    </xs:element>
	    <xs:element name="to" type="xs:string">
		<xs:annotation>
		    <xs:documentation>
			Riferimenti del destinatario del messaggio
		    </xs:documentation>
		</xs:annotation>
	    </xs:element>
	    <xs:element name="messageType">
		<xs:annotation>
		    <xs:documentation>
		     Tipo messaggio
		     Può assumere i seguenti valori:
		     1. INVIO_MESSAGGIO
		     2. NOTIFICA_ACCETTAZIONE
		     3. NOTIFICA_NON_ACCETTAZIONE
		     4. NOTIFICA_AVVENUTA_CONSEGNA
		     5. NOTIFICA_NON_AVVENUTA_CONSEGNA
		    </xs:documentation>
		</xs:annotation>
		<xs:simpleType>
		    <xs:restriction base="xs:string">
			<xs:enumeration value="INVIO_MESSAGGIO"/>
			<xs:enumeration value="NOTIFICA_ACCETTAZIONE"/>
			<xs:enumeration value="NOTIFICA_NON_ACCETTAZIONE"/>
			<xs:enumeration value="NOTIFICA_AVVENUTA_CONSEGNA"/>
			<xs:enumeration value="NOTIFICA_NON_AVVENUTA_CONSEGNA"/>
		    </xs:restriction>
		</xs:simpleType>
	    </xs:element>
	    <xs:element name="subject" type="xs:string">
		<xs:annotation>
		    <xs:documentation>
			Titolo del messaggio da inviare
		    </xs:documentation>
		</xs:annotation>
	    </xs:element>
	    <xs:element name="body" type="xs:string">
		<xs:annotation>
		    <xs:documentation>
			    Testo del messaggio da inviare
		    </xs:documentation>
		</xs:annotation>
	    </xs:element>
	    <xs:element name="messageFormat">
		<xs:annotation>
		    <xs:documentation>
			 Formato del messaggio
			 Può assumere i seguenti valori:
			 1. text
			 2. html
		    </xs:documentation>
		</xs:annotation>
		<xs:simpleType>
		    <xs:restriction base="xs:string">
			<xs:enumeration value="text"/>
			<xs:enumeration value="html"/>
		    </xs:restriction>
		</xs:simpleType>
	    </xs:element>
	    <xs:element name="date" type="xs:dateTime">
		<xs:annotation>
		    <xs:documentation>
			Data del messaggio
		    </xs:documentation>
		</xs:annotation>
	    </xs:element>
	</xs:sequence>
    </xs:complexType>
    <xs:element name="GwMessage" type="GwMessageType"/>
</xs:schema>

3.1.1. Casi d'uso

3.1.1.1 UC01 - Invio di un messaggio da SIL mittente verso l'infrastruttura CART

Di seguito un esempio di possibile messaggio di invio da parte di un SIL mittente verso l'infrastruttura CART:

<?xml version="1.0" encoding="UTF-8"?>
<GwMessage>
    <messageID>CTN_1_0003_0001</messageID>
    <from>mittente@postacert.domain.it</from>
    <to>destinatario@postacert.domain.it</to>
    <messageType>INVIO_MESSAGGIO</messageType>
    <subject>TITOLO MESSAGGIO</subject>
    <body>BODY MESSAGGIO</body>
    <messageFormat>text</messageFormat>
    <date>2009-12-15T17:00:00</date>
</GwMessage>

3.1.1.2 UC02 - Invio di una ricevuta di accettazione da gateway PEC verso l'infrastruttura CART

Di seguito un esempio di possibile ricevuta di accettazione inviata dal modulo gateway PEC verso l'infrastruttura CART:

<?xml version="1.0" encoding="UTF-8"?>
<GwMessage>
    <messageID>CTN_1_0003_0001</messageID>
    <from>postacertificata@postacert.domain.it</from>
    <to>mittente@postacert.domain.it</to>
    <messageType>NOTIFICA_ACCETTAZIONE</messageType>
    <subject>ACCETTAZIONE:TITOLO MESSAGGIO</subject>
    <body>body accettazione</body>
    <messageFormat>text</messageFormat>
    <date>2009-12-15T17:00:00</date>
</GwMessage>

3.1.1.3 UC03 - Invio di una ricevuta di consegna da gateway PEC verso l'infrastruttura CART

Di seguito un esempio di possibile ricevuta di consegna inviata dal modulo gateway PEC verso l'infrastruttura CART:

<?xml version="1.0" encoding="UTF-8"?>
<GwMessage>
    <messageID>CTN_1_0003_0001</messageID>
    <from>postacertificata@postacert.domain.it</from>
    <to>mittente@postacert.domain.it</to>
    <messageType>NOTIFICA_AVVENUTA_CONSEGNA</messageType>
    <subject>CONSEGNA:TITOLO MESSAGGIO</subject>
    <body>body consegna</body>
    <messageFormat>text</messageFormat>
    <date>2009-12-15T17:00:00</date>
</GwMessage>

3.1.1.4 UC04 - Invio di una ricevuta di non accettazione da gateway PEC verso l'infrastruttura CART

Di seguito un esempio di possibile ricevuta di non accettazione inviata dal modulo gateway PEC verso l'infrastruttura CART:

<?xml version="1.0" encoding="UTF-8"?>
<GwMessage>
    <messageID>CTN_1_0003_0001</messageID>
    <from>postacertificata@postacert.domain.it</from>
    <to>mittente@postacert.domain.it</to>
    <messageType>NOTIFICA_NON_ACCETTAZIONE</messageType>
    <subject>NON ACCETTAZIONE:TITOLO MESSAGGIO</subject>
    <body>body non accettazione</body>
    <messageFormat>text</messageFormat>
    <date>2009-12-15T17:00:00</date>
</GwMessage>


3.1.1.5 UC05 - Invio di una ricevuta di non avvenuta consegna da gateway PEC verso l'infrastruttura CART

Di seguito un esempio di possibile ricevuta di non avvenuta consegna inviata dal modulo gateway PEC verso l'infrastruttura CART:

<?xml version="1.0" encoding="UTF-8"?>
<GwMessage>
    <messageID>CTN_1_0003_0001</messageID>
    <from>postacertificata@postacert.domain.it</from>
    <to>mittente@postacert.domain.it</to>
    <messageType>NOTIFICA_NON_AVVENUTA_CONSEGNA</messageType>
    <subject>AVVISO DI MANCATA CONSEGNA:TITOLO MESSAGGIO</subject>
    <body>body non avvenuta consegna</body>
    <messageFormat>text</messageFormat>
    <date>2009-12-15T17:00:00</date>
</GwMessage>


3.1.2. Servizi esposti dal proxy applicativo

Il proxy applicativo (ProxyGWPEC) espone dei servizi web per l'interazione con il SIL all'URL http://<hostname>:<port>/ProxyGWPEC/services/ProxyGWPECWS.
Di seguito i dettagli dei servizi.

- GWPECAck sendMail(final GWPECMessage message)

	permette al SIL di inviare i messaggi applicativi


- GWPECMessage[] receiveNotifications()

	permette al SIL di recuperare le ricevute inviate dal gateway pec


- GWPECAck deleteNotifications(final GWPECMessage[] messages)

	permette al SIL di rimuovere dalla coda del proxy le ricevute recuperate


3.1.2.1 WSDL del proxy applicativo

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://localhost:8080/ProxyGWPEC/services/ProxyGWPECWS" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://localhost:8080/ProxyGWPEC/services/ProxyGWPECWS" xmlns:intf="http://localhost:8080/ProxyGWPEC/services/ProxyGWPECWS" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="http://wsdl2java.proxygwpec.tdgroup.it" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 <wsdl:types>
  <schema targetNamespace="http://wsdl2java.proxygwpec.tdgroup.it" xmlns="http://www.w3.org/2001/XMLSchema">
   <import namespace="http://localhost:8080/ProxyGWPEC/services/ProxyGWPECWS"/>
   <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
   <complexType name="GWPECMessage">
    <sequence>
     <element name="message" nillable="true" type="xsd:base64Binary"/>
     <element name="messageId" nillable="true" type="xsd:string"/>
     <element name="messageType" nillable="true" type="xsd:int"/>
    </sequence>
   </complexType>
   <complexType name="GWPECAck">
    <sequence>
     <element name="ackMessage" nillable="true" type="xsd:string"/>
     <element name="error" nillable="true" type="xsd:string"/>
    </sequence>
   </complexType>
  </schema>
  <schema targetNamespace="http://localhost:8080/ProxyGWPEC/services/ProxyGWPECWS" xmlns="http://www.w3.org/2001/XMLSchema">
   <import namespace="http://wsdl2java.proxygwpec.tdgroup.it"/>
   <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
   <complexType name="ArrayOf_tns1_GWPECMessage">
    <complexContent>
     <restriction base="soapenc:Array">
      <attribute ref="soapenc:arrayType" wsdl:arrayType="tns1:GWPECMessage[]"/>
     </restriction>
    </complexContent>
   </complexType>
  </schema>
 </wsdl:types>
   <wsdl:message name="sendMailResponse">
      <wsdl:part name="sendMailReturn" type="tns1:GWPECAck"/>
   </wsdl:message>
   <wsdl:message name="receiveNotificationsResponse">
      <wsdl:part name="receiveNotificationsReturn" type="impl:ArrayOf_tns1_GWPECMessage"/>
   </wsdl:message>
   <wsdl:message name="sendMailRequest">
      <wsdl:part name="message" type="tns1:GWPECMessage"/>
   </wsdl:message>
   <wsdl:message name="deleteNotificationsRequest">
      <wsdl:part name="messages" type="impl:ArrayOf_tns1_GWPECMessage"/>
   </wsdl:message>
   <wsdl:message name="deleteNotificationsResponse">
      <wsdl:part name="deleteNotificationsReturn" type="tns1:GWPECAck"/>
   </wsdl:message>
   <wsdl:message name="receiveNotificationsRequest">
   </wsdl:message>
   <wsdl:portType name="ProxyGWPEC">
      <wsdl:operation name="sendMail" parameterOrder="message">
         <wsdl:input message="impl:sendMailRequest" name="sendMailRequest"/>
         <wsdl:output message="impl:sendMailResponse" name="sendMailResponse"/>
      </wsdl:operation>
      <wsdl:operation name="receiveNotifications">
         <wsdl:input message="impl:receiveNotificationsRequest" name="receiveNotificationsRequest"/>
         <wsdl:output message="impl:receiveNotificationsResponse" name="receiveNotificationsResponse"/>
      </wsdl:operation>
      <wsdl:operation name="deleteNotifications" parameterOrder="messages">
         <wsdl:input message="impl:deleteNotificationsRequest" name="deleteNotificationsRequest"/>
         <wsdl:output message="impl:deleteNotificationsResponse" name="deleteNotificationsResponse"/>
      </wsdl:operation>
   </wsdl:portType>
   <wsdl:binding name="ProxyGWPECSoapBinding" type="impl:ProxyGWPEC">
      <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
      <wsdl:operation name="sendMail">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="sendMailRequest">
            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://wsdl2java.proxygwpec.tdgroup.it" use="encoded"/>
         </wsdl:input>
         <wsdl:output name="sendMailResponse">
            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/ProxyGWPEC/services/ProxyGWPECWS" use="encoded"/>
         </wsdl:output>
      </wsdl:operation>
      <wsdl:operation name="receiveNotifications">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="receiveNotificationsRequest">
            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://wsdl2java.proxygwpec.tdgroup.it" use="encoded"/>
         </wsdl:input>
         <wsdl:output name="receiveNotificationsResponse">
            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/ProxyGWPEC/services/ProxyGWPECWS" use="encoded"/>
         </wsdl:output>
      </wsdl:operation>
      <wsdl:operation name="deleteNotifications">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="deleteNotificationsRequest">
            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://wsdl2java.proxygwpec.tdgroup.it" use="encoded"/>
         </wsdl:input>
         <wsdl:output name="deleteNotificationsResponse">
            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/ProxyGWPEC/services/ProxyGWPECWS" use="encoded"/>
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:service name="ProxyGWPECService">
      <wsdl:port binding="impl:ProxyGWPECSoapBinding" name="ProxyGWPEC">
         <wsdlsoap:address location="http://localhost:8080/ProxyGWPEC/services/ProxyGWPECWS"/>
      </wsdl:port>
   </wsdl:service>
</wsdl:definitions>


4. Prodotti attesi
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- componente SIL pubblicatore, da installare presso Regione Toscana
- componente ProxyGWPEC, da installare in ambiente CART, visibile dal SIL pubblicatore
- componente gateway pec, da installare presso l'ambiente CART


5. Bibliografia
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
