Call Any Web Service from the Progress 4GL Michael Resnick Principal Software Engineer SOA-07: Call Any Web Service from the Progress 4GL Description: OpenEdge 10 supports the ability to easily invoke functionality that is exposed as a Web service. Learn about the tools and the Progress 4GL constructs that you will use to invoke a Web service method. learn the basic steps required to call out to a Web service from the Progress 4GL. Start with a WSDL file - the standards-based definition for a Web service - and learn how the WSDL Analyzer makes it simple to invoke a Web services application and how the 4GL hides the complexity of dealing with SOAP messages. You'll also learn how complex data is handled in the 4GL. A demonstration will show a Progress 4GL program interacting with a live Web service on the Internet.
Under Development D I S C L A I M E R This talk includes information about potential future products and/or product enhancements. What I am going to say reflects our current thinking, but the information contained herein is preliminary and subject to change. Any future products we ultimately deliver may be materially different from what is described here. D I S C L A I M E R
Agenda Introduction Web Service Basics WSDL Analyzer Calling A Web Service from the 4GL Coming in 10.1A And Beyond
Web Service Client Available in OpenEdge® 10.0A AppServer not needed Client to a different application
Web Services – Why? Heterogeneous connectivity In SOA makes distributed services possible Lower common denominator than either EDI or CORBA
Web Services – Why? Web service providers available Products: OpenEdge, Oracle, IBM DB/2, SalesForce.com, etc. Services: Google, e-Bay, Commonwealth of Massachusetts, etc. Development platforms: OpenEdge, .NET™, J2EE, Apache, WebSphere.
Web Services – Why Not? May not be efficient May not be available
Web Service Basics - Where? Users Enterprise Services Presentation Layer Integration Layer Business Servicing Layer Environment Managers and Utilities Data Access Layer Managed Data Stores Unmanaged Data Stores
Agenda Introduction Web Service Basics WSDL Analyzer Calling A Web Service from the 4GL Coming in 10.1A And Beyond
Web Service Basics – SOAP Message imple O bject A ccess P rotocol Envelope Body Header Header Entry … Body Entry Header optional Entries may be SOAP Faults (errors)
Web Service Basics - WSDL escription L anguage Defines Interface Data encoding Transport Service address Contract between client and server
Anatomy of a Web Service Session WSDL Request A Web Service Provider WSDL Response OpenEdge 4GL Client SOAP Request SOAP Response SOAP Request SOAP Response
Agenda Introduction Web Service Basics WSDL Analyzer Analyzer demonstration Calling A Web Service from the 4GL Coming in 10.1A And Beyond
4GL/WSDL Dictionary 4GL WSDL AppServer™.…......…............. Web service Persistent procedure..............Port type (interface) Internal procedure..................Operation
WSDL Analyzer Command Line Generates 4GL documentation for a web service C:\temp> bprowsdldoc http://api.google.com/GoogleSearch.wsdl google Documentation written to file:///c:\temp\google\index.html C:\temp>
Anatomy of Client Design WSDL Request Web Service Provider WSDL Analyzer WSDL Response OpenEdge 4GL Client Generated Documents
Generated Documents Service Port type Data types Operation Index index connect & call Data types complex data Operation Index
Analyzer Demo Snapshots: Service Documentation
Analyzer Demo Snapshots: Service Document
Analyzer Demo Snapshots: Port Type – Connection Summary
Analyzer Demo Snapshots: Port Type – Operation Summary
Analyzer Demo Snapshots: Port Type – Operation Example
Analyzer Demo Snapshots: Port Type – Operation Parameters
Analyzer Demo Snapshots: Port Type – Complex Parameter Example
Complex Data as TEMP-TABLE addCustomers Procedure prototype PROCEDURE addCustomers: DEFINE INPUT PARAMETER TABLE FOR customerList. DEFINE OUTPUT PARAMETER TABLE FOR conflictList. END PROCEDURE.
Complex Data as TEMP-TABLE Example DEFINE TEMP-TABLE customerList NAMESPACE-URI http://mycompany.com/schemas/customerList NAMESPACE-PREFIX "cust“ FIELD CustNum AS INTEGER FIELD Name AS CHARACTER XML-NODE-TYPE "Attribute“ FIELD Country AS CHARACTER FIELD Comments AS CHARACTER INDEX CustNum IS PRIMARY UNIQUE CustNum INDEX Name Name INDEX Comments IS WORD-INDEX Comments.
Complex Data as TEMP-TABLE Parameters customerList This value is defined as a TEMP-TABLE. This value can also be expressed as a CustomerTable element in The http://mycompany.com/schemas/customerList namespace. As such, this parameter can be passed as a CHARACTER or LONGCHAR value containing an XML document. View example of XML.
Agenda Introduction Web Service Basics WSDL Analyzer Calling A Web Service from the 4GL Data type mapping Connecting and calling Demonstration Header handling Error handling Coming in 10.1A And Beyond
Simple Data Type Map XML Schema Data Type Progress 4GL Data Type string CHARACTER boolean LOGICAL decimal DECIMAL integer INTEGER float, double, duration CHARACTER and LONGCHAR can always be used For complete mappings see documentation
Complex Data Represented two ways: LONGCHAR/CHARACTER of serialized XML document ProDataSet or TEMP-TABLE when possible (10.1A) Analyzer shows examples for each.
Connecting and Calling Just Like An AppServer CREATE SERVER web-svc-handle. web-svc-handle:CONNECT(“-WSDL wsdl-url ws-connect-parms”). RUN port-type-name SET port-type-handle ON web-svc-handle. RUN operation IN port-type-handle(parameters). CREATE SERVER app-server-handle. app-server-handle:CONNECT(“appserver-connect-parms”). RUN persistent-proc PERSISTENT SET procedure-handle ON app-server-handle. RUN internal-proc IN procedure-handle(parameters).
Google Results in Browser
Selected Connection Example
Pasted Connection and Call Examples
Variable Definitions in Completed .p
Connect and Set Port in Completed .p
Call to Google in Completed .p
Search Results Using DOM
Load TEMP-TABLE with Results
4GL Client Results
… … 4GL SOAP Header Objects SOAP-HEADER Envelope Header Header Entry SOAP-HEADER-ENTRYREF … SOAP-HEADER-ENTRYREF … Body Body Entry
SOAP Headers Set a callback port-type-handle:SET-CALLBACK-PROCEDURE( “REQUEST-HEADER | RESPONSE-HEADER”, “request-handler-name”, web-service-handle). Write the callback PROCEDURE request-handler-name: DEFINE INPUT PARAMETER soap-header-handle AS HANDLE. DEFINE INPUT PARAMETER operation-namespace AS CHARACTER. DEFINE INPUT PARAMETER operation-local-name AS CHARACTER. END.
Anatomy Of A Web Service Error WSDL Request Web Service Provider WSDL Response OpenEdge 4GL Client SOAP Request SOAP Response (FAULT)
4GL SOAP Fault Envelope Body Body Entry fault code fault string fault actor <faultdetail>
4GL Fault Objects ERROR-STATUS SOAP-FAULT fault info SOAP-FAULT-DETAIL XML
SOAP Fault - Faultstring An error was detected while executing the Web Service request. (10893)
SOAP Fault - Detail <detail> <errorMessage> msg=The server application returned the error: Invoice not found; targetException=ERROR condition: The Server application has returned an error. (7243) (7211)] </errorMessage> <requestID> 172247e5b58beb30:5bb966:fb4fdb744a:-7fff#9 </requestID> </detail>
Agenda Introduction Web Service Basics WSDL Analyzer Calling A Web Service from the 4GL Coming in 10.1A And Beyond
Coming in OpenEdge 10.1A Mapping complex data to ProDataSets and TEMP-TABLEs Support for wrapped document literal Improvements in the WSDL Analyzer Facet documentation Reserved keywords
Beyond 10.1A We are considering Improving complex data support based on OO initiative SOAP 1.2, WSDL 2.0 Support Integration with new OpenEdge IDE Improved validation WS-Security
Web Service or AppServer? In Summary Calling a web service is easy Use the WSDL Analyzer OpenEdge 4GL Client Web Service or AppServer?
SOAP 1.1 Specification SOAP 1.1 Notes (submissions by member organizations) Simple Object Access Protocol (SOAP) 1.1 http://www.w3.org/TR/SOAP
SOAP 1.2 Specifications (1/4) Recommendations (standards) Base SOAP Version 1.2 Part 0: Primer http://www.w3.org/TR/soap12-part0/ SOAP Version 1.2 Part 1: Messaging Framework http://www.w3.org/TR/soap12-part1/ SOAP Version 1.2 Part 2: Adjuncts http://www.w3.org/TR/soap12-part2/ SOAP Version 1.2 Specification Assertions and Test Collection http://www.w3.org/TR/soap12-testcollection
SOAP 1.2 Specifications (2/4) Recommendations (standards) Ancillary SOAP Message Transmission Optimization Mechanism http://www.w3.org/TR/soap12-mtom/ Resource Representation SOAP Header Block http://www.w3.org/TR/soap12-rep/
SOAP 1.2 Specifications (3/4) Drafts (submitted by W3C working groups; will become recommendations) SOAP 1.2 Attachment Feature http://www.w3.org/TR/soap12-af/ SOAP Version 1.2 Message Normalization http://www.w3.org/TR/soap12-n11n/ SOAP Optimized Serialization Use Cases and Requirements http://www.w3.org/TR/soap12-os-ucr/
SOAP 1.2 Specifications (4/4) Notes (submitted by W3C working groups or member organizations) SOAP Version 1.2 Usage Scenarios http://www.w3.org/TR/xmlp-scenarios SOAP Version 1.2 Email Binding http://www.w3.org/TR/soap12-email
WSDL 1.1 Specification WSDL 1.1 Notes (submitted by member organizations) Web Services Description Language (WSDL) 1.1 http://www.w3.org/TR/wsdl
WSDL 2.0 Specifications WSDL 2.0 Drafts (submitted by W3C working group; will become standards) Web Services Description Language (WSDL) Version 2.0 Part 0: Primer http://www.w3.org/TR/wsdl20-primer Web Services Description Language (WSDL) Version 2.0 Part 1: Core Language http://www.w3.org/TR/wsdl20 Web Services Description Language (WSDL) Version 2.0 Part 3: Bindings http://www.w3.org/TR/wsdl20-bindings Web Services Description Language (WSDL) Version 2.0 Part 2: Predefined Extensions http://www.w3.org/TR/wsdl20-extensions
Google Web Service Site Google Web APIs (beta) http://www.google.com/apis
Questions?
Thank you for your time!