Thursday, November 24 2005

Puakma Web Services: Getting started

Writing and using web services has never been easier. Read this article and get started building today.

Web services is an emerging technology which enables services on a remote computer to be accessed by a client. In the past this has been achieved through DCOM, CORBA and RMI (to name the most popular technologies). In the last couple of years, with the advent of XML, XML and HTTP have been used together to perform this function, in a new technology called SOAP (Simple Object Access Protocol). The main advantage of SOAP is that it is platform neutral, HTTP is a common transport system used for requesting and posting pieces of data across the Internet. When combined with XML, that adds a platform neutral way of representing the objects and requests. SOAP may also work with SMTP mail, or any transport method for that matter. Puakma currently supports only HTTP.

Puakma web services require no knowledge of SOAP. This may well be the easiest SOAP implementation on the planet.

Puakma web services require two tasks to be loaded on the server. WIDGIE and HTTP. All connections are made to the HTTP server and the request data is passed by the internal message passing interface to the Business Widget Server (WIDGIE). WIDGIE then completes the request and passes the data back to the HTTP server to be streamed to the client. Download a simple widget here.

To set up the web service, two components need to be constructed, the client and the service. Creating both is very easy and all can be set up in seconds.

Server side code

Writing your first web service is a snap. If you have written a Puakma action before, then a web service is just as easy. All you need is a simple class that extends the BusinessWidget class, then all methods you make public are automatically exposed as methods within your web service.

import puakma.system.*;
import puakma.addin.widgie.*;
import puakma.addin.http.action.*;
import java.util.*;

/**
* A simple web service
* */

public class SimpleWidget extends BusinessWidget
{

protected boolean init()
{
//any specific init routines
//called when the widget is initially started
m_pSystem.doInformation( "Initialised", this);
return true;
}

protected boolean requestQuit()
{
//called when this widget is requested to stop
return true;
}

public String helloWorld()
{
return "Hello World";
}

}

Compile the above code and save it under the "Business Widget" section of your application (using the Puakma web design application). In a few seconds you should see the class automatically loaded by WIDGIE, making it available for access by clients. Really, that’s it, no more to do on the server side!

URLs

There are a few URLs which are useful for accessing the web services:

http://your.server/your/app.pma?WidgetList

This command will list all the services available in this application. If you wish to return a list of all services available on the server, you can easily write your own Action code to perform this task.

http://your.server/your/app.pma/BusinessWidgetName?WidgetWSDL

This allows non-Puakma client to see the WSDL required to create a client web service for accessing the named service. Note, programmers may look at this to see the Java method declarations, which often make much more sense to humans than the reams of XML code.

http://your.server/your/app.pma/BusinessWidgetName?WidgetExecute

This is the URL you need to POST to, to execute the web service. Puakma does not support "GETs" for accessing web services, because a HTTP GET does not pass enough information to allow the full use of these services. You may, however, write some Action code which calls the service internally.

The client

On the client side, life has never been easier. You can call the web service in two lines of code. You may also use the Puakma SOAP client software to access services on other non-Puakma servers. To access the above Business Widget service:

SOAPClient sc = new SOAPClient("http://your.server/your/app.pma/SimpleWidget?WidgetExecute", "helloWorld");

try
{
String sReturn = (String)sc.execute();
System.out.println("SOAP REPLY: " + sReturn);
}
catch(Exception e)
{
System.out.println("SOAP ERROR: " + e.toString());
}

The execute method returns the same object that the remote method returned, so can be easily cast as that type, for example:

byte[] buf = (byte[])sc.execute();

What data types are supported?

Puakma supports all the major primitive data types and multidimensional arrays of those types.

Java Type

SOAP Type

String

xsd:string

Float

xsd:float

Double

xsd:double

Integer

xsd:int

Long

xsd:integer

Boolean

xsd:boolean

Date

xsd:dateTime

Byte[]

xsd:base64Binary

Puakma does not support complex types (eg: a "person" object). After careful investigation, it was decided that complex objects should not be represented by SOAP. To mimic this functionality, pass an XML string parameter to your methods, and have the methods reply with another XML string.

The use of Puakma web services in a production setting requires the purchase of a Puakma Enterprise license.

Recent Comments

