APPLICAZIONI COMPOSITE - PROGETTAZIONE E GESTIONE
WSDL è utilizzato spesso nel contesto dei servizi Web per definire le interfacce implementate da un servizio Web. Di solito, per specificare la realizzazione concreta dell'interfaccia con un servizio Web che supporta il protocollo SOAP, viene utilizzata un'associazione SOAP. La sintassi WSDL utilizzata nei file creati dal Property Broker Editor di Domino Designer è simile a quella supportata da WebSphere Portal.
Nota Per informazioni più complete sull'utilizzo di file WSDL in Portal, fare riferimento alla documentazione di WebSphere Portal.
Per memorizzare una copia del file WSDL all'interno dell'applicazione composita basata su NSF, occorre aprire l'applicazione in IBM® Lotus® Domino(TM) Designer e spostarsi su Applicazioni composite-Proprietà cablaggio nel quadro di progettazione. Utilizzare il pulsante Importa WSDL per selezionare il file WSDL da disco e creare un elemento di progettazione "Proprietà cablaggio". Questo elemento di progettazione può essere memorizzato ed ereditato da modelli o protetto dall'aggiornamento dei modelli, esattamente come qualsiasi altro tipo di elemento di impostazione di Notes.
È possibile anche creare i file WSDL "ex novo" utilizzando il Property Broker Editor. Per ulteriori informazioni, fare riferimento a "Utilizzo di Property Broker Editor in Domino Designer".
Le seguenti sezioni di questo argomento forniscono ulteriori informazioni sulla sintassi dei file WSDL utilizzati in Domino Designer e in WebSphere Portal. Specificatamente, questo esempio mostra come un'azione tra le portlet attivata da un clic utilizza alcuni degli elementi del documento WSDL. Sono descritte le estensioni all'elemento <binding> ed è fornito lo schema completo delle estensioni WSDL.
Sintassi WSDL
Quanto segue fornisce informazioni specifiche sulla sintassi utilizzata nei file WSDL da Domino Designer e WebSphere Portal.
<types>
Per componenti di applicazioni composite, questo dichiara il tipo di dati che devono essere trasferiti. Il tipo di dati è dichiarato utilizzando XML Schema Datatypes (XSD, vedere la specifica XSD). Ci possono essere più tipi definiti nel documento WSDL. Quanto segue visualizza una dichiarazione campione per un tipo di dati di esempio chiamato TrackingIDType:
<xsd:simpleType name="TrackingIDType">
<xsd:restriction base="xsd:string">
</xsd:restriction>
</xsd:simpleType>
</types>
<message>
I messaggi di input possono contenere solo una parte.
<operation>
Fornisce a una definizione astratta di un'operazione attivata da un clic (Click-to-Action). Si noti qui sopra la limitazione messaggi di input.
<portType>
Definisce un insieme astratto di operazioni. Le operazioni devono essere definite nel documento. Un'operazione corrisponde a ogni azione sulla portlet abilitata per le operazioni attivate da un clic (Click-to-Action). Dovrebbero essere dichiarate solo le operazioni che devono essere abilitate come Click-to-Action.
<binding>
L'elemento di collegamento è ampliato per associare le azioni delle portlet alle operazioni. Per ogni operazione, deve essere fornito il nome dell'azione della portlet. Il nome dell'azione della portlet può essere specificato utilizzando l'attributo name del tag di azione nella sezione di binding del file WSDL. Se viene omesso il tag dell'attributo name dell'operazione viene utilizzato come nome dell'azione della portlet. Per ogni parametro dell'operazione, deve essere fornito il nome del parametro azione. Il nome del parametro portlet può essere specificato utilizzando l'attributo nome del tag param della sezione di collegamento del file WSDL. Se è omesso, l'attributo nome del tag part associato al tag param viene utilizzato come il nome del parametro della portlet.
Più avanti, l'attributo boundTo potrà essere utilizzato per specificare a che cosa sarà associato il parametro. Le scelte sono richiesta-parametro, richiesta-attributo, sessione-attributo o azione-attributo.
L'elemento <binding> include estensioni cooperative delle portlet, descritte in Estensioni dell'elemento <binding>, visualizzato nell'esempio WSDL.
Se si ha familiarità con WSDL, si può notare che la sezione service (racchiusa dall'elemento <service> in WSDL) non è utilizzata nel file di dichiarazione dell'esempio. Questo accade perché il file è associato a una portlet specifica che implementa le operazioni definite nel file attraverso mezzi esterni (una voce nel file portlet.xml associata alla portlet).
Estensioni dell'elemento <binding>
L'elemento <binding> è stato esteso per supportare componenti cooperativi e portlet. Gli esempi sottostanti fanno riferimento all'utilizzo con le portlet.
Ogni elemento di estensione ha come prefisso "portlet:", che si riferisce allo spazio dei nomi C2A (Click-to-Action), http://www.ibm.com/wps/c2a. Il prefisso "portlet:" è utilizzato in questa sezione per identificare gli elementi dell'estensione, ma può essere utilizzato un nome diverso per il prefisso, sempre che si riferisca allo spazio dei nomi C2A. Gli elementi sono descritti di seguito. Fare riferimento anche alle informazioni su WSDL Extension Schema fornite più avanti.
<portlet:binding>
Questo deve essere il primo elemento dipendente dell'elemento WSDL <binding>. La sua presenza identifica la sezione come un'estensione obbligatoria C2A per la chiamata all'azione della portlet. L'elemento ha il seguente attributo.
Obsoleto. La specifica style="struts" indica che vengono dichiarate le azioni Struts. Per questo scopo, si dovrebbe invece utilizzare type=struts nell'elemento <portlet:action>.
Questo deve essere il primo elemento dipendente di qualsiasi elemento WSDL <operation> nella sezione di associazione. Questa pagina contiene le seguenti opzioni:
il nome di azione della portlet. Se questo viene omesso, il nome dell'elemento operazione associato è utilizzato come nome dell'azione della portlet.
una breve stringa sull'azione adatta a essere visualizzata nell'interfaccia utente della portlet. Per le didascalie tradotte, indicare un formato puntato il nome della chiave nei gruppi di risorse da cui deve essere ottenuta la didascalia. Per ulteriori informazioni. vedere il supporto dell'internazionalizzazione.
Indica uno dei seguenti valori:
descrizione di testo dell'azione. Per descrizioni tradotte, indicare in formato separato da punti il nome della chiave nei gruppi di risorse da cui deve essere ottenuta la descrizione.
Indicare "vero" o "falso". Se si sceglie falso, l'azione deve essere attivata programmaticamente in ogni sessione. Se si sceglie vero (impostazione predefinita), l'azione diventa attiva non appena viene inizializzata la portlet.
Nel caso in cui più azioni corrispondano alla portlet in base al tipo di dati, questo attributo può essere utilizzato per indicare quale azione attivare. Quando un utente trasmette un'azione su una sorgente, possono verificarsi più azioni corrispondenti. Se non è specificata, l'impostazione predefinita è "falso". Nel caso in cui nessuna singola azione è impostata a vero, i dati non sono inviati alla destinazione. Nel seguente esempio, ci sono due azioni dichiarate: trackingDetails e routingDetails. selectOnMultipleMatch è utilizzato per indicare che trackingDetails dovrebbe essere utilizzato in caso di corrispondenza multipla.
<portlet:binding/>
<operation name="trackingDetails">
<portlet:action caption="Tracking Details"
description="Get tracking details for
specifiedtracking id"
selectOnMultipleMatch="true"/>
<input>
<portlet:param name="trackingId" partname="trackingId"/>
</input>
<output>
<portlet:param name="customerName" partname="custName" boundTo="session"/>
</output>
</operation>
<operation name="routingDetails">
<portlet:action caption="Routing Details"
description="Get routing details for specified tracking id"/>
</binding>
<portlet:param>
Questo deve apparire nell'associazione come un elemento dipendente nei sottoelementi <input> o <output> dell'elemento <operation>. Questo specifica i parametri utilizzati (se inclusi nell'elemento <input>) o prodotti (se inclusi nell'elemento <output>) dall'azione della portlet. Attualmente, il numero dei parametri utilizzati è limitato a uno soltanto. Il numero di parametri prodotti può essere qualsiasi. I suoi attributi sono i seguenti:
il nome del parametro. Se omesso, il valore dell'attributo nome dell'elemento della parte viene utilizzato come nome del parametro.
si riferisce a un elemento parte dell'input o dell'output dell'operazione. Può essere omesso se l'input o l'output ha una singola parte.
specifica dove il valore del parametro è collegato. Attualmente, questo attributo può specificare solo uno dei seguenti valori:
Il seguente è lo schema di estensibilità degli elementi introdotti per la chiamata di azioni portlet utilizzando Click-to-Action. Le righe sono state interrotte per essere visualizzate sulla pagina stampata.
<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema
targetNamespace="http://www.ibm.com/wps/c2a"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.xmlsoap.org/wsdl/
http://schemas.xmlsoap.org/wsdl/
http://www.w3.org/2001/XMLSchema
http://www.w3.org/2001/XMLSchema.xsd"
xmlns:portlet="http://www.ibm.com/wps/c2a">
<!-- The binding element indicates that the binding section contains custom extensions describing a mapping of operations to portlet actions. This must be placed within a WSDL binding element. -->
<element name="binding" type="portlet:bindingType"/>
<complexType name="bindingType">
<!-- DEPRECATED, retained for compatibility with version 4. Use the type attribute with the action element instead. Set value to be "struts" for a portlet implemented using the struts framework. -->
<attribute name="style" type="string" use="optional"/>
</complexType>
<!-- The action element is used to provide all the information about the portlet action necessary for the property broker to invoke it. This must be placed within an wsdl:operation element in the wsdl:binding section. -->
<complexType name="actionType">
<sequence>
<!-- The param element is used to indicate information about the input or output property associated with the action and the mechanism for passing parameters to or from the action. It must be placed within a wsdl:input or wsdl:output element. -->
<element name="param" type="portlet:paramType" minOccurs="0"maxOccurs="unbounded"/>
</sequence>
<!-- The name of the action. Will be set as the portlet action name. If omitted, the name of the corresponding operation element will be used as the action name. -->
<attribute name="name" type="string" use="optional"/>
<!-- default, simple, and struts are currently recognized values with default being the default. Is used to specify whether the DefaultPortletAction, simple portlet action, or struts action mechanism is used to invoke the portlet action. Note that the use of DefaultPortletAction is deprecated, and the default is set to this value for backwards compatibility. We encourage setting this to simple to avoid future migration issues. -->
<attribute name="type" type="string" use="optional" default="default"/>
<!-- A short name for the action which is displayed to the end-user. If a message resource file is provided for the portlet, the value is used as a key to retrieve a translated string -->
<attribute name="caption" type="string" use="optional"/>
<!-- A description for the action which is displayed to the end-user. If a message resource file is provided for the portlet, the value is used as a key to retrieve a translated string -->
<attribute name="description" type="string" use="optional"/>
<!-- If more than one portlet action can simultaneously process a property value, only those with the invokeOnMultipleMatch attribute set to true will be invoked -->
<attribute name="selectOnMultipleMatch" type="boolean" use="optional" default="false"/>
<!-- If the activeOnStartup attribute is true, the action may be selected for invocation at any time unless programmatically deactivated on a per-session basis. If the activeOnStartup is false, the action may not be selected for invocation,unless programmatically activated on a per-session basis -->
<attribute name="activeOnStartup" type="boolean" use="optional" default="true"/>
<!-- The param element indicates how the parameter is to be delivered to the portlet action or retrieved from it once the action has executed -->
<complexType name="paramType">
<!-- The name of the parameter which will be used on action invocation. If omitted, the partname is used. This name will also be set as the name of the corresponding property. See a description of properties in the programming model document. -->
<!-- The name of the corresponding part. May be omitted only if there is a single parameter for the action, in which case it will be inferred from the associated operation definition -->
<attribute name="partname" type="string" use="optional"/>
<!-- Where to place the parameter prior to invoking the action (in case of in parameters), or where to look for it after invoking the action (in case of out parameters).request-attribute, request-parameter, session, and action are allowed values. -->
<attribute name="boundTo" type="string" default="request-parameter"/>
<!-- The java class for the parameter. The default is java.lang.String. Currently this is not used, but may be used in future for validation -->
<attribute name="class" type="string" default="java.lang.String"/>
<!-- A short name for the parameter which is displayed to the end-user. If a message resource file is provided for the portlet, the value is used as a key to retrieve a translated string -->
<!-- A description for the parameter which is displayed to the end-user. If a message resource file is provided for the portlet, the value is used as a key to retrieve a translated string -->
</xsd:schema>
È possibile utilizzare file WSDL esistenti come punto di partenza quando si costruiscono i componenti NSF e i componenti Eclipse. Si consiglia tuttavia di utilizzare il Property Broker Editor per gestirli.
Esempio di WSDL per applicazioni composite in Domino Designer
Utilizzare questa sintassi di esempio e l'annotazione (in grassetto) per riferimento quando si crea l'applicazione composita di esempio utilizzando Lotus Notes.
<definitions name="Property Broker WSDL"
targetNamespace="http://www.ibm.com/wps/c2a/testwsdl"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:portlet="http://www.ibm.com/wps/c2a"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.ibm.com/wps/c2a/testwsdl"
xmlns:cus="com.ibm.compositeapps.samples" -this is how you can add your own sample namespace (1)
xmlns:cut="com.ibm.compositeapps.samples.2" -this is another sample namespace (2)
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:schema targetNamespace="com.ibm.compositeapps.samples"> -this is a custom namespace (1)
<xsd:simpleType name="SubjectType"> -this is the typename
<xsd:restriction base="xsd:string"/>
<xsd:schema targetNamespace="com.ibm.compositeapps.samples.2"> this shows another namespace (2)
<xsd:simpleType name="AccountType">
<xsd:simpleType name="IDType">
<xsd:simpleType name="CustomerType">
<message name="New_Response_Action_Operation_Input">
<part name="SubjectPart" type="cus:SubjectType"/> -note the "cus" points to your namespace (1) -- this maps from the property to the type
</message>
<message name="New_Response_Action_Operation_Output">
<part name="AccountPart" type="cut:AccountType"/> -note the "cut "to point to your namespace (1)
<part name="IDPart" type="cut:IDType"/>
<message name="OnViewEntrySelectionChange_Property_Operation_Output">
<part name="CustomerPart" type="cut:CustomerType"/>
<portType name="NotesDB_Operations"> - this section is required as part of the WSDL standard
<operation name="New_Response_Action_Operation">
<input message="tns:New_Response_Action_Operation_Input"/>
<output message="tns:New_Response_Action_Operation_Output"/>
<operation name="OnViewEntrySelectionChange_Property_Operation">
<output message="tns:OnViewEntrySelectionChange_Property_Operation_Output"/>
</portType>
<binding name="Notes_Binding" type="tns:NotesDB_Operations">
<operation name="New_Response_Action_Operation"> -this is an action with one input and two output properties. See the note below.
<portlet:action name="New Response Action" caption="NewResponseCaption" -this name is the name that shows up in Domino Designer user interface in action infobox description="NewResponseDesc.id"/>
<portlet:param name="Subject" -this name is the property name and it must be unique within one wsdl file partname="SubjectPart" -partname is used to map to the "part name=" under <message> caption="subjectCaption" description="subjectDesc.id"/>
<output> -you can have 0-N output properties in an action
<portlet:param name="Account" partname="AccountPart" caption="accountCaption" description="accountDesc.id"/>
<portlet:param name="ID" partname="IDPart" caption="id" description="idDesc.id"/>
<operation name="OnViewEntrySelectionChange_Property_Operation"> -this is an output property
<portlet:action name="OnDocSelectionChange" -this name doesn't matter, but must be unique within one wsdl file caption="DocSelectionCaption" description="DocSelectionDesc.id"/>
<portlet:param name="Customer" partname="CustomerPart" caption="customer" description="customer.id"/>
</definitions>
Direttive per i file WSDL
Utilizzare le seguenti indicazioni per creare i file WSDL: