plsql web services in oracle forms - home: doag e.v. · pdf filepl/sql web services in oracle...

51
Basel · Baden · Bern · Lausanne · Zürich · Düsseldorf · Frankfurt/M. · Freiburg i. Br. · Hamburg · München · Stuttgart · Wien PL/SQL Web Services in Oracle Forms Perry Pakull Consultant [email protected] Stuttgart, 15.05.2007

Upload: nguyendang

Post on 19-Feb-2018

224 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

Basel · Baden · Bern · Lausanne · Zürich · Düsseldorf · Frankfurt/M. · Freiburg i. Br. · Hamburg · München · Stuttgart · Wien

PL/SQL Web Services in Oracle Forms

Perry [email protected]

Stuttgart, 15.05.2007

Page 2: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 2 © 2007

Agenda

Daten sind immer im Spiel.

§ Web Services in Oracle Forms

§ PL/SQL Web Service erstellen

§ Web Service Deployment

§ Oracle Forms als Konsument von Web Services

§ Oracle Datenbank als Konsument von Web Services

§ Ergänzungen und Hinweise

Page 3: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 3 © 2007

Web Services in Oracle Forms

§ Service-orientierte Architekturenú Entkopplung der Systeme und Applikationenú Funktionalität unabhängig von Plattform und Programmierspracheú Anbindung externer Systeme und Datenú Integration mit BPEL§ BPEL-Prozesse sind Web Services

§ PL/SQL Web Services sind erste Schritte in Richtung Service-orientierte Architekturenú Vorhandene PL/SQL-Packages als Web Services nutzenú Business Logik und Funktionalität für andere Applikationen sichtbar§ Forms-Applikationen§ Java-Applikationen

Page 4: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 4 © 2007

Web Services in Oracle Forms

§ Oracle Forms als Konsument von Web Services

§ Integration in ein Forms-Modul auf dem Oracle Application Serverú Java Integration in Oracle Forms ú Einbindung von Java-Klassen durch Java Importerú Web Service Client Stub

Forms Runtime-Prozessin-process-JVM

Web Service

PL/SQLPackage

Web ServiceClient Stub

(Java-Klassen)

JNI SOAPJDBCSQLJ

Page 5: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 5 © 2007

Web Services in Oracle Forms

§ Oracle Datenbank als Konsument von Web Services

§ Aufruf von Web Services über die Oracle Datenbankú PL/SQL-Package UTL_HTTPú Java Stored Proceduresú PL/SQL-Package UTL_DBWS

§ Datenstrukturen für Oracle Forms nutzen

PL/SQLWeb

ServiceInternetHTTPSOAP/XML

HTTPSOAP/XML

Page 6: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 6 © 2007

Agenda

Daten sind immer im Spiel.

§ Web Services in Oracle Forms

§ PL/SQL Web Service erstellen

§ Web Service Deployment

§ Oracle Forms als Konsument von Web Services

§ Oracle Datenbank als Konsument von Web Services

§ Ergänzungen und Hinweise

Page 7: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 7 © 2007

PL/SQL Web Service erstellen

§ PL/SQL-Package erstellenú WSBANKEN§ Funktion getBankFromBLZ liefert Bezeichnung für eine BLZ

§ JDeveloper aus Oracle Developer Suite 10.1.2ú Database Connectionú PL/SQL Web Serviceú Oracle Application Server Connection

PACKAGE WSBANKENis

function getBankFromBLZ (p_blz in varchar2

)return varchar2;

end;

Page 8: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 8 © 2007

JDeveloper: Create Database Connection

§ Connection Name

§ Connection Type: Oracle (JDBC)

Page 9: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 9 © 2007

JDeveloper: Create Database Connection

§ Username/Password

§ Deploy Password

Page 10: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 10 © 2007

JDeveloper: Create Database Connection

§ Driver: thin

§ Host Name, Port, SID

Page 11: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 11 © 2007

JDeveloper: Create Database Connection

