Presentation is loading. Please wait.

Presentation is loading. Please wait.

Practical Uses for Web Services in Application Express

Similar presentations

Presentation on theme: "Practical Uses for Web Services in Application Express"— Presentation transcript:

1 Practical Uses for Web Services in Application Express
Web services have been around since the last millennium, but what can you actually do with them? Is there any practical reason to consume web services in an Application Express application? In the past, the predominant Web service standard was SOAP. While it is still widely used, it is not simple. Requests and response are XML wrapped in SOAP Envelopes, whose structure is defined by one of the very large specifications either 1.1 or 1.2. Nowadays, RESTful Web services are all the rage. All the major players on the Web, Google, Amazon, Yahoo, Netflix, etc. have RESTful API’s. RESTful Web services are much simpler, and hopefully through the course of this presentation, you will see why. Also, hopefully you will see why Application Express has many cool features that allow it to be great platform for RESTful Web service clients.

2 The following is intended to outline our general product direction
The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remain at the sole discretion of Oracle.

3 <Insert Picture Here>
Agenda <Insert Picture Here> Web services introduction Web service support in Application Express Amazon S3 APEX_WEB_SERVICE API Web Service Tools and Debugging Additional resources Q & A

4 <Insert Picture Here>
Web Services Definition “Web services are typically application programming interfaces (API) or web APIs that are accessed via Hypertext Transfer Protocol and executed on a remote system hosting the requested services. Web services tend to fall into one of two camps: Big Web Services and RESTful Web Services.”

5 SOAP Web Services

6 RESTful Style Web Services

7 RESTful Style Web Services
REpresentational State Transfer RESTful Web service request HTTP Method (GET, PUT, POST, DELETE, HEAD) indicates method of the service HTTP URI (path) indicates the resource HTTP headers HTTP entity-body (parameter name/value pairs) RESTful Web service response XML Text JSON A RESTful Web service request defines the method it is invoking by the HTTP Method (sometimes called HTTP Verb). If you do a GET, it means you are requesting something from the service. If you do a PUT, or POST, you are creating or modifying something on the service. I am sure you can guess what DELETE does. HEAD just means give me the meta data of the particular resource. The request is also composed of a URI, optionally HTTP Headers, and a body, which could simply be a binary payload, base64 encoded payload (common in content Web services), or could be a list of parameter name and value pairs. The response from a RESTful service is Text (sometimes comma separated), XML, or JSON. Many services allow the requester to specify how they want the response. -Came from Roy Fieldings 2000 Ph.D. dissertation -REST is resource oriented, as opposed to object, or RPC

8 RESTful Support Application Express 4.x
Expose report regions as RESTful Web service Wizard to create RESTful Web reference NEW in 4.1: Testing interface while creating the reference Test/Edit RESTful Web reference Wizard to create form on RESTful Web reference Wizard to create form and report on RESTful Web reference NEW in 4.2: Support for JSON responses Since 4.0, you have been able to interact with RESTful style web services. Once you define a reference to the service, you can create a form on the request and response, or a form and a report on the response. In 4.2, there is some type of support for JSON feeds that are returned from some services.

9 Amazon Simple Storage Service (S3)
Storage for the Internet Designed to provide % durability and 99.99% availability Designed to sustain the concurrent loss of data in two facilites Write, read, delete objects from 1 byte to 5 terabytes Objects are stored in “buckets” – a container for objects Common use cases: Content storage and distribution Backup or disaster recovery

10 Amazon S3 – Technical Details
Create an AWS account, Sign up for an S3 account, Authentication Authorization HTTP header AWS AWSAccessKeyId:Signature Signature is HMAC-SHA1 of selected elements from the request, AWS Secret Key is used for the key Uses REST or SOAP interfaces

11 Amazon S3 – Technical Details
Endpoint: http(s):// Common HTTP Headers for all interactions Host: <bucket_name> Date: Convert to GMT, and then use format Dy, DD Mon YYYY HH24:MI:SS GMT Authorization: AWS <AWSAccessKeyId>:<Signature>

12 Amazon S3 – Technical Details – Common Operations
List All Buckets Create Bucket Delete Bucket List Bucket Contents Get Object Add Object Delete Object

13 Contains function to parse response based on an XPath expression
apex_web_service API Allows you to interact with Web services (SOAP, REST, RPC) in Application Express anywhere you can write PL/SQL Includes functions to encode/decode binary data to/from base64 encoding Contains function to parse response based on an XPath expression Globals to retrieve/set HTTP Headers and cookies Use the APEX_WEB_SERVICE API to invoke a Web service and examine the response anywhere you can utilize PL/SQL in Application Express. The following are examples of when you might use the APEX_WEB_SERVICE API: When you want to invoke a Web service via an On Demand Process using AJAX. When you want to invoke a Web service as part of an Authentication Scheme. When you need to pass a large binary parameter to a Web service that is base64 encoded. When you want to invoke a Web service as part of a validation.

APEX_WEB_SERVICE.MAKE_REST_REQUEST( p_url IN VARCHAR2, p_http_method IN VARCHAR2, p_username IN VARCHAR2 default null, p_password IN VARCHAR2 default null, p_proxy_override IN VARCHAR2 default null, p_body IN CLOB default empty_clob(), p_body_blob IN BLOB default empty_blob(), p_parm_name IN WWV_FLOW_GLOBAL.VC_ARR2 default empty_vc_arr, p_parm_value IN WWV_FLOW_GLOBAL.VC_ARR2 default empty_vc_arr, p_wallet_path IN VARCHAR2 default null, p_wallet_pwd IN VARCHAR2 default null ) RETURN CLOB; Although this slide is ugly, it does present some useful information, and is especially relevant to our next demo. It shows the make_rest_request function of the apex_web_service API. Only the URL, HTTP Method is required. The inputs to the Web service you invoke could be a CLOB or BLOB payload (again, useful for content API’s, like Amazon’s S3) or a table of parameter names and parameter values.

15 Netflix API JavaScript, REST, Atom feeds
search content manage subscriber queue display subscriber’s ratings auto-complete Response is POX (plain old XML) Register for key and secret OAuth for authentication dealing with subscriber information Most requests are signed (much like Amazon s3)

16 Web Service Tools and Debugging
Web Service Reference testing interface Altova XMLSpy Good for inspecting response Has utility to give you XPath to response nodes ProxyTrace, Allows you to inspect the exact HTTP traffic (including headers) for a web service request/response Set proxy of your client to go through ProxyTrace to inspect the traffic

17 Application Express on OTN:
Additional Resources Application Express on OTN: Application Express Web Service Integration Page: Application Express 4.0 Web Services Evaluation Guide Web Service Integration Sample Applications Web Service Integration Whitepapers Blog:



Download ppt "Practical Uses for Web Services in Application Express"

Similar presentations

Ads by Google