YOUR FEEDBACK
Jeremy Geelan wrote: Dr von Eicken will be giving a technical session at SYS-CON's "Cloud Computing E...
AJAXWorld RIA Conference
$300 Savings Expire August 22
Register Today and SAVE!

SYS-CON.TV

2008 East
DIAMOND SPONSOR:
Data Direct
Frontiers in Data Access: The Coming Wave in Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
Intel
Virtualization – Path to Predictive Enterprise
Green Hills
IT Security in a Hostile World
JBoss / freedom oss
Practical SOA Approach
GOLD SPONSORS:
Software AG
The Art & Science of SOA: How Governance Enables Adoption
PlateSpin
Effective Planning for Virtual Infrastructure Growth
Fujitsu
Automated Business Process Discovery & Virtualization Service
Ceedo
Workspace Virtualization
Click For 2007 West
Event Webcasts

2008 East
PLATINUM SPONSORS:
Appcelerator
Think Fast: Accelerate AJAX Development with Appcelerator
GOLD SPONSORS:
DreamFace Interactive
The Ultimate Framework for Creating Personalized Web 2.0 Mashups
ICEsoft
AJAX and Social Computing for the Enterprise
Kaazing
Enterprise Comet: Real–Time, Real–Time, or Real–Time Web 2.0?
Nexaweb
Now Playing: Desktop Apps in the Browser!
Sun
jMaki as an AJAX Mashup Framework
POWER PANELS:
The Business Value
of RIAs
What Lies Beyond AJAX?
KEYNOTES:
Douglas Crockford
Can We Fix the Web?
Anthony Franco
2008: The Year of the RIA
Click For 2007 Event Webcasts
TOP THREE LINKS YOU MUST CLICK ON


Using Web Services in a PocketBuilder Application
How I finally overcame a nagging irritation

This tied together all the SOAP aspects of the call - the endpoint, the operation, and the argument list. To test the SOAP side of the call (and see if anything came back) I simply called this from iSQL.

I knew that iSQL wouldn't display any result set; the stored procedure is only returning the SOAP payload as a single LONG VARCHAR, not a result set. Why did I try this knowing that iSQL couldn't display anything? I knew that I'd be looking into the HTTP log file and seeing what was generated by SQL Anywhere for the SOAP call and then what was returned by the remote server. I wanted to get over that small hurdle before tackling the decomposition of the returned data payload.

call GetUPSRate( 'SHP-M89872906F', '',
'60506', 'US',
'01776', 'US',
'10.5', '0' )

The first two fields are the trial user information, which changes every week or so. The second pair of fields are the ZIP code and country for Aurora, IL (60506), the next pair of fields are the ZIP code and country for Sudbury, MA (01776), and the final two fields are the package weight and value.

Looking in the HTTP log file for the database server, I see that this trial Web Service call succeeded and reasonable looking data was returned (see Listing 1).

Examining this response data confirmed my understanding from the eCoComa Web site. Basically, I wanted to extract the 'Code,' 'Rate,' and 'Mail Service' values as columns repeated for each "Postage" row in my result set.

The next step was to figure out the syntax for the call to the SQL Anywhere 10 system procedure "openxml" to generate rows of data with my desired columns. Wrapping my head around the XPath query string and namespace qualifiers consumed many lunch hours, but reading and rereading the iAnywhere documentation for the openxml system procedure, the iAnywhere newsgroups, and the online resources about XPath led me to the following simple select statement using openxml.

SELECT MailCode,Rate,Service
FROM openxml(
      GetUPSRate( ... arguments ... ),
'//*:Postage', 2 )
WITH ( MailCode CHAR(10) '*:Code',
Rate CHAR(10) '*:Rate',
Service LONG VARCHAR '*:MailService' )

The '//*:Postage' is the XML node that generates a matching row in the result set.

The WITH statement provides the correlation between the XML nodes in the SOAP payload and what I wish to use as columns in my result set.

Wrapping all this up, I created a second stored procedure (using the naming ideas from Chance's article):

call sa_make_object( 'procedure', 'GetUPSRateWrapperUS');

alter procedure GetUPSRateWrapperUS(
@MemberKey char(20),
@SourceZip char(20),
@DestZip char(20),
@Weight char(10) )
begin
SELECT MailCode,Rate,Service FROM openxml(
      GetUPSRate( @MemberKey , '',
      @SourceZip, 'US',
      @DestZip, 'US',
      @Weight, '0' ),
'//*:Postage', 2 )
WITH ( MailCode CHAR(10) '*:Code',
Rate CHAR(10) '*:Rate',
Service LONG VARCHAR '*:MailService' )
end;

As you can see, I hard-coded for shipping in the U.S., but it can easily be extended for international shipping. I'd just need to pass in the value for customs and the correct country codes (and maybe replace the phrase 'Zip' with the more international 'PostalCode').


About 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

YOUR FEEDBACK
Ferhad wrote: As a long time mobile IM user it is good to learn that there is a Windows Live Messenger for Mobile on earth. Hope other countries have the chance to use applications like this. Maybe MS can do sth. for other countries except Taiwan too.
LATEST iPHONE STORIES
HyperOffice is now available by download from Apple's new App Store, putting the business collaboration suite within easy reach of any iPhone user. HyperOffice transforms the iPhone into a tool for mobile business. Users connect to secure corporate email, contacts, calendars, tas...
It seems that Apple has another winner on their hands with the new Apple iPhone 3G. There are now millions of people connected to the Internet every minute of every day using this device. The fast adoption has created a tremendous opportunity for software vendors and companies to...
Red Hat CTO Brian Stevens, Citrix CTO Simon Crosby, Egenera CTO Pete Manca, Allen Stewart, Group Manager, Windows Virtualization at Microsoft, and Brian Duckering, Sr. Director of Products and Alliances at Symantec were the top industry executives who joined Jeremy Geelan in the ...
Speculation is making the rounds again that AMD’s long-promised asset lite strategy will see the company split in two: a chip development operation under AMD’s new CEO Dirk Meyer and a manufacturing entity.
Proving necessity is the mother of all invention, Google’s mobile team has developed an iPhone interface for Google Translate.
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS
SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021


SYS-CON FEATURED WHITEPAPERS

ADS BY GOOGLE
BREAKING IPHONE NEWS

AirMe, an innovative, free, mobile photo sharing application that premiered last mo...