| By Reed Shilts | Article Rating: |
|
| April 16, 2008 08:45 AM EDT | Reads: |
7,548 |
Still in iSQL, running this second stored procedure will display six rows of data, three columns each. As you'd expect, the WITH statement mapped the XML nodes into columns with the names I wanted.
call GetUPSRateWrapperUS( 'SHP-M89872906F', '60506', '01776', '10.5' )
MailCode Rate Service
GND 9.63 UPS Ground
3DS 22.22 UPS 3 Day Select
2DA 32.88 UPS 2nd Day Air
1DP 71.34 UPS Next Day Air Saver
1DA 78.51 UPS Next Day Air (by 10:30AM)
1DM 112.28 UPS Next Day Air Early A.M. (by 8:00AM)
Looking through the stored procedures you can see that the database still has not affected any tables. We just have a couple of stored procedures doing all the work. The SQL Anywhere database engine is doing all the work with no other tables to select into or do anything with. (I think this is pretty cool)
The next step is to enhance the stored procedure to retrieve the shipping rate and stuff it into a PocketBuilder application.
The PocketBuilder DataWindow
Creating a DataWindow
using the stored procedure, GetUPSRateWrapperUS, as the data source is
simple. However, I'm told that using a stored procedure is one of those
"less used features" in PocketBuilder (and PowerBuilder) so I'll
briefly outline the necessary steps:
a. Set the database profile to use the same ODBC profile as iSQL used.
b. In the PocketBuilder IDE, select File New DataWindow Grid
c. Select the "Stored Procedure" data source and "Retrieve on Preview"
d. Select the specific "getupsratewrapperus" stored procedure.
e. Select the defaults for the rest of the wizard.
f. The preview will need the retrieval arguments. The "MemberKey" field will need the current value from the eCoComo Web site. See Figure 1
g. Save this DataWindow as "dw_upsrate_us." (You can dress up the default DataWindow if you want otherwise you're finished.) See Figure 2
The Final PocketBuilder Application
Once I had the
DataWindow running, wrapping an application around it for PocketBuilder
was pretty easy. Creating a "template application" with the default
database information does 90% of the work. All the default connection
service objects are used, so there's no need to detail them here. The
end result is that to populate the DataWindow we simply need to call
the Retrieve() method passing in the arguments. In this example, all
the data fields are generic edit masks that yield the code for the "Get
Rates" button being:
dw_1.SetTransObject( SQLCA )
dw_1.Retrieve( em_service_key.text, &
em_start_zip.text, &
em_dest_zip.text, &
em_weight.text )
When deployed to the device, the data source file is a classic text DSN file with the simple contents:
[ODBC]
uid=DBA
pwd=sql
driver=dbodbc10.dll
enginename=WebServiceDemo
databasename= WebServiceDemo
databasefile=\sa10_webservices.db
start=\Program Files\SQLAny10\dbsrv10.exe -zoc \sa10_ws.log
These few steps, followed by some prettying up, gives us a PocketBuilder application running on the device that retrieves the UPS shipping rates for your parameters. See Figure 3
Conclusion
In this article I've tried to demonstrate the simple steps to retrieve and parse many rows of data from a SOAP Web Service.
This example was for UPS shipping rates, but the technique is generic, easy, and fun! The same general steps would be followed to figure out other Web Services with their argument lists and the returned payloads.
References
• D.Chance. "Consuming Amazon Web Services using SQL Anywhere 10.01." PowerBuilder Developer's Journal. September 2007.
• eCoComa Webservices. www.ecocoma.com/webservice.aspx.
• "System Procedures - openxml." SQL Anywhere Server - SQL Reference.
• "Importing XML using openxml." SQL Anywhere Server - SQL Usage.
• Publicly available Web Services. www.xmethods.net.
Published April 16, 2008 Reads 7,548
Copyright © 2008 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Reed Shilts
In addition to being one of the "old timer" PowerBuilder kernel programmers, Reed is the development lead for PocketBuilder and currently drafted in PowerBuilder 11 & 12 work. Reed is also a regular (and vocal) member of the Boston PocketPC user's group. He often bring his latest hardware and sometimes offer PocketBuilder as a door prize - even though this is hosted by Microsoft! If you live in the Boston area, stop on by: http://www.bostonpocketpc.com
- Why SOA Needs Cloud Computing - Part 1
- Cloud Expo and The End of Tech Recession
- The Transition to Cloud Computing: What Does It Mean For You?
- A Rules Engine Built in PowerBuilder
- Sybase Named “Silver Sponsor” of iPhone Developer Summit
- How PowerBuilder Got Its Groove Back
- The Cloud Has Cross-Border Ambitions
- Ulitzer Names The World's 30 Most Influential Virtualization Bloggers
- Ulitzer Named "New Media" Partner of Greatly Anticipated iStrategy Event in Berlin
- Risks and Enterprise Mobility?
- Steps for Success in Enterprise Mobility?
- Are Mobile Luddites Resisting Mobility?
- The Difference Between Web Hosting and Cloud Computing
- Sybase CTO to Speak at 4th International Cloud Computing Expo
- Why SOA Needs Cloud Computing - Part 1
- Cloud Expo and The End of Tech Recession
- The Transition to Cloud Computing: What Does It Mean For You?
- Five Reasons to Choose a Private Cloud
- Seeding The Cloud: The Future of Data Management
- The Threat Behind the Firewall
- Economy Drives Adoption of Virtual Lab Technology
- Tips for Efficient PaaS Application Design
- A Rules Engine Built in PowerBuilder
- Sybase Named “Silver Sponsor” of iPhone Developer Summit
- Where Are RIA Technologies Headed in 2008?
- PowerBuilder History - How Did It Evolve?
- The Top 250 Players in the Cloud Computing Ecosystem
- Custom Common Dialogs Using SetWindowsHookEx
- DDDW Tips and Tricks
- OLE - Extending the Capabilities of PowerBuilder
- DataWindow.NET How To: Data Entry Form
- Book Excerpt: Sybase Adaptive Server Anywhere
- Sybase ASE 12.5 Performance and Tuning
- Working with SOA & Web Services in PowerBuilder
- Office 2003 Toolbar: A New Look For Your Old PowerBuilder App
- Dynamically Creating DataWindow Objects
