§ Test Connection

Page 12: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 12 © 2007

JDeveloper: Projekt einrichten

§ Create Workspace

§ Create Project

Page 13: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 13 © 2007

JDeveloper: PL/SQL Web Service erstellen

§ New (rechte Maustaste auf Projekt BankenWebService)ú Business Tierú Web Servicesú PL/SQL Web Service

Page 14: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 14 © 2007

JDeveloper: PL/SQL Web Service erstellen

§ Wizard Create PL/SQL Web Service

Page 15: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 15 © 2007

JDeveloper: PL/SQL Web Service erstellen

§ Connection und Package auswählen

Page 16: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 16 © 2007

JDeveloper: PL/SQL Web Service erstellen

§ Prozeduren/Funktion aus Package auswählen

Page 17: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 17 © 2007

JDeveloper: PL/SQL Web Service erstellen

§ Endpoint

§ Target Namespace

Page 18: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 18 © 2007

JDeveloper: PL/SQL Web Service erstellen

§ Finish

§ PL/SQL Web Service Generator erzeugt Java-Klassen

Page 19: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 19 © 2007

Agenda

Daten sind immer im Spiel.

§ Web Services in Oracle Forms

§ PL/SQL Web Service erstellen

§ Web Service Deployment

§ Oracle Forms als Konsument von Web Services

§ Oracle Datenbank als Konsument von Web Services

§ Ergänzungen und Hinweise

Page 20: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 20 © 2007

Deployment: Create Application Server Connection

§ Connection zum OC4J Server der Oracle Developer Suite

§ Connection Type: Standalone OC4J

Page 21: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 21 © 2007

Deployment: Create Application Server Connection

§ Username: admin, Password: manager

§ Deploy Password

Page 22: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 22 © 2007

Deployment: Create Application Server Connection

§ URL: ormi://hostname:port/ aus rmi.xml

§ Target-Web-Site: default-web-site nicht http-web-site

Page 23: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 23 © 2007

Deployment: Create Application Server Connection

§ Test Connection

Page 24: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 24 © 2007

Deployment: Oracle Developer Suite

§ Web Service Endpointú In der WSDL-Datei den Port für den OC4J Server der Oracle

Developer Suite anpassen

§ Datenquelle in OC4J einrichtenú Beim Deployment mit JDeveloper wird eine Datei data-sources.xml

verteilt

Page 25: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 25 © 2007

JDeveloper: Deployment PL/SQL Web Service

§ Deployment Descriptor anpassen (optional)

Page 26: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 26 © 2007

Deployment PL/SQL Web Service

§ OC4J Deployment Command Line

${java} -jar ${admin.jar}${oc4j.url} ${username} ${password}-bindWebApp ${j2ee.app.name} ${j2ee.web.app.name}${oc4j.web.site} ${j2ee.context.root}

%ORACLE_HOME%\jdk\bin\java -jar %ORACLE_HOME%\j2ee\home\admin.jar ormi://localhost:23910 admin manager-bindWebApp BankenWebservice wsbankendefault-web-site /BankenWebservice

${java} -jar ${admin.jar}${oc4j.url} ${username} ${password}-bindWebApp ${j2ee.app.name} ${j2ee.web.app.name}${oc4j.web.site} ${j2ee.context.root}

%ORACLE_HOME%\jdk\bin\java -jar %ORACLE_HOME%\j2ee\home\admin.jar ormi://localhost:23910 admin manager-bindWebApp BankenWebservice wsbankendefault-web-site /BankenWebservice

§ OC4J Bind WebApp Command Line

Page 27: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 27 © 2007

Agenda

Daten sind immer im Spiel.

§ Web Services in Oracle Forms

§ PL/SQL Web Service erstellen

§ Web Service Deployment

§ Oracle Forms als Konsument von Web Services

§ Oracle Datenbank als Konsument von Web Services

§ Ergänzungen und Hinweise

Page 28: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 28 © 2007

