Presentation is loading. Please wait.

Presentation is loading. Please wait.

SOA-26: Extending Your Application with OpenEdge ® Web Services John Sadd OpenEdge Evangelist.

Similar presentations


Presentation on theme: "SOA-26: Extending Your Application with OpenEdge ® Web Services John Sadd OpenEdge Evangelist."— Presentation transcript:

1 SOA-26: Extending Your Application with OpenEdge ® Web Services John Sadd OpenEdge Evangelist

2 © 2008 Progress Software Corporation 2 SOA-26: Extending Your Application with OpenEdge Web Services Goals for this session  Stimulate thinking about services in your application  Show the ease of using OpenEdge support for Web services  Help you understand some basic principles of identifying and packaging services

3 © 2008 Progress Software Corporation 3 SOA-26: Extending Your Application with OpenEdge Web Services Agenda  Services? What Services? And Why?  Running Web services from OpenEdge  Exposing ABL Procedures as Web services  Making Asynchronous Web service Calls

4 © 2008 Progress Software Corporation 4 SOA-26: Extending Your Application with OpenEdge Web Services Motivations for creating OpenEdge services  Mergers and Acquisitions  Opening up Business Logic to New Requesters  Automating Manual and Batch Processes  Automating Communication with Customers and Suppliers

5 © 2008 Progress Software Corporation 5 SOA-26: Extending Your Application with OpenEdge Web Services Services and the OpenEdge Reference Architecture Presentation Business Components Data Access Data Sources Common Infrastructure Enterprise Services Service Interface Service Service Interface Service Service Interface Service  The OpenEdge Reference Architecture is a Service Oriented Architecture (SOA)

6 © 2008 Progress Software Corporation 6 SOA-26: Extending Your Application with OpenEdge Web Services Calls from Business Components out to other services Presentation Business Components Data Access Data Sources Common Infrastructure Enterprise Services Somebody’s Web service Somebody’s Web service Service

7 © 2008 Progress Software Corporation 7 SOA-26: Extending Your Application with OpenEdge Web Services Service Interface in OpenEdge Reference Architecture Presentation Business Components Data Access Data Sources Common Infrastructure Enterprise Services Service Interface Service  Create a procedure for each operation to expose as a wrapper for a Web service  Package any code needed for the service to be called from that Service Interface INPUTs and OUTPUTs Service Manager Security Manager

8 © 2008 Progress Software Corporation 8 SOA-26: Extending Your Application with OpenEdge Web Services Stages of creating services in your application  Think about the goal of loosely-coupled services  Right-size your services for reuse potential  Learn by picking key areas for initial services  Move on to more robust architected services  Use services to transform and optimize the nature of your business

9 © 2008 Progress Software Corporation 9 SOA-26: Extending Your Application with OpenEdge Web Services Agenda  Services? What Services? And Why?  Running Web services from OpenEdge  Exposing ABL Procedures as Web services  Making Asynchronous Web service Calls

10 © 2008 Progress Software Corporation 10 SOA-26: Extending Your Application with OpenEdge Web Services OpenEdge and Web technologies  There are many standards and technologies that make Web services work  OpenEdge provides support for you Generating SOAP wrappers Generating WSDL description documents Turning WSDL into readable documentation Providing sample code to write and call

11 © 2008 Progress Software Corporation 11 SOA-26: Extending Your Application with OpenEdge Web Services SOAP  Originally stood for “Simple Object Access Protocol” Simple, indeed…  Envelope, Header, and Body <q1:OrderInfoID id="h_id1" xmlns:q1="urn:OrderSvc:OrderInfo"> 2e62cab6b81150d5:167f64e:f295e997b0: -8000; ;M/IryPm3piDcF/W5DsH4GA== <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> 3

12 © 2008 Progress Software Corporation 12 SOA-26: Extending Your Application with OpenEdge Web Services WSDL – Web Services Description Language: Not something you want to read and write

13 © 2008 Progress Software Corporation 13 SOA-26: Extending Your Application with OpenEdge Web Services Getting a WSDL document for code design  Run bprowsdldoc from proenv b-pro-wsdl-doc “batch” “ Progress” “WSDL” “document”  Provide the URL of the WSDL descriptor document  Output to a set of HTML documentation files

14 © 2008 Progress Software Corporation 14 SOA-26: Extending Your Application with OpenEdge Web Services Output from bprowsdldoc  Any internal documentation  The URL of the WSDL  The target namespace  “Port types” – callable operations  Datatypes of parameters

15 © 2008 Progress Software Corporation 15 SOA-26: Extending Your Application with OpenEdge Web Services Interface operations

16 © 2008 Progress Software Corporation 16 SOA-26: Extending Your Application with OpenEdge Web Services Sample code to connect to and run the Web service

17 © 2008 Progress Software Corporation 17 SOA-26: Extending Your Application with OpenEdge Web Services Procedure and parameters for an operation

18 © 2008 Progress Software Corporation 18 SOA-26: Extending Your Application with OpenEdge Web Services Creating a procedure with the sample syntax DEFINE TEMP-TABLE Customer NO-UNDO NAMESPACE-URI "http://tempuri.org/" FIELD custnum AS INTEGER FIELD name AS CHARACTER FIELD balance AS DECIMAL FIELD active AS LOGICAL. DEFINE DATASET getCustomersResult NAMESPACE-URI "http://tempuri.org/" FOR Customer. DEFINE VARIABLE hWebService AS HANDLE NO-UNDO. DEFINE VARIABLE hService1Soap AS HANDLE NO-UNDO. CREATE SERVER hWebService. hWebService:CONNECT ("-WSDL 'http://wstraining.progress.com:81/CustomerOrders/Service1.asmx? WSDL'"). RUN Service1Soap SET hService1Soap ON hWebService. RUN getCustomers IN hService1Soap(OUTPUT DATASET getCustomersResult). FOR EACH Customer: DISPLAY Customer. END.

19 © 2008 Progress Software Corporation 19 SOA-26: Extending Your Application with OpenEdge Web Services Agenda  Services? What Services? And Why?  Running Web services from OpenEdge  Exposing ABL Procedures as Web services  Making Asynchronous Web service Calls

20 © 2008 Progress Software Corporation 20 SOA-26: Extending Your Application with OpenEdge Web Services The OpenEdge Web services provider  One or more AppServers to run ABL code  3 rd party Web Server  OpenEdge Web Services Adapter  SOAP requests from consumers Request Response

21 © 2008 Progress Software Corporation 21 SOA-26: Extending Your Application with OpenEdge Web Services Setting up the pieces to the puzzle  Install your 3 rd party Web server  Configure one or more AppServers Best practices recommendation: Session-free to avoid binding AppServer ™ sessions  Configure the Web services adapter

22 © 2008 Progress Software Corporation 22 SOA-26: Extending Your Application with OpenEdge Web Services Simple test to expose as a Web service /* TestCust.p: Test procedure for AppServer and WebServices call. */ DEFINE INPUT PARAMETER pCustNum AS INTEGER NO-UNDO. DEFINE OUTPUT PARAMETER pCustName AS CHARACTER NO-UNDO. IF pCustNum = 1 THEN DO: pCustName = "Test Name". RETURN "Success!". END. ELSE DO: pCustName = "No Name". RETURN "Failure!". END.

23 © 2008 Progress Software Corporation 23 SOA-26: Extending Your Application with OpenEdge Web Services Configure and Enable Web Services Adapter  Expand Web Services Adapter entry in Explorer  Ensure “Enable Web Services” is checked When you’re ready to expose your Web services to the world  Check status to confirm everything is enabled

24 © 2008 Progress Software Corporation 24 SOA-26: Extending Your Application with OpenEdge Web Services Generating support files with ProxyGen  The Proxy Generator creates the supporting WSM and WSDL files your consumers need  Define a new application service  An external.p call is represented as an AppObject

25 © 2008 Progress Software Corporation 25 SOA-26: Extending Your Application with OpenEdge Web Services Adding a procedure to the application  Add the compiled test procedure to the application  Select File->Generate  Check Web Services as the service to generate

26 © 2008 Progress Software Corporation 26 SOA-26: Extending Your Application with OpenEdge Web Services Deploying the Web service in Explorer  Locate the WSM file that ProxyGen created  Confirm the deployment information  Enable the new Web service

