48
Web Development and Web Services… Berry Kuijer Saat Solution Consultant January 31, 2013

Web Development and Web Services with Uniface 9.6

  • Upload
    uniface

  • View
    2.437

  • Download
    9

Embed Size (px)

DESCRIPTION

Building on its extensive web development capabilities, using Dynamic Server Pages, Uniface 9.6 enables HTML 5 and provides a JavaScript API to enable software development using JavaScript technology. This provides a wealth of options, including the integration of web sites that can be integrated. The user experience of Uniface applications can be extended through the use of the new functionality to dynamically style HTML elements.

Citation preview

Page 1: Web Development and Web Services with Uniface 9.6

Web Development and Web Services…

Berry Kuijer Saat

Solution Consultant

January 31, 2013

Page 2: Web Development and Web Services with Uniface 9.6

ARE TWO COMPLETE DIFFERENT THINGS….(EXCEPT FOR THE WORD “WEB”)

Page 3: Web Development and Web Services with Uniface 9.6

Topics

� Web Services call-in� Web Services call-out

� Web Development DSP’s� JavaScript API

Page 4: Web Development and Web Services with Uniface 9.6

A WEB SERVICE IS…

Page 5: Web Development and Web Services with Uniface 9.6
Page 6: Web Development and Web Services with Uniface 9.6

…a method of communication between two electronic devices over the World Wide Web.

…is a software function provided at a network address over the web or the cloud, it is a service that is "always on“…

© Wikipedia

Page 7: Web Development and Web Services with Uniface 9.6

• are application components

• communicate using open protocols

• are self-contained and self-describing

• can be discovered using UDDI

• can be used by other applications

• based on XML

According to the W3C, the World Wide Web Consortium, two major classes of Web services exist:

• REST-compliant Web services: the primary purpose of this kind of Web service is to manipulate XML representations of Web resources using a uniform set of "stateless" operations

• Arbitrary Web services: these Web services may expose an arbitrary set of operations

© Wikipedia, W3C

Page 8: Web Development and Web Services with Uniface 9.6
Page 9: Web Development and Web Services with Uniface 9.6

SOAP…WSDL…UDDI…

Page 10: Web Development and Web Services with Uniface 9.6

SOAP is a protocol for accessing a Web Service.

…stands for Simple Object Access Protocol

…is a communication protocol

…is a format for sending messages

…is designed to communicate via Internet

…is platform independent

…is language independent

…is based on XML

…is simple and extensible

…allows you to get around firewalls

…is a W3C standard© W3C

Page 11: Web Development and Web Services with Uniface 9.6

WSDL is an XML-based language for locating and describing Web services.

…stands for Web Services Description Language

…is based on XML

…is used to describe Web services

…is used to locate Web services

…is a W3C standard© W3C

Page 12: Web Development and Web Services with Uniface 9.6

UDDI is a directory service where companies can register and search for Web services.

…stands for Universal Description, Discovery and Integration

…is a directory for storing information about web services

…is a directory of web service interfaces described by WSDL

…communicates via SOAP© W3C

Page 13: Web Development and Web Services with Uniface 9.6
Page 14: Web Development and Web Services with Uniface 9.6

WS Call-inEnable the world to access a Uniface

service

Page 15: Web Development and Web Services with Uniface 9.6

WS Call-in

Page 16: Web Development and Web Services with Uniface 9.6

CREATE A WEB SERVICE…

Page 17: Web Development and Web Services with Uniface 9.6

…FROM A UNIFACE SERVICE

Page 18: Web Development and Web Services with Uniface 9.6

/sto /mwr=ws ServiceName

Page 19: Web Development and Web Services with Uniface 9.6

For deployment, put the generated WSDL and XSD files in the directory WebServerDir\webapps\uniface\WEB-INF\wsdl, for example,

C:\Program Files (x86)\Compuware\Uniface 9.6.01\uniface\webapps\uniface\WEB-INF\wsdl

To test in standard Uniface 96 environment:

http://localhost:8086/uniface/services/tempconverterdlw?wsdl

Page 20: Web Development and Web Services with Uniface 9.6
Page 21: Web Development and Web Services with Uniface 9.6

WS Call-outEnable Uniface to call to the world

Page 22: Web Development and Web Services with Uniface 9.6

WS Call-outEnable Uniface to call to the world

Page 23: Web Development and Web Services with Uniface 9.6

CREATE A SIGNATURE…

Page 24: Web Development and Web Services with Uniface 9.6

…FROM A WEB SERVICE

Page 25: Web Development and Web Services with Uniface 9.6

/sti /mwr=ws Web Service

Page 26: Web Development and Web Services with Uniface 9.6

activate "TEMPCONVERTERSERVICE".CONVERTTEMPERATURE(TEMPOUT,TEMPKINDOUT,TEMPIN,TEMPKINDIN,Report)

Page 27: Web Development and Web Services with Uniface 9.6

• SOAP call-back operations

• Complex datatypes

• SOAP headers

Page 28: Web Development and Web Services with Uniface 9.6

Call-in Call-out

Page 29: Web Development and Web Services with Uniface 9.6

To use callback operations,

• create one or more Uniface services that implement the defined operations

• configure Uniface so that it can find the component containing the callback operations.

Web Services Call-Out

When a Uniface component activates a web service, the SOAP connector is responsible for preparing and sending the request, and receiving and interpreting the response. Using the callback operations for call-out, you can enable additional processing just before the SOAP message is sent, or just after it is received. For example, you can provide intelligent error handling for SOAP faults, or encrypt or decrypt the content.

Web Services Call-In

When clients call in to Uniface web services they may provide a SOAP envelope that includes encrypted content, or information that Uniface itself does not handle or require, and they may expect a similar response back. To ensure that you can handle and construct SOAP envelopes that meet these requirements, you can implement callback operations that are automatically called before and after the target operation of the web service.

