| By Arthur Hefti | Article Rating: |
|
| June 5, 2007 11:30 AM EDT | Reads: |
12,362 |
In preparing the last page, a calculation of a possible scholarship is done. Here the PowerBuilder Web Service is called in ASP.NET on the server and not through AJAX on the browser.
We also make use of a handy JavaScript library called Behaviour. It lets you separate the JavaScript code from the design. This means the designer can create the page without touching the JavaScript. The script is applied during the rendering of the page in the browser. The following code shows the definition of what should happen if the ForwardButton gets clicked.
'.ForwardButton' : function(element){
element.onclick = function(){
pf.GoToNextPage('forward');
}
},
The Back-End
Creating Web Services with PowerBuilder 11 is very easy. We copied the classes needed from the PowerBuilder 10.5 application and created a wrapper NVO for all the access logic. After this we created a .NET Web Service target and did the appropriate settings in this project painter. You can choose one or more objects to be used as a Web Service and you can give each object a Web Service name. Choose the methods you'd like to publish and name them the way you want it to be seen from the outside (see Figure 3).
You can run a test page directly from the project painter. There you can call each of the methods of the service and see some sample script on how to include it into your application.
Using .NET Assemblies in PowerBuilder
We store some access and text information in XML files that are used from the PowerBuilder part of the application and from the ASP.NET 2.0 part as well. As PBDOM is not an option when generating .NET applications we made use of the XML classes in the .NET Framework.
The Microsoft .NET Framework is a huge framework and class library you can make use of. It replaces the old Windows API with an object-oriented component-based API. It includes functionality for file handling, XML parsing, security, communication, and database access. For more details follow the link for the .NET Framework in the reference section below.
We made use of the various XML classes from the framework. To give you an idea, I included a couple of code lines for XML handling.
The method LoadXml loads a string into an XMLDocument. Using an XPath expression with the method SelectNodes returns an XMLNodeList you can work with.
string ls_String, ls_User
...
#if defined pbdotnet then
System.Xml.XmlDocument xmlDoc
System.Xml.XmlNodeList xmlElements
xmlDoc = create System.Xml.XmlDocument
xmlDoc.LoadXml( ls_String )
xmlElements=doc.SelectNodes &
("//n1/n2[@name='"+ls_User+"']/*");
#end if
Some rules concerning the script:
• Although using .NET classes, you have to use PowerScript syntax. If you're used to writing C# it's quite strange at the beginning.
• To create a class the keyword create is used, not the keyword new as in C#.
• Compound statements like if, case, and for are used as in PowerScript.
• PowerScript variables can be declared outside the .NET code and can be accessed in the code.
• Don't forget to include the mscorlib.dll in the .NET Assemblies tab of the target properties
To compile platform-specific logic, PowerBuilder 11 introduced conditional compilation. You can distinguish between PBNATIVE, PBWEBFORM, PBWINFORM, PBWEBSERVICE, PBDOTNET, and DEBUG. The .NET-specific preprocessor symbols tell PowerBuilder to ignore everything between #if defined and #end if when you save your object in the painter. That program code will be checked only when the .NET target is generated.
When it comes to debugging the server part, PowerBuilder 11 does a brilliant job. You can define breakpoints and start the debugger in PowerBuilder as usual. As soon as a PowerBuilder Web Service is called the PowerBuilder IDE pops up. You can single step through PowerBuilder and .NET code and look at variables used in PowerScript and variables defined in the .NET code only. In the listing above you can inspect the variable ls_String and check the properties of the xmlDoc variable.
Conclusion
With PowerBuilder 11 and DataWindow.NET, Sybase provides two tools to write applications for the Web. It lets you reuse PowerBuilder business logic. With PowerBuilder 11 it's possible to deploy PowerBuilder business logic to IIS very easily. This is something you have been able to do with EAServer for quite some time. And since the PowerBuilder Application Server Plugin is available you can do this with other application servers as well. You can even use the Microsoft Visual Web Developer 2005 Express Edition (which is free) for programming with DataWindow.NET.
References
• DataWindow.NET and PowerBuilder 11.
www.sybase.com.
• Microsoft Visual Web Developer 2005 Express Edition. http://msdn.microsoft.com/vstudio/express/vwd/.
• Microsoft .NET Framework. http://msdn2.microsoft.com/en-us/netframework/aa569294.aspx.
• AJAXWorld Conference.
www.ajaxworldconference.com.
• Dave Crane et al. "AJAX in Action."
www.manning.com/crane.
• Ben Nolan. "Behaviour."
www.bennolan.com/behaviour/.
• Prognos. www.ausbildungsbeitraege.info.
Published June 5, 2007 Reads 12,362
Copyright © 2007 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Arthur Hefti
Arthur Hefti is CEO of CATsoft Development GmbH in Zurich. He has been working with PowerBuilder since version 3 and taught dozens of PowerBuilder training classes. He and his team create custom-made client/server and Web applications using XML, Web Services, and encryption.
![]() |
Alan 06/21/07 09:59:26 AM EDT | |||
I think this is a very trivial application and it should not be talked about in pbdj even if it is for the sake of showing a technical argument. Seems more like an addvertisemt !! The whole app would take no longer than 3 days of work !! Writting the word Switzerland does not make it a high end contrinution :-) |
||||
- 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 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?
- Hot Event in Santa Clara Becomes Cool with the iPhone
- 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



































