Title: PHP talking to SAP
1PHP talking to SAP
2PHP / Outline
- demo of leave request
- desktop integration via Atom iCalendar
- consuming web services in PHP
- feedback (technical, documentation, missing
functionality)
3demo
4PHP / consuming web services /iCalendar Atom
- Web interfaces are location independent,
lightweight etc. - But users prefer rich clients sometimes
- Better interface
- Integrate with other tools
- Aggregate data from many sources
- Support open iCalendar and Atom formats
- easy to produce and consume
- wide range of applications
- open standards (RFCs)
- Implementation read only, but not necessarily
(WebCAL, APP)
5PHP / consuming web services /the basic code
- No real type system
- Create SOAP client, dynamic methods on it added
- Everything done at run time, but cached
wsdl 'http//www.sap.com/.../ECC_EMPLEAVEREQBYI
DQR.wsdl' soapclient new SoapClient(wsdl) m
essage array ( 'EmployeeLeaveRequestSelectionBy
ID' gt array ( 'EmployeeLeaveRequestID' gt
ID ) ) response soapclient-gt EmployeeLeaveR
equestByIDQueryResponse_In(message)
6PHP / consuming web services /dynamic types
- PHP has a dynamic (or no?) type system
- Classes are constructed from WSDL/Schema on the
fly - Can supply user implemented classes
- Use hash maps/arrays to construct messages
- Consume result types directly, no declaration
- This is all the code necessary to query services
- minimal LOC, but no static type check
leaverequest response-gtEmployeeLeaveRequest e
cho leaverequest-gtLifeCycleStatusCode,
leaverequest-gtStartDate
7PHP / consuming web services /problems
- Automatic type conversion error proneis it a
number, a string, a bird? - Unstable language
- 5.1 ? 5.2 _toString semantics change, Datetime
class added - backwards incompatible changes, break code
- Object oriented system strange at best
- Field visibility not enforced
- Types sometimes case insensitive
8PHP / consuming web services /soap issues
- SOAP API added in PHP5
- Hash map syntax for messages? no support for
namespaces in messages - Serialization into XML overly liberal
- fails to detect many bugs
- easy to send non-WSDL-conforming messages
- Fehler bei der Konvertierung XML gt ABAP (
FehlerId ( ) )
message array ( 'EmployeeLeaveRequestSelection
ByID' gt array ( 'EmployeeLeaveRequestID' gt
ID ) )
9PHP / consuming web services /soap issues
- Arrays weird - if its only one element, its not
an array? need special case code everywhere - Difficult to manage types in non typed system
- EmployeeLeaveRequest type different in services
- PHP has no way to handle this
- Create messages as hashmaps for each request
elr res-gtEmployeeLeaveRequest if
(is_array(elr)) elr array (elr)
10conclusion
- PHP
- small server footprint
- low complexity (2000 LOC, zipped 60KB)
- quick development cycle
- bad programming language
- rather go for Ruby / Python
- Services
- see other feedback
- last modified for service would be nice