27 © 2008 Progress Software Corporation 27 SOA-26: Extending Your Application with OpenEdge Web Services Testing the Web service  You can test by running the service from an OpenEdge client Even though you wouldn’t normally do this!  Request the WSDL that ProxyGen created using bprowsdldoc Just as you did with a foreign Web service!

28 © 2008 Progress Software Corporation 28 SOA-26: Extending Your Application with OpenEdge Web Services Writing a procedure to test the Web service  Sample syntax lets you invoke testcust as a function or as a procedure  RETURN statement in the test procedure becomes the RETURNS type of the function  Or it becomes an additional result parameter for the procedure call

29 © 2008 Progress Software Corporation 29 SOA-26: Extending Your Application with OpenEdge Web Services Complete procedure to call the Web service /* RunTestCust_WS.p: To run TestCust.p as a Web service */ DEFINE VARIABLE pCustNum AS INTEGER NO-UNDO. DEFINE VARIABLE result AS CHARACTER NO-UNDO. DEFINE VARIABLE pCustName AS CHARACTER NO-UNDO. DEFINE VARIABLE hWebService AS HANDLE NO-UNDO. DEFINE VARIABLE hTestCustObj AS HANDLE NO-UNDO. DEFINE VARIABLE lStatus AS LOGICAL NO-UNDO. CREATE SERVER hWebService. lStatus = hWebService:CONNECT("-WSDL 'http://localhost/wsa/wsa1/wsdl?targetURI=urn:…:john:TestCust'"). IF lStatus THEN DO: RUN TestCustObj SET hTestCustObj ON hWebService. RUN TestCust IN hTestCustObj (INPUT pCustNum, OUTPUT result, OUTPUT pCustName). MESSAGE "Status: " RESULT SKIP "Cust Name is " pCustName SKIP VIEW-AS ALERT-BOX. hWebService:DISCONNECT(). END. DELETE OBJECT hTestCustObj NO-ERROR. DELETE OBJECT hWebService NO-ERROR.

30 © 2008 Progress Software Corporation 30 SOA-26: Extending Your Application with OpenEdge Web Services Agenda  Services? What Services? And Why?  Running Web services from OpenEdge  Exposing ABL Procedures as Web services  Making Asynchronous Web service Calls

31 © 2008 Progress Software Corporation 31 SOA-26: Extending Your Application with OpenEdge Web Services So why consider using ASYNC?  Modern user interfaces don’t make people wait and do things in sequence  Calls to Web services have inherently unpredictable reliability and performance Let your code deal with calls that don’t complete Take advantage of running Web services concurrently

32 © 2008 Progress Software Corporation 32 SOA-26: Extending Your Application with OpenEdge Web Services Review of asynchronous calls in OpenEdge  You can run a procedure on an AppServer ASYNCHRONOUS  The OUTPUT parameters come back to a separate EVENT-PROCEDURE  The client caller can continue working until the EVENT-PROCEDURE runs

33 © 2008 Progress Software Corporation 33 SOA-26: Extending Your Application with OpenEdge Web Services Async call example /* RunTestCust_AS_async.p: */ DEFINE VARIABLE cCustName AS CHARACTER NO-UNDO. DEFINE VARIABLE hServer AS HANDLE NO-UNDO. DEFINE VARIABLE lReturn AS LOGICAL NO-UNDO. DEFINE VARIABLE hRequest AS HANDLE NO-UNDO. CREATE SERVER hServer. lReturn = hServer:CONNECT ("-AppService asbroker1 -H localhost -S 5162 -sessionModel session-free"). IF lReturn THEN DO: RUN testcust.p ON hServer ASYNCHRONOUS EVENT-PROCEDURE "testcust_response" (INPUT 1, OUTPUT cCustName). WAIT-FOR U1 OF THIS-PROCEDURE. END. hServer:DISCONNECT(). DELETE OBJECT hServer. Or use PROCESS EVENTS.

34 © 2008 Progress Software Corporation 34 SOA-26: Extending Your Application with OpenEdge Web Services Async event procedure  Here are the key lines again from the calling procedure:  And here is the EVENT-PROCEDURE that is called when the request completes: PROCEDURE testcust_response: DEFINE INPUT PARAMETER cCustName AS CHARACTER NO-UNDO. MESSAGE "Status: " RETURN-VALUE SKIP "Customer is " cCustName SKIP APPLY "U1" TO THIS-PROCEDURE. END PROCEDURE. RUN testcust.p ON hServer ASYNCHRONOUS EVENT-PROCEDURE "testcust_response" (INPUT 1, OUTPUT cCustName). WAIT-FOR U1 OF THIS-PROCEDURE.  Note that the procedure called on the AppServer does not need to change at all!

