Title: PWB523 Pocket PB, PocketSOAP
1PWB523 Pocket PB, PocketSOAP Web Services
Ian ThainTechnical Evangelistian.thain_at_sybase.co
mAugust 2003
2Introduction Ian Thain
- Technical Evangelist / Software Engineer in the
Infrastructure Platform Group of Sybase, Inc - Involved with the design, production and testing
of Enterprise class e-Business Solutions, that
have been implemented using Sybases e-Business
Platform for Sybase customers around the globe. - In addition, continually working with Sybases
key partners and clients to enhance the
capabilities of the e-business solutions that
Sybase can offer to its customers. - EAServer, EP, PowerBuilder, Pocket PowerBuilder,
PowerJ OEM products
3Agenda
- PPB Overview
- Problem to address
- Technologies 101
- What is Sybase doing ?
- Solution
- Demonstration
- Futures
- Q A
4Pocket PowerBuilder Overview
- "Don't think bigThink Small!!"
- PowerBuilder is now coming to aid corporate
development of Pocket PC applications, brining
all the benefits I have mentioned above - RAD 4
GL and even the DataWindow technology. - So we really can now say, DataWindows
EVERYWHERE!!!!
5How does it differ from PowerBuilder?
- Unsupported Functions
- OLE
- DDE
- CORBA
- Profiling
- Printing
- Rich Text and a few more
- Unsupported Events
- help()
- closequery()
- anything to do with remote (example
remoteexec()), hotlinkalarm() and toolbarmoved().
6How does it differ from PowerBuilder?
- Unsupported Features
- MDI applications,
- EAServer connections,
- Web and JSP targets,
- and Automation server.
NO PFC !
7Problem to address
- Components
- So you may have diverse components in your
enterprise and need to access them - Some of these components may access other data
and or perform complex processing - Application Client
- Pocket PowerBuilder v1.0
Unlike PowerBuilder v9.0, Pocket PowerBuilder
v1.0 does not have Initial Context Object or EJB
Client
8Solution
- Components
- So you may have diverse components in your
enterprise and need to access them - Some of these components may access other data
and or perform complex processing - Application Client
- Pocket PowerBuilder v1.0
Web Services SOAP
9Technologies 101
- What are Web services ?
- Made up of standards that describe business
processes - Self describing
- Searchable in a registry of services
- Sync or Async
- Loosely coupled and cross platform
- Reusable
10Technologies 101
- Web services benefits
- RAD
- Neutral
- Architecture language
- Leverage current investment
- Accessed through many different client types
11Technologies 101
High Level Architecture
Client
- Provider creates and publishes service
- A client searches a registry for that service
- The client is able to connect and call the service
12Technologies 101
- Protocols involved Web Services Stack
- WSFL
- UDDI
- WSDL
- SOAP
- XML
- TCP/IP, HTTP etc
Emerging Layers
Core Layers
13Technologies 101
- TCP/IP, HTTP
- Common Internet Transport Protocols
- Web services not tied to any one protocol
14Technologies 101
- XML
- Extensible Markup Language
- Widely accepted format to exchange data
semantics - Core building block for every layer in the Web
services stack
15Technologies 101
- SOAP
- Simple Object Access Protocol,
- Represents a
- light-weight,
- wire-level protocol
- for messaging RPC communications
- Based on XML
16Technologies 101
- SOAP Message
- Envelope comprised of
- Header
- Body
- Body comprised of
- Requests
- Responses
- Status
- Attachments
Envelope
Header
Body
Requests
Response
Status
Attachments
17Technologies 101
- WSDL
- Web Services Definition Language
- Based on XML
- Defines
- Functionality of a Web service
- Supported protocols
- Message formats
- Location of Web service
18Technologies 101
- WSDL Document
- Comprised of
- Data types
- Message/method
- Port
- Binding
- Service
Document
Data Types
Message
Interface
Port
Binding
Implementation
Service
19Technologies 101
- UDDI
- Universal Description, Discovery and Integration
- SOAP-based Web service
- Allows
- Providers to register services
- Clients to lookup services
- Uses WSDL to describe services
20Technologies 101
Client
UDDI
Provider
Lookup
Register
Service
21What is Sybase doing ?
- EAServer 4.x includes the Web Services Toolkit
- WST is a utility that allows users to take their
existing business components and make them
available as a Web services. - The Web Services Toolkit provides support for the
latest standards SOAP, WSDL and UDDI. - FYI
- EAServer 5.0 AXIS Implementation
- UDDI Server
22Web Services Toolkit
- The Toolkit provides a full SOAP engine,
supporting SOAP request/response. - In addition, the toolkit offers a utility that
can be run against a component in EAServer, to
determine its soapability. - The utility scans the component, chooses any
methods that meet the soap criteria (all in/out
parameters are supported by the SOAP standard) - Only Synchronous Components i.e. not MDBs
- WST Generates the WSDL document that describes
that method. - Bottom up approach - Once the WSDL is generated, it can be posted to a
UDDI repository, making the Web service publicly
available.
23Web Services Toolkit
EAS
Components
Client
Application
WEB
WEB
Client Proxy
SOAP
Component
WSDL
Listener
X
WS
UDDI HOST
Manager
Gen WSDL, Proxy
WS
Register User
-
Defined Types
GUI
24Solution
- Components
- So you may have diverse components in your
enterprise and need to access them - Some of these components may access other data
and or perform complex processing - Application Client
- Pocket PowerBuilder v1.0
Web Services SOAP
PocketSOAP
25Mobile Wireless
- Pocket PowerBuilder is the ideal tool to produce
application that can mobilize your field workers.
- Capture data electronically at source, minimizing
data capture improve the quality of your data. - Data can then be synchronized back to Enterprise
systems with minimal impact, improving turn
around time and increasing the effectiveness of
the field workers. - With newer PocketPC devices this synchronization
can be via dialup or wireless connection. - HP's iPAQ 5450, which has integrated Bluetooth
and WiFi 802.11b - Toshiba's e740, which has integrated WiFi
802.11b. - Both can be used within the range of a Wireless
Access Point and the iPAQ 5450 can use Bluetooth
to connect to cell phones for dialup connection
or via GPRS.
26PocketSOAP
- Open Source SOAP client Component Object Model
(COM) component. - Distributed under the Mozila Public License
(MPL). - Developed by Simon Fell
- Originally targeted for the PocketPC
- now developed for PocketPC and Windows 95, 98,
Me, NT4.0 and 2000. - smaller footprint, the total footprint including
the support library (expat xml parser and zlib)
weights in at 680k. - PocketSOAP also uses a sax style parser for perf
memory load reasons, whilst other toolkits
still use an intermediate DOM representation.
27PocketSOAP
- Includes the following features SOAP Section 5
encoding support, support for document/literal
style SOAP services (such as ASP.NET),
attachments support via both DIME and SOAP with
Attachments, Support for SOAP, HTTP 1.1 support
including persistent connections, SSL, proxies,
authentication, proxy authentication, redirects,
cookies and compression.
28PocketSOAP
- Can make remote procedure calls to SOAP servers
implemented with - 4s4c
- ROPE
- Apache SOAP
- SOAPLite
- DM's SOAP/Perl
- XMethods SOAP Server
- The package includes a Hypertext Transfer
Protocol (HTTP) client for making HTTP based SOAP
requests, but other transports can be added. - There are more features information that can be
viewed at http//www.pocketsoap.com
29Pocket PowerBuilder v1.0 PocketSOAP
- Pocket PowerBuilder PocketSOAP interact through
an Interface / external DLL wrapper, which
provides a simple access to the PocketSOAP
package, via its COM Interface. - Pocket PowerBuilder does not have a COM object,
aka OleObject at the moment! - This wrapper will still exist and work when the
OleObject does appear in the next version of
Pocket PowerBuilder, but the recommended way to
use PocketSOAP will be via the OleObject. - So eventually code will have to be changed, as we
will be programming directly to the PocketSOAP
interface rather than the wrapper. - Until then, lets enjoy using the wrapper and find
out what we need to do.
30Pocket PowerBuilder v1.0 PocketSOAP
- Model for the API
- First the service object is created and that
returns the access handle. - Then you can set the various attributes in
whatever order you desire. - Internally, the attributes are simply stored for
later use. Then you make the SOAP call. - This uses the previously set attributes.
- Finally, you destroy the service object, which
cuts away all the previously created COM objects.
-
31Pocket PowerBuilder v1.0 PocketSOAP
- All this is built on top of the PocketSOAP
system. - So to run with PocketSOAP, retrieve the installs
from http//www.pocketsoap.com - Install them on both the desktop and Pocket PC
device. - These installs contain the API documentation,
which will be useful in the future, when we will
code directly to the PocketSOAP COM object, via
the OleObject
32Pocket PowerBuilder v1.0 PocketSOAP
- The PocketSOAP wrapper can be found on the
CodeXchange website, http//pocketpb.codexchange.s
ybase.com with other examples etc
33Pocket PowerBuilder v1.0 PocketSOAP
- The wrapper functions can be made accessible from
Pocket PowerBuilder as a global external
function. - In the "Application object
- select "(Declare)"
- and the "Global External Functions".
34Pocket PowerBuilder v1.0 PocketSOAP
- // External Functions all in library
"PKSoapif.DLL" - FUNCTION integer PocketSoap_Create( boolean
fInProc, REF long lHandle ) library
"PKSoapif.dll" - FUNCTION integer PocketSoap_Destroy( long lHandle
) library "PKSoapif.dll" - FUNCTION integer PocketSoap_SetProxy( long
lHandle, readonly string pszProxyServer, long
iProxyPort ) library "PKSoapif.dll" - FUNCTION integer PocketSoap_SetProxyAuthentication
( long lHandle, readonly string pszUsername,
readonly string pszPassword ) library
"PKSoapif.dll" - FUNCTION integer PocketSoap_SetAuthentication(
long lHandle, readonly string pszUsername,
readonly string pszPassword ) library
"PKSoapif.dll" - FUNCTION integer PocketSoap_SetMaxRedirects( long
lHandle, long cRedirects ) library
"PKSoapif.dll" - FUNCTION integer PocketSoap_SetTimeout( long
lHandle, long cSeconds ) library "PKSoapif.dll" - FUNCTION integer PocketSoap_SetEndPoint( long
lHandle, readonly string pszEndPointURL )
library "PKSoapif.dll" - FUNCTION integer PocketSoap_GetHTTPStatus( long
lHandle, REF long lStatus ) library
"PKSoapif.dll" - // Actually make the SOAP call
- FUNCTION integer PocketSoap_SimpleCall( long
lHandle, - readonly string pszNameSpaceURI,
- readonly string pszMethodName,
- readonly string pszArgName,
- readonly string pszArgValue ) library
"PKSoapif.dll"
35Pocket PowerBuilder v1.0 PocketSOAP
- PocketSoap_Create
- Create a PocketSoap interface object and lay the
groundwork for future use. - This must be matched with the "PocketSoap_Destroy"
. - PocketSoap_Destroy
- Close this connection and destroy all internal
references. - PocketSoap_GetHTTPStatus
- Ask the transport layer what the last HTTP status
was. Will return a value like 200 or 404 or ... - PocketSoap_SetProxy
- This enables the use of a proxy server for
outgoing HTTP(S) connections.
36Pocket PowerBuilder v1.0 PocketSOAP
- PocketSoap_SetProxyAuthentication
- Sets the username/password for BASIC
authentication to the Proxy server. - PocketSoap_SetAuthentication
- Sets the username/password for BASIC
authentication to the EndPoint server. - PocketSoap_SetMaxRedirects
- Sets the maximum number of redirects the HTTP
transport will follow for a single request. - PocketSoap_SetTimeout
- Sets the timeout (in seconds) for a single
request.
37Pocket PowerBuilder v1.0 PocketSOAP
- PocketSoap_SetEncodingStyle
- Sets the "Encoding Style" used in the SOAP
message. - PocketSoap_SetParameterNameSpace
- Sets the NameSpace for the parameters (arguments)
used in the SOAP message. - PocketSoap_SetEndPoint
- The endpoint URL, e.g. http//services.xmethods.ne
t/soap - PocketSoap_SimpleCall
- Execute a synchronous call to the previously
specified EndPoint URL. - This version takes a single parameter and returns
a single value. -
38Pocket PowerBuilder v1.0 PocketSOAP
- PocketSoap_Call
- Execute a synchronous call to the previously
specified EndPoint URL. This general call is for
an argument list with arbitrary number of
name/value pairs. - PocketSoap_GetResult
- Retrieve the single result (or the first if many)
from the previous call. - PocketSoap_GetResults
- Retrieve the (possibly multiple) results from the
previous call into a DataWindow friendly string. - PocketSoap_SetSoapAction
- Sets the SoapAction used in the SOAP message.
39Pocket PowerBuilder v1.0 PocketSOAP
- The 3 important things we need to set are the
- EndPoint,
- Namespace
- Method.
- The EndPoint indicates a specific location for
accessing a service using a specific protocol and
data format. - The Namespace indicates the specific Web Service
- The method is that method which we want to call
within that Web Service. - For example we can use the method
PocketSoap_SimpleCall which executes a
synchronous call to the EndPoint URL with a
single argument. - This argument is a name/value pair and is
optional.
40Pocket PowerBuilder v1.0 PocketSOAP
Method
- string sMethod "getPFShareList"
- string sEndPoint "http//localhost10000/WEB
SERVICES/SOAP" - string sNameSpace "PFShareListAll/PFShareList"
- String sSoapAction "PFShareListAll/PFShareList.
getPFShareList return,java.lang.String,return" - int cRetBufLen 128
- string sArgs
- string sResult
- long lHandle
- int iRet
- // create set attributes on for the soap call
- iRet PocketSoap_Create( true, REF lHandle )
- wf_message( iRet, "PocketSoap_Create")
- iRet PocketSoap_SetEndPoint( lHandle, sEndPoint
) - wf_message( iRet, "PocketSoap_SetEndPoint")
- iRet PocketSoap_SetSoapAction( lHandle,
sSoapAction ) - wf_message( iRet, "PocketSoap_SetSoapAction")
Endpoint
NameSpace
1
2
3
4
5
6
41Pocket PowerBuilder v1.0 PocketSOAP
- For a more complex call there is another method
called PocketSoap_Call, which takes arguments as
name/value pairs, but represented as a single
DataWindow friendly string. - Name1 t value1 t data-type1 rn
- Name2 t value2 t data-type2 rn
- Name3 t value1 t data-type1 rn
- Etc
-
- PocketSOAP will take care of generating the SOAP
message parsing the response.
42Pocket PowerBuilder v1.0 PocketSOAP
- The SOAP call and the response from the server
can be viewed by using the SOAP Util tool from
Apache (http//www.apache.org) This is started by
using the command line -
- java org.apache.soap.util.net.TcpTunnelGui 10000
ithain-home 8080 -
- This allows the tool to intercept all requests
that are made to localhost10000, display them
then reroute them to ithain-home8080. - Like wise the tool intercepts the response from
ithain-home8080, display them
and reroute them back to the caller.
43Pocket PowerBuilder v1.0 PocketSOAP
44Pocket PowerBuilder v1.0 PocketSOAP
- For EAServer 4.x we need to set the SoapAction
attribute. - This is due to that fact that in EAServer 4.x we
are using the SoapAction attribute, within our
proprietary implementation of Web Services,
though this is compatible with other
implementations such as Apache. - That being said other implementations also
require SoapAction. -
-
45Demonstrations
- Pocket PowerBuilder calling a Web Service on
EAServer via PocketSOAP. Web Service is an EJB - Pocket PowerBuilder calling a Web Service from
XMethods via PocketSOAP -
-
-
46Demonstration 1
47Demonstration 1
- public String getPFShareList() throws
javax.ejb.EJBException -
- String ShareList .
- try
- javax.naming.Context ctx new
javax.naming.InitialContext() - javax.sql.DataSource ds (javax.sql.DataSource)
ctx.lookup("javacomp/env/jdbc/Portfolio") - con ds.getConnection()
- stmt con.createStatement()
- rs stmt.executeQuery("SELECT FROM
DBA.SYMBOL SYMBOL ORDER BY symbol_cd") - while (rs.next())
- ShareListrow rs.getString("symbol_cd")
"," - ShareListrow rs.getString("symbol_ln")
"," - ShareListrow rs.getString("symbol_current_
price") - row 1
-
- catch (Exception e)
- System.out.println("getPFShareList Exception"
e.toString()) - finally
- try
48Demonstration 1
49Demonstration 1
EAS
Components
PPB
Application
WEB
WEB
PocketSOAP
SOAP
Component
WSDL
Listener
X
WS
UDDI HOST
Manager
Gen WSDL, Proxy
WS
Register User
-
Defined Types
GUI
50Demonstration 2
- Against a Web Service on XMethods
- Shows use of more complex data type
-
-
-
string sMethod "BabelFish" string sEndPoint
"http//services.xmethods.net80/perl/soaplite.c
gi" string sNameSpace "urnxmethodsBabelFish" st
ring sResult int cRetBufLen 2048 long
lHandle int iRet string sArgs //en_fr,
en_es, en_de, en_it sArgs "translationmodet"
ddlb_language.text sArgs "rnsourcedatat"
sle_xlat_src.text iRet PocketSoap_Create(
true, REF lHandle ) iRet PocketSoap_SetEndPoint
( lHandle, sEndPoint ) iRet PocketSoap_Call(
lHandle, sNameSpace, sMethod, sArgs ) sResult
Space( cRetBufLen ) iRet PocketSoap_GetResult(
lHandle, cRetBufLen, REF sResult) mle_xlat.text
mle_xlat.text "rn---------" "Result "
sResult iRet PocketSoap_Destroy( lHandle )
51Futures
- EAServer 5.0
- No need to loose sleep with regard to the current
usage of SOAPAction in EASevrer 4.x, as within
the next version of EAServer, EAServer 5.0 the
implementation of Web Services will be Axis and
then we need not set the SoapAction at all. - FYI, within EAServer 5.0 components can be
exposed as Web Services in a slightly different
way. Firstly by a command line tool called
wstool. - wstool exposeComponent PFShareListAll/PFShareLis
t - Or secondly via an Eclipse based plugin. Either
way will expose that component as a Web Service.
The only difference to the code example above
will be that the namespace changes to
PFShareListAll_PFShareList and the endpoint to
http//localhost10000/ws/services.
52Futures
- Pocket PowerBuilder
- OLE Object for interaction with COM
- wrapper will be unnecessary
- calling code will change
OLEObject soap, t Long ll_status String
ls_retVal String ls_url ls_url
http//localhost8080/.. Soap CREATE
OLEObject T CREATE OLEObject ll_status
soap.ConnectToNewObject(PocketSOAP.Envelop.2) ll
_status t.ConnectToNewObject(PocketSOAP.HTTPTra
nsport.2) Soap.EncodingStyle
Soap.methodName subtract Soap.Parameters.C
reate(a1, 6) Soap.Parameters.Create(21,
10) t.Send(ls_url, soap.serialize) Soap.parse(t)
ls_retVal String(soap.Parameters.Item(0).Value)
DESTROY soap DESTROY t
53Futures
- Pocket PowerBuilder - TBD
- Remote Debugging
- Native Support for INK, Voice, Today, Mail, etc
- More Native Database Drivers and Object Store
- PBNI
- PB9 DataWindow and EditMask
- Native Support for Web Services
- Smart Phone Support
- Native Support for Microsoft Compact Framework
54Futures
Pocket PowerBuilder vx.x
Pocket PowerBuilder vx.x
Pocket PowerBuilder v1.0
Q104
Q403
Q204
Q303
55Conclusion
- Over the last few years we have been telling you
to partition your applications and take advantage
of your favorite Application Server (EAServer) - You will probably want to reuse that code.
- Pocket PowerBuilder is another reason to do this
PDA different to Client/Server. - The PDA occasionally connected model using Web
Services is just like calling NVOs . But taken
to the extreme !
56Conclusion
- PocketSOAP can be used and is accessible via a
Pocket PowerBuilder interface. - This allows Pocket PowerBuilder to call Web
Services, enabling the reuse of components, such
on EAServer. - So connect to your App Server send the minimum
amount of data via a PocketSOAP, let the App
Server do all that hard stuff and send the result
back
57Q A
- ian.thain_at_sybase.com
- Technical Evangelist / Software Engineer
- Check out PBDJ for Pocket PowerBuilder articles