Page 30: Web Development and Web Services with Uniface 9.6

Transformation, using the struct datatype.

Sourcedata

Targetdata

Transform StructTransform StructTransform Struct

….Transform Struct

Convert into Struct Convert from Struct

Page 31: Web Development and Web Services with Uniface 9.6

About struct

• data structure in memory• nodes

• leaves

• accessed by handles to be modified

• scalar members and struct nodes

• members are sequentially ordered

• converted using proc

Page 32: Web Development and Web Services with Uniface 9.6

$dbgstruct

Page 33: Web Development and Web Services with Uniface 9.6

Web Development

Page 34: Web Development and Web Services with Uniface 9.6
Page 35: Web Development and Web Services with Uniface 9.6

WEB DEVELOPMENT IS…

Page 36: Web Development and Web Services with Uniface 9.6

Develop with Uniface Dynamic Server Pages (DSP):

• Client Browser

• Web Server

• Native Uniface script (“Proc”)

• JavaScript using the API

Btw: usp’s are still supported

Page 37: Web Development and Web Services with Uniface 9.6

Web Server

Page 38: Web Development and Web Services with Uniface 9.6

Presentation

(HTML + CSS)

Business Logic

(data structure, properties)

Integrated DynamicWeb Functionality

(Complex)

Browser

Internet

Server

Proc

JavaScript

Dynamic Server Page

Page 39: Web Development and Web Services with Uniface 9.6

• The webtrigger and weboperation Proc statements to define client-side triggers and operations, which are run on the client. In extended trigger or detail trigger.

• The javascript (and endjavascript ) Proc instructions to specify blocks of JavaScript code in client-side triggers and operations.

• The webactivate Proc statement, which can be used in the server to activate an operation on the client.

• Support for JavaScript in both the Development Environment and runtime environment, so that you can write JavaScript code using the Proc Editor and have it added to HTML pages generated by dynamic server pages.

• Support for customer JavaScript definitions of triggers and operation that can be added to DSPs without the need to define it using the Proc Editor.

webtrigger OnEditscope

input ; Data in this DSP is sent, but not expected to be returnedendscopejavascript

alert("onedit fired."); // Check whether OnEdit trigger is firedendjavascriptend

weboperation Alert scope

inputoutputoperation INST1.someOper

endscopejavascript ; part of Proc code so Proc comment can follow

Alert("THIS IS JAVASCRIPT CODING"); /* JavaScriptCode and so javaScript syntax */endjavascript ; end

Page 40: Web Development and Web Services with Uniface 9.6

Address and manipulate Uniface objects, data, and components to:

• implement a trigger or operation in JavaScript

• call a trigger or operation from JavaScript

• inspect and change a value, property, field syntax or valrep from JavaScript

• add occurrences or mark them for deletion

• create and delete instances of DSP components

• implement a new widget

Page 41: Web Development and Web Services with Uniface 9.6

API objects:

• Uniface —the starting point for the API. Using the functions provided on this object, you can obtain a uniface.DSPInstance object.

• uniface.DSPInstance —represents a DSP instance. It is the top-level object and can be used to obtain uniface.Entity objects representing the outer entities.

• uniface.Entity —represents a component entity in the DSP instance. It can be used to obtain uniface.Occurrence objects.

• uniface.Occurrence —represents an occurrence of a component entity. It can be used to obtain uniface.Field objects, as well as uniface.Entity objects that represent child entities of the occurrence.

• uniface.Field —represents a field in an occurrence.

Page 42: Web Development and Web Services with Uniface 9.6

Uniface

uniface.DSPInstance

uniface.Entity

uniface.Occurrence

uniface.Field

var dspInstance = uniface.getDSPInstance("MUSICORDER");if (dspInstance != null) {

var cartEnt = dspInstance.getEntity("CART.MUSICSHOP");if (cartEnt != null) {

// Get the CART occurrence (there should be only one).var cartOcc = cartEnt.getOccurrence(0);if (cartOcc != null) {

// Get the first item in the Cartvar itemEnt = cartOcc.getEntity("CART_ITEM.MUSICSHOP");if (itemEnt != null) {

var itemOcc = itemEnt.getOccurrence(0);if (itemOcc != null) {

var quantityFld = itemOcc.getField("AMOUNT.CART_ITEM.MUSICSHOP");if (quantityFld != null) {

var quantity = new Number(quantityFld.getValue());if (quantity > 5) {

quantityFld.setValue("5"); // Five suffices...quantityFld.setProperty("style:color", "red") ;

}}

}}

}}

}

Page 43: Web Development and Web Services with Uniface 9.6

Session management1. Client state is maintained by the web

browser. Relevant client state, such as data, is included in HTTP requests.

2. Session boundary (red line). Created by the first HTTP request, it usually remains for multiple HTTP requests.

3. Session state is held by WRD and is available to all HTTP requests in the session.

4. HTTP request boundary (blue line). Basic request and reponse. All state information is held in the DSP. Request state is empty.

5. HTTP request boundary (blue line). Request includes WRD callback requests that activate other DSP instances.

6. Request state is used to hold shared information. It is destroyed when the HTTP response is returned.

Page 44: Web Development and Web Services with Uniface 9.6

Manage your session

$webinfo ("REQUESTCONTEXT")

$webinfo ("SESSIONCOMMANDS"),

Page 45: Web Development and Web Services with Uniface 9.6
Page 46: Web Development and Web Services with Uniface 9.6
Page 47: Web Development and Web Services with Uniface 9.6

http://showcase.uniface.com/

Page 48: Web Development and Web Services with Uniface 9.6

Thanks

[email protected]