35 © 2008 Progress Software Corporation 35 SOA-26: Extending Your Application with OpenEdge Web Services Example procedure to run multiple Web services concurrently /* GoogleEx_async.p -- invoking external Web Service */ DEFINE VARIABLE iRepeat AS INTEGER NO-UNDO. DEFINE VARIABLE phrase AS CHARACTER EXTENT 5 NO-UNDO INITIAL ["Phonix, Arizona","Bastan, Massachusets","Las Angloos, CA", "New Yok, New Yerk", "Chacago, Illanoy"]. DEFINE VARIABLE KEY AS CHARACTER NO-UNDO. DEFINE VARIABLE return1 AS CHARACTER NO-UNDO. DEFINE VARIABLE hWebService AS HANDLE NO-UNDO. DEFINE VARIABLE hGoogleSearchPort AS HANDLE NO-UNDO. DEFINE VARIABLE hAsyncRequest AS HANDLE EXTENT 5 NO-UNDO. CREATE SERVER hWebService. hWebService:CONNECT("-WSDL 'http://api.google.com/GoogleSearch.wsdl'"). RUN GoogleSearchPort SET hGoogleSearchPort ON hWebService.

36 © 2008 Progress Software Corporation 36 SOA-26: Extending Your Application with OpenEdge Web Services Making five concurrent requests DO iRepeat = 1 TO 5: RUN doSpellingSuggestion IN hGoogleSearchPort ASYNCHRONOUS SET hAsyncRequest[iRepeat] EVENT-PROCEDURE "Spelling_Response" (INPUT key, INPUT phrase[iRepeat], OUTPUT return1). END. WAIT-FOR U1 OF THIS-PROCEDURE. DELETE OBJECT hGoogleSearchPort NO-ERROR. hWebService:DISCONNECT() NO-ERROR. DELETE OBJECT hWebService NO-ERROR.

37 © 2008 Progress Software Corporation 37 SOA-26: Extending Your Application with OpenEdge Web Services The event procedure PROCEDURE Spelling_Response: DEFINE INPUT PARAMETER pReturn1 AS CHARACTER NO-UNDO. DEFINE VARIABLE cResponsePhrase AS CHARACTER NO-UNDO. DO iRepeat = 1 TO 5: IF hAsyncRequest[iRepeat] = SELF THEN cResponsePhrase = phrase[iRepeat]. END. MESSAGE "The phrase was: " + cResponsePhrase skip "The suggestion is: " + pReturn1 SKIP "request count is: " hWebService:ASYNC-REQUEST-COUNT VIEW-AS ALERT-BOX. IF hWebService:ASYNC-REQUEST-COUNT = 0 THEN APPLY "U1" TO THIS-PROCEDURE. END.

38 © 2008 Progress Software Corporation 38 SOA-26: Extending Your Application with OpenEdge Web Services The results

39 © 2008 Progress Software Corporation 39 SOA-26: Extending Your Application with OpenEdge Web Services In Summary  Extend the value of your application with services  Take advantage of OpenEdge support for Web services  Package key parts of your application as reusable services

40 © 2008 Progress Software Corporation 40 SOA-26: Extending Your Application with OpenEdge Web Services For More Information, go to…  PSDN to item or category related to session topic  Education Courses: Title  Documentation: Title

41 © 2008 Progress Software Corporation 41 SOA-26: Extending Your Application with OpenEdge Web Services Relevant Exchange Sessions  Session-ID: Session Title

42 © 2008 Progress Software Corporation 42 SOA-26: Extending Your Application with OpenEdge Web Services Questions ?

43 © 2008 Progress Software Corporation 43 SOA-26: Extending Your Application with OpenEdge Web Services Thank You

44 © 2008 Progress Software Corporation 44 SOA-26: Extending Your Application with OpenEdge Web Services


Download ppt "SOA-26: Extending Your Application with OpenEdge ® Web Services John Sadd OpenEdge Evangelist."

Similar presentations


Ads by Google