Zend Framework functionality and web application methodology
ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web...
Transcript of ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web...
![Page 1: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/1.jpg)
© All rights reserved. Zend Technologies, Inc.
Mike Pavlak Solutions Consultant [email protected]
Function Junction
ReSTful Web Service with PHP on IBM i
![Page 2: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/2.jpg)
© All rights reserved. Zend Technologies, Inc.
Agenda
• Discuss web services in general
• DB2 access
• Product Availability RPG Program
• Q&A
| 2 02/04/10
![Page 3: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/3.jpg)
© All rights reserved. Zend Technologies, Inc.
What’s New with Zend Server
![Page 4: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/4.jpg)
© All rights reserved. Zend Technologies, Inc.
IBM Relationship History Zend is an IBM strategic business partner
IBM selected Zend to bring PHP to IBM i in 2005
Beta, then Core, then Platform now Server
Thousands of downloads from Zend.com
Zend Server part of IBM i6.1 & i7.1 (distribution media)
Products are always available at Zend.com
4 Insert->Header & Footer
![Page 5: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/5.jpg)
© All rights reserved. Zend Technologies, Inc.
IBM Relationship FAQ’s What do we get?
Zend Server Basic (Formerly Community Edition)
Zend Studio (Licensed for IBM only!)
1 year web support and updates (email/web 72 hour response)
Phone support & improved SLA available from Zend at a charge
What happens after 1 year?
Products will still run as perpetual license
No updates to studio, server at Zend discretion
Forum support only
Support available for purchase from Zend
5 Insert->Header & Footer
![Page 6: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/6.jpg)
© All rights reserved. Zend Technologies, Inc.
What Is Zend Server? Production quality PHP stack
PHP, ZF2, DB connectivity, debugging extensions, and much more
Three Editions with Zend Server 6
Basic Edition – Included with IBM SWMA,
Enjoy Professional & Enterprise features for 7 days, upgrade to 28
Application monitoring and diagnostics (integrated with Zend Studio)
Multi-level performance enhancement capabilities
Easy and quick installation w/Software updates and security hot fixes
6 What is Zend Server
![Page 7: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/7.jpg)
© All rights reserved. Zend Technologies, Inc. 7
Zend Server
Zend Server Under the Covers
HTTP:10080 Server
(FastCGI)
IBM i
i/OS
DB2 UDB
PHP file PASE
*PGM
CMD
ILE Apache:10080 • Default
configuration FastCGI
URL Request
HTML
MySQL, Oracle, MS SQL Server
PHP CGI
![Page 8: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/8.jpg)
© All rights reserved. Zend Technologies, Inc.
Z-Ray (Firebug for PHP!) Brings productivity features to every web page
Events, SQL requests, PHP log messages, more…
8 Code Tracing
![Page 9: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/9.jpg)
© All rights reserved. Zend Technologies, Inc.
Zend Server 7 additional features
Updated PHP stack for PHP 5.4.29 & 5.5.13
PHP 5.3 is gone, Zend Server 6.3 is LTS
Toolkit included as library
Double upgrade PTF in one step!
Upgrade Zend Server
Upgrade PHP
9 Insert->Header & Footer
![Page 10: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/10.jpg)
© All rights reserved. Zend Technologies, Inc.
What’s up with Web Services
![Page 11: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/11.jpg)
© All rights reserved. Zend Technologies, Inc.
Introduction to Web Services
• Tightly coupled
Mine, mine, mine…I own it all! mwa-ha-ha-ha-ha
API program calls
Stored procedures and ODBC
• Loosely coupled
We don’t own all of our business logic
Web Services
Mash-ups
![Page 12: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/12.jpg)
© All rights reserved. Zend Technologies, Inc.
Direct Program Call
Program A
Order Entry
Program B
Pricing
Advantages Compiled code Stable, predictable & efficient Changes required on both sides ensure security Disadvantages Changes require recompile Test, test, test Intersystem calls cumbersome
Product, Customer, Quantity returns Price
![Page 13: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/13.jpg)
© All rights reserved. Zend Technologies, Inc.
Usher in the new age of computing!
• Books that are the basis for my position
The Cathedral & the Bazaar by Eric Raymond
• Open Source is OK!
• Dynamic is in, Monolithic is out
• But there is room for both…for a while
Small Pieces Loosely Joined by David Weinberger
• Modular is better!
• Many small pieces around the Internet
• Scattered amongst the cloud!
| 13 Name of this section | Feb
![Page 14: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/14.jpg)
© All rights reserved. Zend Technologies, Inc.
What is a Web Service?
• W3C says...
A software system designed to support interoperable machine to machine interaction over a network.
• Key words
Software system
Interoperable
Machine to machine
Network
• It’s really just another way to call programs!
![Page 15: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/15.jpg)
© All rights reserved. Zend Technologies, Inc.
Who uses Web Services? • Web presence today
Google Maps, Spell checkers, etc.
Amazon.com Product availability, Order processing
Salesforce.com Application Integration
TerraServer Cloud based applications
Many, many more
• API layer replacement tomorrow
Inter-program communication
Inter-system communication
![Page 16: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/16.jpg)
© All rights reserved. Zend Technologies, Inc.
Why use Web Services? • SOA Layer
Fancy term for modern program calls!
Parts are self defining and self documenting
Code is modular from the start
Facilitate the upgrade process
| 16 Name of this section | Feb
Program A
Program B
Yesterday’s program call Today’s program call
Program A
Program B
Program call
![Page 17: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/17.jpg)
© All rights reserved. Zend Technologies, Inc.
What types
SOAP
Simple Object Access Protocol
Self defining
Can be highly complex
ReST
Representational State Transfer
Much like API call
Requires external documentation
![Page 18: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/18.jpg)
© All rights reserved. Zend Technologies, Inc.
Data Access using ReST
![Page 19: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/19.jpg)
© All rights reserved. Zend Technologies, Inc.
One example for two methods Part 1
Form with drop down info populated by web service
Select product and then move to part two
No data on local IBM i
Part 2
Take selected item and call web service
Remote web service calls RPG program
RPG program develops on hand quantity & returns
Again, no data on local IBM i
![Page 20: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/20.jpg)
© All rights reserved. Zend Technologies, Inc.
Two system setup
Local & remote both IBM i for this example
Local system can be ANY platform running PHP
Remote system can also be any platform
In this example is IBM i
But must have access to Inventory data
Inventory availability is in RPG business logic
Simple example, can be VERY complex!
![Page 21: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/21.jpg)
© All rights reserved. Zend Technologies, Inc.
HTML Form using PHP
![Page 22: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/22.jpg)
© All rights reserved. Zend Technologies, Inc.
Form source
![Page 23: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/23.jpg)
© All rights reserved. Zend Technologies, Inc.
WSCommon.php
Common routines and standard locations
Here I store the location of my services
Easy to adjust and I can scan for common services
I’m using hardcoded IPs, but recommend DNS
![Page 24: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/24.jpg)
© All rights reserved. Zend Technologies, Inc.
Target LPAR and host service, part 1
![Page 25: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/25.jpg)
© All rights reserved. Zend Technologies, Inc.
Server Utils Part 1
![Page 26: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/26.jpg)
© All rights reserved. Zend Technologies, Inc.
Call RPG using ReST
![Page 27: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/27.jpg)
© All rights reserved. Zend Technologies, Inc.
Remote service calls RPG
Review
Created form to display products
Products available listed on remote system
Have product ID
Now look up remote system for availability
![Page 28: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/28.jpg)
© All rights reserved. Zend Technologies, Inc.
Select product from form
![Page 29: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/29.jpg)
© All rights reserved. Zend Technologies, Inc.
Form source
![Page 30: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/30.jpg)
© All rights reserved. Zend Technologies, Inc.
Now call WSClient2.php
![Page 31: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/31.jpg)
© All rights reserved. Zend Technologies, Inc.
Target LPAR and host service, part 2
![Page 32: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/32.jpg)
© All rights reserved. Zend Technologies, Inc.
RPG code
![Page 33: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/33.jpg)
© All rights reserved. Zend Technologies, Inc.
WSClient2.php recieves info and presents
![Page 34: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/34.jpg)
© All rights reserved. Zend Technologies, Inc.
Final output
Not pretty, but would be used in finished application
Shows on hand quantity for product selected
![Page 35: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/35.jpg)
© All rights reserved. Zend Technologies, Inc.
Feature article at iProDeveloper With your subscription
Can read article and download code
![Page 36: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/36.jpg)
© All rights reserved. Zend Technologies, Inc.
Wrap it up!
![Page 37: ReSTful Web Service with PHP on IBM i - OCEAN User Group · Zend Technologies, Inc. What is a Web Service? ... Form with drop down info populated by web service . Select product and](https://reader034.fdocuments.in/reader034/viewer/2022042203/5ea4c234e99573137c6d14e7/html5/thumbnails/37.jpg)
© All rights reserved. Zend Technologies, Inc. 37 Insert->Header & Footer
Q&A
www.zend.com