Gambling, Shopping, Fine Dining, and Entertainment

Las Vegas on Ulitzer

Subscribe to Las Vegas on Ulitzer: eMailAlertsEmail Alerts newslettersWeekly Newsletters
Get Las Vegas on Ulitzer: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


Las Vegas Authors: Lori MacVittie, David H Deans

Related Topics: Las Vegas on Ulitzer

PowerBuilder: Article

PowerBuilder 10.5 .NET Web Services Engine Has Arrived

Exploring a new world of programming

Two things have my interest these days: the arrival of PB 10.5 and TechWave 2006! (Yes, that's right, I'm already planning ahead.) So, I thought I'd take this opportunity to roll a little application using MS MapPoint to illustrate what's new in PowerBuilder 10.5 Web services as well as help me plot my way from Chicago to Las Vegas for this year's conference! (see Figure 1).

Sybase's introduction of the .NET Web services engine allows PB programmers to access Web services that have more complex data types than their EasySoap predecessor. This means we can use a rich array of services that were previously unavailable. (Note, for backward compatibility, you can still use EasySoap if you like, but the new recommended method is the .NET engine.) This article will show you how.

To use the .NET Web services engine you'll need a few things:

For starters, just as with EasySoap, when you use the .NET Web services engine there is a required PBD you'll need to add to your library list. It's named pbwsclient105.pbd and is most likely located on your local hard drive in C:\Program Files\Sybase\Shared\PowerBuilder. Add it to your library list (see Figure 2).

[Alternatively, you can import the PBNI extension objects from the pbwsclient105.pbx into an existing PBL. See the "Other Enhancements" article in this same issue. - Editor]

The easiest way to actually create a .NET Web services client is to use a wizard. To access it, go to File -> New -> Project and choose the Web Service Proxy Wizard. Notice, you'll need to check "Use .NET Engine" (see Figure 3).

Click on next and you'll prompted for a WDSL file name. Either select one from your local hard drive or point your browser to the URL location. In this case, we'll use the staging (developers) location for our Web services definition - http://service.mappoint.net/standard-30/mappoint.wsdl. Next, you'll be prompted for the service you wish to use. In this case, we only need access to the CommonServiceSoap, so select that and click next. The wizard will then ask you for a prefix for the proxy name. I suggest using p_. This will easily help you identify data types belonging to the proxy. Next, PowerBuilder will prompt you for the PBL where you want to store the generated project and proxy, so choose a location. Finally, click on finish and, voilá, PowerBuilder has created your Web service proxy. However, before you can use it you'll have to deploy it. To do that, choose Design -> Deploy Project and wait a few seconds while PowerBuilder compiles the types for you (see Figure 4).

With that out of the way, we can go about coding our MS MapPoint Web service functionality. As stated previously, we are simply going to get the latitude and longitude coordinates for Chicago and Las Vegas. The code is simple (see Listing 1). The primary focus will be on debugging and a new method introduced to the SoapConnection object.

The new method is called SetBasicAuthentication. What this allows us to do is provide our .NET credentials to a Web service. This is not possible in the EasySoap implementation. Again, this opens up a vast array of Web services that use this type of authentication. (On a related note, another nice thing Sybase did was add several methods for setting properties on the SoapConnection object, a change from the old tab-delimited mechanism.)

What about debugging? You may be used to using the SetOptions method and property SoapLog for your debugging pleasure. This is gone with the .NET Web services engine. We will have to rely on a third-party debugging mechanism, namely TCP Trace. [Or any TCP tracing utility, such as Trace Utility from the Microsoft SOAP Toolkit, or YATT, which is also from PocketSOAP. - Editor]

TCP Trace is a great tool for learning about IP protocols. Basically you can set it up to capture all IP traffic on a particular port. The way it works is, you direct your client to send all traffic to a port that TCP Trace is listening on. TCP Trace logs that traffic (for your viewing pleasure) and then forwards it on to the real host. It's kind of like a sniffer.

There are three steps to configuring it. First, tell TCP Trace which port to listen for messages on, then where to send them after it has logged them. The third part of the equation is to tell PowerBuilder to send SOAP messages to TCP Trace. To do that, you'll need to modify your PB105.exe.config file. It's usually located in C:\Program Files\Sybase\PowerBuilder 10.5.

You will need to add this line given that you have TCP trace set up as shown in Figure 5.

<appSettings>
<add key="EndpointURL" value ="http://localhost:25000/Find-30/FindService.asmx">
</add>
</appSettings>

[The other option is to simply specify the local endpoint as the third optional parameter on the CreateInstance call for the SoapConnection object. That overrides the endpoint from the WSDL file. - Editor]

Doing so will instruct PowerBuilder to re-direct all your outbound SOAP traffic to port 25000, which TCP Trace has been configured to listen on. Then, as stated, the messages will be logged and then forwarded to the real host, which in our case is findv3.staging.mappoint.net. Cool huh? (Many thanks to Jim O'Neil of Sybase for showing me how to use it.)

[Be careful not to include the "http://" prefix on the destination source in TCP Trace. Doing so confuses the utility and will result in the connection attempt hanging. Many thanks of my own to Jim O'Neil for helping me through that issue. - Editor]

That's it.

Interested in learning more? There are hundreds of operations you can explore with the MS MapPoint Web service but more important is the fact that Sybase has added the .NET services engine. This opens up a world of programming fun. There are many books out there that give real-world examples from Amazon to MS MapPoint to Google to you-name-it Web services that you can now incorporate into your own applications. I encourage you to start exploring.

BTW, this application does have some usefulness to it, that is, if you're into geocaching. In particular, look for a special hidden cache I'll have down at TechWave this year. You can keep tabs on it at www.geocaching.com/

Happy coding!

More Stories By Deanne M. Chance

Ms. Chance graduated in 1996 with a degree in computer science from the University of Illinois. She has been a frequent contributor to the PowerBuilder Developer's Journal and gave a key presentation at Sybase TechWave 2005 entitled "A Real-Time Physical Inventory Solution Using PocketBuilder ASA and a WiFi Connection." She has held several engineering positions, starting a career at Motorola where she focused on mobile I.P. by doing real-time embedded programming for the base radio controller group as part of the iDEN/Nextel project.

Comments (3) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


Most Recent Comments
Chance 07/11/06 07:33:24 PM EDT

I take that back...Pittsburgh sucked. So, I came back home. You can find me in the ChicagoLand area doing PB and PPB stuff. Want to work together? Drop me a line: [email protected].

Chance 03/30/06 07:50:17 AM EST

Make that Pittsburgh to Las Vegas. I moved. I like it here better.

SYS-CON Italy News Desk 03/18/06 07:38:14 PM EST

Two things have my interest these days: the arrival of PB 10.5 and TechWave 2006! (Yes, that's right, I'm already planning ahead.) So, I thought I'd take this opportunity to roll a little application using MS MapPoint to illustrate what's new in PowerBuilder 10.5 Web services as well as help me plot my way from Chicago to Las Vegas for this year's conference! (see Figure 1).