1 / 86

4GL Clients Accessing Industry Web Service

4GL Clients Accessing Industry Web Service. Agenda. OpenEdge Web Services 4GL Client Overview WSDL Analyzer Calling a Web Service from the 4GL Handling Data to/from Progress & Web Services New & Enhanced Language Constructs Accessing SOAP Headers Error Handling.

cera
Télécharger la présentation

4GL Clients Accessing Industry Web Service

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 4GL Clients Accessing Industry Web Service

  2. Agenda • OpenEdge Web Services 4GL Client Overview • WSDL • Analyzer • Calling a Web Service from the 4GL • Handling Data to/from Progress & Web Services • New & Enhanced Language Constructs • Accessing SOAP Headers • Error Handling

  3. Web Services 4GL Client Overview POST(SOAP) SOAP Processor HTTP Client Response(SOAP) WSDL Web Service Access from the 4GL • Calling a Web service from the Progress 4GL • Similar to calling an AppServer procedure A Web Service A Web Services-enabled application OpenEdge 4GL Client

  4. Three Examples • Internet Temperature Sample • Internet StockQuote Sample • Internal .NET BlackBox CreditCheck

  5. Temperature Sample A Web Service getTemp Bedford, MA 01730 Orlando, FL 32801

  6. StockQuotes Sample A Web Service getQuote

  7. CheckCreditWindow.w A Web Service • ServiceCreditCheckSoap • CheckCredit • getMaxCredit

  8. Lab Setup and Sample Demo nstration • Using the “Black Box Web Service Install.doc” supplied as prerequisite deploy the web service files • Complete “Lab Setup and Sample Demonstration” section

  9. Agenda • OpenEdge Web Services 4GL Client Overview • WSDL • Analyzer • Calling a Web Service from the 4GL • Handling Data to/from Progress & Web Services • New & Enhanced Language Constructs • Accessing SOAP Headers • Error Handling

  10. WSDL Web Service Description Language W3C note – defacto standard http://www.w3.org/TR/WSDL.html • XML Document describing the Web Service • Service interface What does it do? • Service implementation How do I invoke it? • Service location Where is it? • A contract between the client and server

  11. WSDL Web Service Description Language • Specifies interface • Business methods that can be invoked (“operations”) • Message structure for each method • Data fields, types • Bindings for the operations • SOAP over HTTP • Identifies network address of Web Service

  12. Web Service Development Roles • Web Service Developer • Develops, publishes, deploys the Web Service & WSDL • Web Service Client Developer • Toolkits used to generate client code/proxies • WSDL • Abstract Definitions • Platform and language independent • Concrete Definitions • Maps operations to actual protocols and service locations

  13. WSDL Structure WSDL Definitions • WSDL Types • Data type definitions (XML Schema) • WSDL Messages • Combinations of data fields (“parts”) • Message Name unique to identify message • WSDL Ports • Each Port Element specifies a binding & location • WSDL Bindings • Bindings specified for operations • E.g. SOAP; HTTP POST, GET • Namespace, encodings specified for SOAP bodies, relative locations specified • WSDL Services • Associates a URL with each port / binding WSDL Types WSDL Messages WSDL Parts WSDL Ports WSDL Operations WSDL Bindings Operation Bindings WSDL Services Addresses for Ports

  14. WSDL Sections Types (Object IDs, TEMP-TABLEs) Messages (4GL procedure request/response) Abstract PortTypes Operations Operations Bindings Concrete Services Ports

  15. WSDL PortTypes Web Service “Procedure Object” • Encapsulates operations in a Web Service • Mapped to portType element of WSDL • Used to invoke operations • RUN statement • FUNCTION call

  16. Agenda • OpenEdge Web Services 4GL Client Overview • WSDL • Analyzer • Calling a Web Service from the 4GL • Handling Data to/from Progress & Web Services • New & Enhanced Language Constructs • Accessing SOAP Headers • Error Handling

  17. WSDL Analyzer • Processes the WSDL • Generates documentation for 4GL developer • How to connect • How to create • How to invoke • Depending on the Web service you will either use a RUN statement or a FUNCTION call

  18. WSDL Analyzer Utility to analyze and document WSDL • bprowsdldoc

  19. WSDL Analyzer Output Service Data Types PortType PortType PortType Service DataTypes PortType PortType PortType (1) (2) 1 Main hypertext link (from service list to actual entry) 2 Secondary hypertext link (cross reference)

  20. WSDL Analyzer Output • Temperature Sample • Stock Quotes • Lab – CheckCredit

  21. WSDL Analyzer - Temperature Demo

  22. WSDL Analyzer - Temperature Port Types - 1 of 3

  23. WSDL Analyzer - Temperature Port Types – 2 of 3

  24. WSDL Analyzer - Temperature Port Types – 3 of 3

  25. WSDL Analyzer Output • Temperature Sample • Stock Quotes • Lab – CheckCredit

  26. WSDL Analyzer – Stock Quotes Demo

  27. WSDL Analyzer – Stock Quotes Port Types – 1 of 3

  28. WSDL Analyzer – Stock Quotes Port Types – 2 of 3

  29. WSDL Analyzer – Stock Quotes Port Types – 3 of 3

  30. WSDL Analyzer – Stock Quotes Parameters – GetStockQuotes

  31. WSDL Analyzer – Stock Quotes Parameters – GetStockQuotesResponse 1 of 2

  32. WSDL Analyzer – Stock Quotes Parameters – GetStockQuotesResponse 2 of 2

  33. WSDL Analyzer Output • Temperature Sample • Stock Quotes • Lab – CheckCredit

  34. Using the WSDL Analyzer Lab • Complete “Using the WSDL Analyzer” section of the lab

  35. Agenda • OpenEdge Web Services 4GL Client Overview • WSDL • Analyzer • Calling a Web Service from the 4GL • Handling Data to/from Progress & Web Services • New & Enhanced Language Constructs • Accessing SOAP Headers • Error Handling

  36. Calling a Web Service from the 4GL Similar to Accessing an AppServer AppServer Web Service • Create server handle • Connect to AppServer • Run procedures • Disconnect • Delete server handle • Create server handle • Bind to Web Service • Invoke WS operations • Disconnect • Delete server handle

  37. Calling a Web Service from the 4GL Similar to Accessing an AppServer AppServer Web Service • Create server handle • Connect to AppServer • Run procedures • Persistent Procedure • IPs, UDFs • Delete handle • Disconnect • Delete server handle • Create server handle • Bind to Web Service • Invoke WS operations • Identify portType • Run / Call Service • Delete handle • Disconnect • Delete server handle

  38. Calling a Web Service from the 4GL • Create server handle • Bind to Web Service • Invoke operations on the Web Service • Identify portType • Run / Call Service • Delete handle • Disconnect • Delete server handle

  39. Enhanced 4GL Constructs • CONNECT method • “Binds” the Web Service to the handle • RUNON statement SET . . . . • Creates a “proc object” for a Web Service operation • Invoke the PortType and get a handle to “proc object” • RUN IN statement • Call Web Service operation • FUNCTIONstatement • Maps a UDF prototype to a Web Service operation that specifies a <return> parameter element

  40. Invoking a Web Service Operation Web Service “Procedure Object” • RUN • Used for operations that do not have a return parameter • Synchronous or Asynchronous • FUNCTION • Used for operations that have a return parameter • Synchronous only

  41. Calling a Web Service from the 4GL DEFINE VARIABLE hWebService AS HANDLE. CREATE SERVER hWebService. hWebService:CONNECT(connection_parameters). RUN portTypeName SET hPortType ON SERVER hWebService. RUN operationName IN hPortType NO-ERROR. FUNCTION operationName RETURNS dataType IN hPortType. DELETE PROCEDURE hPortType. hWebService:DISCONNECT(). DELETE OBJECT hWebService. 1 2 3 4 5

  42. Additional Parameters on CONNECT() • Character String, space separated list -WSDL -WSDLUserId -WSDLPassword -Service -ServiceNamespace -Port -Binding -BindingNamespace -SOAPEndpoint -SOAPEndpointUserId -SOAPEndpointPassword -TargetNamespace -MaxConnections -pf

  43. Calling a Web Service from the 4GL Demo • Temperature Sample • Stock Quotes Sample

  44. From the WDSL Analyzer • DEFINE VARIABLE hWebService AS HANDLE. • DEFINE VARIABLE hTemperaturePortType AS HANDLE. • CREATE SERVER hWebService. • hWebService:CONNECT("-WSDL • 'http://www.xmethods.net/sd/2001/TemperatureService.wsdl' • -Service TemperatureService • -Port TemperaturePort"). • RUN TemperaturePortType SET hTemperaturePortType ON hWebService. 1 2 3a • Connect Method Parameters • Example

  45. From the WDSL Analyzer • DEFINE VARIABLE zipcode AS CHARACTER. • DEFINE VARIABLE return AS CHARACTER. • RUN getTemp IN hTemperaturePortType • (INPUT zipcode, OUTPUT return). 3b • Operation (internal procedure) detail • getTemp • Example

  46. Temperature Sample Call – RPC encoded • Create Server Object DEFINE VARIABLE hWebService AS HANDLE. … CREATE SERVER hWebService. 1 • “Bind” to the Web Service 2 hWebService:CONNECT("-WSDL 'http://www.xmethods.net/sd/2001/TemperatureService.wsdl' "). IF NOT hWebService:CONNECTED() THEN MESSAGE "SERVER NOT CONNECTED" VIEW-AS ALERT-BOX.

  47. Temperature Sample Call – RPC Encoded • Sets the handle to the port type in the WSDL where the Web service operation is defined and waits for the user to invoke the request • DEFINE VARIABLE hPortType AS HANDLE. • . . . • RUN TemperaturePortType SET hPortType ON SERVER hWebService • NO-ERROR. • IF ERROR-STATUS:ERROR THEN • MESSAGE "Failed to create hPortType" VIEW-AS ALERT-BOX. • WAIT-FOR CLOSE OF CURRENT-WINDOW. 3a

  48. Temperature Sample Call - RPC Encoded • Invokes the Web service getTemp operation by making a procedure call • DEFINE VARIABLE cTemp AS CHARACTER. • . . . • ON CHOOSE OF bgetTemp • DO: • cZipCode = fillin-1:SCREEN-VALUE. • RUN getTemp IN hPortType (INPUT cZipCode, OUTPUT cTemp) NO-ERROR. • . . . 3b

  49. Temperature Sample Call - RPC Encoded • If there are no errors assign the screen-value for cTemp • IF ERROR-STATUS:ERROR THEN • DO: • /* Code you will see during error handling */ • END. • ELSE • fillin-2:SCREEN-VALUE = STRING(cTemp, "99").

  50. Temperature Sample Call - RPC Encoded • Delete procedure handle 3 DELETE PROCEDURE hPortType. • “Disconnect” from Web Service 4 hWebService:DISCONNECT(). • Delete Server Handle 5 DELETE OBJECT hWS.

More Related