No, this is not related to *buntu. But this is looong... and now I've got your attention. :-)


Interacting with Web Services usually implies reading some WSDL (Web Service Description Language) document. Unfortunately, WSDL documents are written in XML and can be pretty complicated, leaving the user with no other choice than to use some graphical development tool in order to understand them.

Lately at italianaSoftware we had to handle a lot of Web Services stuff, equipped with long WSDL documents and complex data types. Jolie already had support for the SOAP protocol, but one had to code the interface and data types of the Web Service to invoke by hand. So we started a new project aiming to enable Jolie for the automatic usage of WSDL documents, mainly composed by two parts: a tool and an improvement to the Jolie SOAP protocol. Of course both things are open source and available in the trunk branch in the Jolie svn repository!

wsdl2jolie (whose executable is now installed by default if you install Jolie from trunk) is the newly developed tool in question. It simply takes a URL to a WSDL document and automatically downloads all the related files (e.g., referred XML schemas), parses them and outputs the corresponding Jolie port/interface/data type definitions.
Let us see an example. See this WSDL document for a service that calculates prime numbers: http://www50.brinkster.com/vbfacileinpt/np.asmx?wsdl. Reading the raw XML is not so easy, or at least requires some time.
Let us see what we get if we execute wsdl2jolie http://www50.brinkster.com/vbfacileinpt/np.asmx?wsdl :

Retrieving document at 'http://www50.brinkster.com/vbfacileinpt/np.asmx?wsdl'.
type GetPrimeNumbersResponse:void {
.GetPrimeNumbersResult?:string
}

type GetPrimeNumbers:void {
.max:int
}

interface PrimeNumbersHttpPost {
RequestResponse:
GetPrimeNumbers(string)(string)
}

interface PrimeNumbersHttpGet {
RequestResponse:
GetPrimeNumbers(string)(string)
}

interface PrimeNumbersSoap {
RequestResponse:
GetPrimeNumbers(GetPrimeNumbers)(GetPrimeNumbersResponse)
}

outputPort PrimeNumbersHttpPost {
Location: "socket://www50.brinkster.com:80/vbfacileinpt/np.asmx"
Protocol: http
Interfaces: PrimeNumbersHttpPost
}

outputPort PrimeNumbersHttpGet {
Location: "socket://www50.brinkster.com:80/vbfacileinpt/np.asmx"
Protocol: http
Interfaces: PrimeNumbersHttpGet
}

outputPort PrimeNumbersSoap {
Location: "socket://www50.brinkster.com:80/vbfacileinpt/np.asmx"
Protocol: soap {
.wsdl = "http://www50.brinkster.com/vbfacileinpt/np.asmx?wsdl";
.wsdl.port = "PrimeNumbersSoap"
}
Interfaces: PrimeNumbersSoap
}

which is the Jolie equivalent of the WSDL document. Those ".wsdl" and ".wsdl.port" parameters are the aforementioned improvement to the SOAP protocol: when the output port is used for the first time, Jolie will read the WSDL document for processing information about the correct configuration for interacting with the service instead of forcing the user to insert it by hand.
Now we can just put this into a file, say "PrimeNumbers.iol", and use the output ports we discovered from Jolie code. As in the following:

include "PrimeNumbers.iol"
include "console.iol"

main
{
request.max = 27;
GetPrimeNumbers@PrimeNumbersSoap( request )( response );
println@Console( response.GetPrimeNumbersResult )()
}

That little program will output "1,3,5,7,11,13,17,19,23". The example can be downloaded from this link (remember, it requires Jolie from trunk).

wsdl2jolie acts as a nice tool for being able to use the typed interface of a Web Service from Jolie and for getting a more human-readable form of a WSDL document (its Jolie form).

Another nice feature we get for free from the SOAP protocol improvement is that now MetaService can act as a transparent bridge towards Web Services. Simply call the addRedirection operation with the right protocol configuration (in this case, the ".wsdl" and ".wsdl.port" parameters) and MetaService will automatically download the WSDL document (we also have a cache system for them already in trunk!) and make it callable by clients.
This is a huge step forward for client libraries such as QtJolie: just tell where the WSDL document is and you can already place calls to the Web Service of interest.
Also, by using wsdl2jolie first and then tools such as jolie2plasma one could use the Jolie intermediate representation for transforming a Web Service interface definition into a (KDE) Plasma::Service XML one. With the same trick, one could also write C++ generators for QtJolie and introduce ease and type-safeness to Web Services invocations. I and Kévin sure have things to think about now. ;-)

Beware that the code is still in its early stages. It already works with a lot of Web Services, but we're still improving it. For instance, we currently support only the SOAP document format (which is the one people advise to use, anyway). Patches, comments and reports are welcome in jolie-devel @ lists.sourceforge.net!