1 / 44

IBM Informix Genero Web Services

IBM Informix Genero Web Services. <<Speaker Name Here>> <<For questions about this presentation contact Speaker Name speaker@us.ibm.com>>. Concepts and principles Creating a web service client Creating a web service server Debugging Deploy web services with Genero Application Server.

opearson
Download Presentation

IBM Informix Genero Web Services

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. IBM Informix Genero Web Services <<Speaker Name Here>> <<For questions about this presentation contact Speaker Name speaker@us.ibm.com>>

  2. Concepts and principles Creating a web service client Creating a web service server Debugging Deploy web services with Genero Application Server Agenda 2

  3. Concepts and principles Creating a web service client Creating a web service server Debugging Deploy web services with Genero Application Server Agenda 3

  4. Web services are the internet of applications: They are self-contained, self-describing, modular applications that can be published, located, and invoked across the Web. They are self-sufficient (human interactivity is not required). Web services perform functions, from simple requests to complicated business processes. Once deployed, other applications (and other Web services) can discover and invoke the Web service: Can be called and used from any BDL Client, not just Web. Can work between homogeneous BDL programs (Ex: HR-Finance) or heterogeneous programs (Ex: MS .Net program calling BDL Web service). What are web services? 4

  5. The Web Services Platform Technologies that make up the Web services platform are: EXtensible Mark Language (XML) to describe data. Simple Object Access Protocole (SOAP) to transfer data. Web Services Description Language (WSDL) to describe services. Universal Description, Discovery and Integration (UDDI) to list services. 5

  6. Benefits Why use Web Services: Ease partner-to-partner interaction. Make application integration easier. Create new business opportunities. Give business more and better choices. Give enterprises competitive advantages over rivals. Improve efficiency in trusted environments. 6

  7. Concepts and principles Creating a web service client Creating a web service server Debugging Deploy web services with Genero Application Server Agenda 7

  8. Development process Client Side: Generation of the client stub from Web Service description (WSDL). Simple function call. Server Side: Usual BDL code. Publication of functions. Generation of the Web Service description. Start of the server. 8

  9. Development process: Client side Source code MAIN CALL f1(a, b) … END MAIN Web Services Description <?xml version="1.0"?> <definitions> <message name=f1> <part name="a"/> <part name="b"/> … CALL Generation Generated source code FUNCTION f1(a, b) … END FUNCTION 9

  10. Creating a GWS Client Identify the Web Service Get WSDL information Examine generated .inc file Write application Compile application 10

  11. Creating a GWS Client Identify the Web Service Get WSDL information Examine generated .inc file Write application Compile application 11

  12. Get WSDL Information fglwsdl -o stubnamelocation stubname defines the name used by the tool when generating file stubs required for client application location can be the pathname leading to the WSDL file or the URI of the WSDL file Produces two file stubs: stubname.inccontains variable and record definitions stubname.4gl contains the underlying function code fglwsdl -o ws_calculator http://localhost:8090/Calculator?WSDL 12

  13. Creating a GWS Client Identify the Web Service Get WSDL information Examine generated .inc file Write application Compile application 13

  14. Examine Generated .inc File Function details (presented as comments) Input and Output global records Web services error structure Global variable for Web service URL 14

  15. Creating a GWS Client Identify the Web Service Get WSDL information Examine generated .inc file Write application Compile application 15

  16. Write Application Import the GWS Extension library. Specify the globals file. Call the function: Using input/output parameters (if permitted). Using global input and output records ( _g version ). Handle Web services errors. IMPORT COM 16

  17. Compile Application Compile all modules (.4gl files) including generated client stub Create the client application by linking: Compiled modules (.42m files) Library file WSHelper.42m (located in $FGLDIR/lib) fglcomp mymain.4gl ws_calculator.4gl fgllink -o clientapp.42r mymain.42m ws_calculator.42m WSHelper.42m 17

  18. Logical Names for Service Locations Global variable created by fglwsdl tool ( .inc ) DEFINE xxxLocation STRING Assign a logical name to this global variable ( .4gl ) LET xxxLocation = “myservice” FGLPROFILE entry (on client) maps the logical reference to an actual URL: ws.myservice.url = “http://localhost:8090/Calculator” 18

  19. Concepts and principles Creating a web service client Creating a web service server Debugging Deploy web services with Genero Application Server Agenda 19

  20. Development process: Server side Web Services Description Source code <?xml version="1.0"?> <definitions> <message name=f1> <part name="a"/> <part name="b"/> </message> … <service name="Calculator"> … FUNCTION f1(a, b) … END FUNCTION FUNCTION f2() … END FUNCTION WSDL generation Publication Published functions FUNCTION f1(a, b) … END FUNCTION SOAP Message handler 20

  21. Creating a GWS Server Writing a GWS Server fromscratch Writing a GWS Server using aWSDL Define Input and Output recordsfor each operation Generate the server stubs and Complete the Web Service Server Define all operations your Web Service will provide Publish Operation Call CreateService() Register the Service Start Service & Process Requests Start Service & Process Requests 21

  22. Define Input and Output Input parameters and return values not allowed. One global or module variable per function permitted for: Input message Output message Message must be a RECORD where each field represents a parameter. Genero 2.x permits adding of optional attributes mapping to XML data types. 22

  23. Write BDL Function A normal BDL function using the input and output records defined: Cannot have input and output parameters. Must use global or module record to provide input and output values. Each function can become a separate Web service operation and requires its own global or module record. 23

  24. Publish the Operation, Register the Service IMPORT com … FUNCTION createservice() DEFINE serv com.WebService DEFINE op com.WebOperation LET serv = com.WebService.CreateWebService( "Calculator", "http://tempuri.org/webservices") LET op = com.WebOperation.CreateRPCStyle( "add", "Add", add_in, add_out) CALL serv.publishOperation(op,NULL) CALL com.WebServiceEngine.RegisterService(serv) END FUNCTION Import Library Create Web Service Create Operation Publish the Operation Register the Service 24

  25. Summary calculatorServer.4gl Define Input and Output recordsfor each operation Publish Operation Register the Service Define all operations your Web Service will provide 25

  26. Creating a GWS Server Writing a GWS Server fromscratch Writing a GWS Server using a WSDL Define Input and Output recordsfor each operation Generate the server stubs and Complete the Web Service Server Define all operations your Web Service will provide Publish Operation Call CreateService() Register the Service Start Service & Process Requests Start Service & Process Requests 26

  27. Starting Service and Processing Requests CALL com.WebServiceEngine.Start() DISPLAY "The server is listening." WHILE TRUE LET ret = com.WebServiceEngine.ProcessServices(-1) CASE ret WHEN 0 DISPLAY "Request processed." WHEN -1 DISPLAY "Timeout reached." WHEN -2 DISPLAY "Disconnected from application server." EXIT PROGRAM WHEN -3 DISPLAY "Client Connection lost." WHEN -4 DISPLAY "Server interrupted with Ctrl-C." WHEN -10 DISPLAY "Internal server error." END CASE IF int_flag<>0 THEN LET int_flag=0 EXIT WHILE END IF END WHILE 27

  28. Creating a GWS Server Writing a GWS Server fromscratch Writing a GWS Server using aWSDL Define Input and Output recordsfor each operation Generate the server stubs and Complete the Web Service Server Define all operations your Web Service will provide Publish Operation Call CreateService() Register the Service Start Service & Process Requests Start Service & Process Requests 28

  29. Mimic Existing Web Service fglwsdl -s -o stubnamelocation stubname defines the name used by the tool when generating file stubs for server application locationcan be the pathname leading to the WSDL file or the URI of the WSDL file Produces two file stubs: stubnameServer.inccontains variable and record definitions stubnameServer.4glcontains code to publish function fglwsdl -s -o ws_calc http://localhost:8090/Calculator?WSDL 29

  30. Complete the Web Server Service ws_calcService.4gl ws_calcService.inc FUNCTION Add() LET AddResponse.r = Add.a + Add.b END FUNCTION 30

  31. Creating a GWS Server Writing a GWS Server from scratch Writing a GWS Server using a WSDL Define Input and Output recordsfor each operation Generate the server stubs and Complete the Web Service Server Define all operations your Web Service will provide Publish Operation Call CreateService() Register the Service Start Service & Process Requests Start Service & Process Requests 31

  32. Completing the Web Service Server In the MAIN module: Define Status variable DEFINE ret INTEGER CALL CreateService() Call Create/Publish/Register function 32

  33. Creating a GWS Server Writing a GWS Server from scratch Writing a GWS Server using a WSDL Define Input and Output recordsfor each operation Generate the server stubs and Complete the Web Service Server Define all operations your Web Service will provide Publish Operation Call CreateService() Register the Service Start Service & Process Requests Start Service & Process Requests 33

  34. Starting Service and Processing Requests CALL com.WebServiceEngine.Start() DISPLAY "The server is listening." WHILE TRUE LET ret = com.WebServiceEngine.ProcessServices(-1) CASE ret WHEN 0 DISPLAY "Request processed." WHEN -1 DISPLAY "Timeout reached." WHEN -2 DISPLAY "Disconnected from application server." EXIT PROGRAM WHEN -3 DISPLAY "Client Connection lost." WHEN -4 DISPLAY "Server interrupted with Ctrl-C." WHEN -10 DISPLAY "Internal server error." END CASE IF int_flag<>0 THEN LET int_flag=0 EXIT WHILE END IF END WHILE 34

  35. Compile Application Compile all modules (.4gl files). Create the client application by linking: Compiled modules (.42m files). Library file WSHelper.42m (located in $FGLDIR/lib). fglcomp svr_src.4gl ws_calcService.4gl fgllink -o serverapp.42r svr_src.42m ws_calService.42m WSHelper.42m If using a third-party WSDL, you would include generated files in the compilation. 35

  36. XML Classes and Methods The GWS provides an additional library of classes and methods – the XML library. Use the IMPORT statement at the top of your Genero .4gl module to import the library into your Genero application: IMPORT xml 36

  37. Concepts and principles Creating a web service client Creating a web service server Debugging Deploy web services with Genero Application Server Agenda 37

  38. Debugging Usual needed information: What is the server ? What is the client ? WSDL + XSD WS-DEBUG FGLWSDEBUG=3 0 : No data displayed; debug turned off. 1 : Display socket errors. 2 : Display incoming and outgoing XML requests. 3 : Display incoming and outgoing requests. Serialization issues: Get the xml message from the WS-DEBUG Xml.Serializer.domtovar 38

  39. Concepts and principles Creating a web service client Creating a web service server Debugging Deploy web services with Genero Application Server Agenda 39

  40. GWS DeploymentGenero Application Server - architecture 40

  41. GWS Deployment Deployment involves the Genero Application Server: <SERVICE_LIST> [ <GROUP ...> [...] ] [ <APPLICATION ...> [...] ] </SERVICE_LIST> With GROUP, applications can be defined in an external application configuration file 41

  42. Web Service Application Example <APPLICATION Parent="ws.default"> <EXECUTION> <PATH>$(res.path.fgldir.demo)</PATH> <MODULE>webapp.42r</MODULE> </EXECUTION> </APPLICATION> 42

  43. Debugging GAS log in $FGLASDIR/log A directory is created each day with the naming convention naming YYYYMMDD In this directory a file is created for each dispatcher and each proxy session. Detailed log <LOG> <OUTPUT Type="DAILYFILE"/><FORMAT Type="TEXT">date time relative-time process-id thread-id contexts event-type event-params</FORMAT> <CATEGORIES_FILTER>ALL</CATEGORIES_FILTER> </LOG> To send to your local support center. 43

  44. 44

More Related