JDeveloper: Generate Web Service Stub

§ Rechte Maustaste auf PL/SQL Web Service

§ Generate Web Service Stub

Page 29: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 29 © 2007

JDeveloper: Web Service Stub

§ Pfad zur WSDL-Datei wird automatisch gesetzt

§ Package-Name (optional)

Page 30: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 30 © 2007

JDeveloper: Web Service Stub

§ Auswahl der Web Services für Stub

Page 31: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 31 © 2007

JDeveloper: Deployment Web Service Stub

§ Deployment als JAR-Datei

Page 32: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 32 © 2007

JDeveloper: Deployment Web Service Stub

§ Verzeichnis JAR-Datei anpassen

Page 33: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 33 © 2007

JDeveloper: Deployment Web Service Stub

§ Dependancy Analysis

Page 34: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 34 © 2007

JDeveloper: Deployment Web Service Stub

§ Library Oracle SOAP auswählen

§ Option: Include Contents in Output

Page 35: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 35 © 2007

Einbinden in Oracle Forms

§ Forms Builderú FORMS_BUILDER_CLASSPATH in Windows Registryú Pfad zur JAR-Datei des Web Service Stub ergänzen

§ Forms Services Umgebungsdateiú CLASSPATHú Pfad zur JAR-Datei des Web Service Stub ergänzen

CLASSPATH=...;D:\PePDev\Forms\Demos\FormsWebServices\Deployment\WsbankenStub.jar

Page 36: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 36 © 2007

Forms Builder: Java Importer

§ Program è Import Java Classes

§ Import Java-Klasseú Web Service Stubú java.lang.Exception

§ Erzeugt PL/SQL-Packageú WSBANKENSTUBú EXCEPTION_

Page 37: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 37 © 2007

Forms Builder: Aufruf

§ Trigger When-Validate-Item

DECLAREjo ora_java.jobject;ex ora_java.jobject;

BEGINjo := WsBankenStub.new;:Konten.Bankverbindung :=

WsBankenStub.getBankFromBLZ (jo, :Konten.BLZ);EXCEPTION

WHEN ORA_JAVA.JAVA_ERROR thenfcp_alert.show('alert7', 'Unable to call out to Java, '

||ORA_JAVA.LAST_ERROR);WHEN ORA_JAVA.EXCEPTION_THROWN then

fcp_alert.show('alert7', 'Exception thrown');ex := ORA_JAVA.LAST_EXCEPTION;fcp_alert.show('Error', 'Unable to call out to Java, '

||Exception_.toString(ex));END;

Page 38: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 38 © 2007

Agenda

Daten sind immer im Spiel.

§ Web Services in Oracle Forms

§ PL/SQL Web Service erstellen

§ Web Service Deployment

§ Oracle Forms als Konsument von Web Services

§ Oracle Datenbank als Konsument von Web Services

§ Ergänzungen und Hinweise

Page 39: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 39 © 2007

PL/SQL Web Services über die Datenbank

Web Service

Datenbank-Package WEBSERVICES kommuniziert mit Web Service

Datenbank-PackageWEBSERVICE_GET_SET_XML

Procedure set_xxx_xml ruft Package WEBSERVICES auf und füllt

Returnwert in XMLTYPE Function get_xxx_xml gibt xmltypezurück

View verarbeitet xmltype

Oracle Forms ruft zuerst set_xxx_xmlauf und liest dann die View

Oracle Datenbank

XMLTYPE

Page 40: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 40 © 2007

Package WEBSERVICES

§ Implementierung Aufrufschnittstelle für Web Services

§ Vorbereitung der Anfrage mit Parameternú Skalare Parameter bei PL/SQL Web Services erfordern keine

SOAP-Kommunikation

§ SOAP RPC Kommunikation mit Web Service durch UTL_HTTP

§ Web Service liefert Antwort in SOAP/XML zurück

§ Package ‚entpackt‘ SOAP-Envelope und gibt XMLTYPE zurück