Very cheap drugs : [url=http://firstdrugstorezone.info/product_aciphex.htm]aciphex[/url] aciphex http://firstdrugstorezone.info/product_aciphex.htm Thanks!
Posted by Alex53 at newmsn.com   on   27.Aug.08 04:36
[url=http://codypoolk38.t35.com/answer-www.kingstonroyce.com.html] www.kingstonroyce.com [/url] [url=http://marygrove71.t35.com/a.b.hart-and-ohio.html]a.b.hart and ohio [/url] [url=http://hometown.aol.com/melissacaer16/abram-s.-hewitt.html]abram s. hewitt [/url] [url=http://shirleyclark99.tripod.com/asp.net-text-validator.html]asp.net text validator [/url] [url=http://fitnessblowout.com/ ] super gym's fitness warehouse [/url] He put his hand to his back again. Providence, though. She puts me through my paces, I tell you. He laughed and stretched his arms. If ever I expire in the harem, DeWar, Perrund may be to blame, and yet no blame will attach. secretcherry.net kimballsauction.com ers.com rob thomas environmentalchemistry.com: environmental, chemistry & hazar Li made an exasperated noise. Youre humouring me I thought you at least would argue. Youre just like everybody else. Ah, I said. Jhavins hit the red, but just left it hanging over the pocket. http://hometown.aol.com/stephenjooe96/part-www.illinoisform.com.html http://rogerkalan8.t35.com/part-www.credit.equifax.com.html http://jenniecoole27.tripod.com/h.a.m.-hood-in-runescape.html http://charlesevans8.t35.com/part-www.diabetesfoundationa.com.html http://steveharvey.com/
Posted by Gangster33 at newmsn.com   on   02.Sep.08 01:02
[url=http://ritaspear37.t35.com/answer-school-uniforms-articles.com.html] school uniforms s.com [/url] [url=http://markcaell72.t35.com/buva-..html]buva . [/url] [url=http://bradleyjames71.tripod.com/post-amazon.com-business-visa.html] amazon.com business visa [/url] su [/url] Ap- pearances can be deceiving, my fuzzy little cousin. She turned to face Jon-Tom as she stood on enormous, power- ful feet. She was as tall as he was. fat rabbit racing. qualitymirrors.com wetners.com His nails managed to rake the brickwork as he toppled and fell heavily down the steps, hitting the stone floor of the cellar with a lazy thud. There, sprawled, he lay still a painted giant. http://hometown.aol.com/ericafres2/answer-london-england.com.html http://hometown.aol.com/joycelyne88/answer-elitemg.co.uk.html http://jeremytoman77.t35.com/750-nitro.html http://sixwise.com/
Posted by Bob51 at newmsn.com   on   02.Sep.08 02:00
[url=http://susangrgan31.tripod.com/aldelpphia.com.html]aldelpphia.com [/url] [url=http://hometown.aol.com/margaretskon20/answer-www.crime-stoppers.on.ca.html] www.crime stoppers.on.ca [/url] [url=http://louiswrght39.t35.com/read-quot-.prj-quot-files.html]read quot .prj quot files [/url] [url=http://hometown.aol.com/joanpeer2/dr.-beverage-plastic-surgeon.html]dr. beverage plastic surgeon [/url] [url=http://easywealthtoday.com/ ] easy wealth today [/url] She was staring at the blankness of the space beyond the asteroid. The asteroid circled the Dust Cloud which surrounded the Slo-Time envelope which enclosed the world on which lived the people of Krikkit, the Masters of Krikkit and their killer robots. www.audacitymodels.com www.jewish prayers be reasonable.com quot replacements ltd. quot florida cfo alex sink/department of financial services In the room of meetings she prowled back and forth, back and forth. It was a cage. She halted at the window and stared out through the grille. From there she could look over the walls around the ancient temple of Bel. http://hometown.aol.com/josephnacy76/watersavingtips.com.html http://hometown.aol.com/lararias35/www.beinvestcorp.com.html http://hometown.aol.com/janerull34/answer-leslie-n.-speck.html http://gizmocafe.com/
Posted by Coder28 at newmsn.com   on   02.Sep.08 11:07
[url=http://members.lycos.co.uk/miguelmote56/entry-filters-now.com-coupon-code.html] filters now.com coupon code [/url] [url=http://members.lycos.co.uk/glensatt78/www.latino.com.html]www.latino.com [/url] [url=http://hometown.aol.com/matthewvahn45/impressforms.com.html]impressforms.com [/url] [url=http://members.lycos.co.uk/thomasanon53/historyst.-packtrics-day.html]historyst. packtrics day [/url] [url=http://whatreallyhappened.com/ ] whatreallyhappened.com [/url] Youve heard of it? Vaguely, I said. My mouth had gone quite dry while I wondered whether to say anything about what I had heard from Walens page and Jollisce. wichita.org roofing permits floridahealthstats.com quot j. quint flloyd quot wnba.com With Runs to help explain, the encounter went smoothly, except that Chad and Mindy managed very little sleep since the three newcomers kept them awake long into the night with endless questions about everything from human foods to international relations. http://elisechvez27.tripod.com/xxxpedition.com.html http://members.lycos.co.uk/johndaon69/stickgame.org.html http://ceciltrump45.tripod.com/vanna-white-.com.html http://peggyfiroa22.tripod.com/article-iphone-block-on-calls..html http://lmctruck.com/
Posted by Red43 at newmsn.com   on   02.Sep.08 22:09
Show all comments
Got something to say? Add comment