Page 41: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 41 © 2007

WEBSERVICES, InvokeFUNCTION invoke (req IN OUT NOCOPY request, url IN VARCHAR2)

RETURN responseAS

soap_respond CLOB;v_buffer VARCHAR2 (32767);http_req UTL_HTTP.req;http_resp UTL_HTTP.resp;resp response;

BEGINhttp_req := UTL_HTTP.begin_request (url);UTL_HTTP.set_persistent_conn_support (TRUE);UTL_HTTP.set_response_error_check (TRUE);UTL_HTTP.set_detailed_excp_support (TRUE);UTL_HTTP.set_header (http_req, 'User-Agent', 'Mozilla/4.0');http_resp := UTL_HTTP.get_response (http_req);BEGIN

soap_respond := NULL;LOOP

UTL_HTTP.read_text (http_resp, v_buffer, 32767);soap_respond := soap_respond || v_buffer;

END LOOP;EXCEPTION

WHEN UTL_HTTP.end_of_bodyTHEN

NULL;END;UTL_HTTP.end_response (http_resp);resp.doc := XMLTYPE.createxml (soap_respond);resp.doc := resp.doc.EXTRACT

('/soap:Envelope/soap:Body/child::node()','xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"'

);check_fault (resp);RETURN resp;

EXCEPTION...

END invoke;

Page 42: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 42 © 2007

WEBSERVICES, getlaender

FUNCTION getlaender (p_plandid NUMBER := NULL,p_plandiso VARCHAR2 := NULL,p_plandbez VARCHAR2 := NULL

)RETURN XMLTYPE

ISv_webservice VARCHAR2 (200);v_req request;v_resp response;

BEGIN-- Webservice-URL zusammensetzen, mit den Parametern für Anfragev_webservice :=

v_webservicename_adressen|| 'GetLaender?invoke=getlaender&pLandid='|| p_plandid|| '&pLandiso='|| p_plandiso|| '&pLandbez='|| p_plandbez;

-- Sonderzeichen escapen (z.B. % = %25 blank=%20 )v_webservice := utl_url.ESCAPE (v_webservice);-- Webservice Antwort holenv_resp := invoke (v_req, v_webservice);RETURN v_resp.doc;

END getlaender;

Page 43: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 43 © 2007

Package WEBSERVICE_SET_GET_XML

§ SET_xxx_XML-Prozeduren für Aufruf Web Services ú Ergebnis in globale Package-Variable vom Typ XMLTYPE

§ GET_xxx_XML-Funktionen liefern Datenú Ergebnis aus globaler Package-Variable vom Typ XMLTYPE

Page 44: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 44 © 2007

WEBSERVICE_SET_GET_XML

PACKAGE BODY webservice_get_set_xmlAS

-- Variablen für Resultat als XMLTYPEv_xml_getlaender XMLTYPE;v_xml_getorte XMLTYPE;v_xml_getstrassen XMLTYPE;v_xml_getbankfromblz XMLTYPE;

PROCEDURE set_getlaender_xml (p_plandid NUMBER := NULL,p_plandiso VARCHAR2 := NULL,p_plandbez VARCHAR2 := NULL

)ISBEGIN

-- Webservice getlaender aufrufenv_xml_getlaender := NULL;v_xml_getlaender :=

webservices.getlaender (p_plandid, p_plandiso, p_plandbez);END set_getlaender_xml;

-- Daten von Webservice getlaender als XMLTYPE zurückgeben ohne ParameterFUNCTION get_getlaender_xml

RETURN XMLTYPEISBEGIN

RETURN v_xml_getlaender;END get_getlaender_xml;

Page 45: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 45 © 2007

Datenbank-Views

§ Eine View pro Web Service

§ View zerlegt mit XPATH-Funktion EXTRACT das XML-Dokumentin einzelne Attribute

§ Views Daten beinhalten nur temporär Daten, wenn vorher eine Prozedur WEBSERVICE_GET_SET_XML.SET_xxx_XMLaufgerufen wurde, damit der XMLTYPE gefüllt ist

Page 46: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 46 © 2007

View V_WS_GETLAENDER

SELECT EXTRACT (VALUE (x), '/item/landbez/text()').getstringval() AS landbez,

EXTRACT (VALUE (x), '/item/landid/text()').getnumberval() AS landid,

EXTRACT (VALUE (x), '/item/landiso/text()').getstringval() AS landiso

FROM TABLE(XMLSEQUENCE

(EXTRACT(VALUE (webservice_get_set_xml.get_getlaender_xml),'/ns1:getlaenderResponse/return/array/item','xmlns:ns1="http://trivadis/forms/demos/adressen/GetLaender.wsdl"'

))

) x

Page 47: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 47 © 2007

Integration in Oracle Forms

§ Views als Data Blockú Im Trigger KEY-EXEQRY auf Block-Ebene muss vor dem Execute-

Query noch der Aufruf an den Web Service erfolgen, damit der XMLTYPE, der Grundlage der View ist, gefüllt wird

§ Views für Record Groups und LOVsú Im Trigger KEY-LISTVAL auf Block-Ebene muss vor dem Anzeigen

der LOV noch der Aufruf an den Web Service erfolgen, damit der XMLTYPE, der Grundlage der View ist, gefüllt wird

§ Validierungú Im Trigger WHEN-VALIDATE-ITEM auf Item-Ebene erfolgt zuerst der

Aufruf an den Web Service, damit der xmltype, der Grundlage der View ist, gefüllt wird. Dann kann die View mit regulärem SQL gelesen werden.

Page 48: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 48 © 2007

Agenda

Daten sind immer im Spiel.

§ Web Services in Oracle Forms

§ PL/SQL Web Service erstellen

§ Web Service Deployment

§ Oracle Forms als Konsument von Web Services

§ Oracle Datenbank als Konsument von Web Services

§ Ergänzungen und Hinweise

Page 49: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 49 © 2007

§ Oracle Technology Networkú Calling a Web Service from Oracle Application Server 10g Forms Services

http://www.oracle.com/technology/obe/obe_as_10g/deploy/callws_fromforms/forms_webservice.htm

ú Calling Web Services from PL/SQL in the Oracle9i Databasehttp://www.oracle.com/technology/tech/webservices/htdocs/samples/dbwebservice/DBWebServices_PLSQL.html

§ ORDIX AGú PL/SQL Web-Services (Teil I)

http://www.ordix.de/ORDIXNews/4_2005/pl_sql.htmlú PL/SQL Web-Services (Teil I I)

http://www.ordix.de/ORDIXNews/2_2006/Datenbanken/pl_sql_t2.html

Ergänzende Dokumente und Referenzen

Page 50: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

PL/SQL Web Services in Oracle Forms 50 © 2007

Hinweise

§ Trivadis TechnoCircleú SOA gets real ? Oracle SOA Suite 10.1.3.1 im Einsatzú Hamburg 05.-06.06.07, Zürich 12.-13.06.07, Stuttgart 10.-11.07.07

§ Trivadis Architecture Blueprintsú Leitfaden zur Konstruktion von Softwaresystemen ú Java Spring, .NET, ADF, Forms und SOAú Hanser Verlag, 2. Auflage, April 2007

§ Praktische Anwendungsentwicklung mit Oracle Formsú Pakull/Jüssen/Müllerú Hanser Verlag, 1. Auflage, Juli 2007

Page 51: PLSQL Web Services in Oracle Forms - Home: DOAG e.V. · PDF filePL/SQL Web Services in Oracle Forms 3 © 2007 Web Services in Oracle Forms §Service-orientierte Architekturen œEntkopplung

Basel · Baden · Bern · Lausanne · Zürich · Düsseldorf · Frankfurt/M. · Freiburg i. Br. · Hamburg · München · Stuttgart · Wien

Vielen Dank!

www.trivadis.com