Wednesday, 30 September 2009

Groovy: ease of coding vs performance

Share
Groovy is an extremely powerful agile dynamic language for the Java Platform.

Recently I wrote a Selenium test generator in Groovy. The "core" part of the generator where 3 lines. Generator read a list of strings from a file, parsed it, then, in a loop generated piece of HTML Selenium test case, and finally saved generated test case in a file.

It was a real beauty, but I wandered what would be its performance and what would be the performance of its Java counterpart.

So, today I'm going to show you Java and Groovy counterparts and the comparison of their performance.

Monday, 28 September 2009

Running Groovy using Maven2

Share
Last week I wrote a post about GroovyWS (GroovyWS terrifies me! - DZone Big Link on 09/27 - thanks everyone!).

Using Eclipse Galileo I created Maven2 project and added Groovy nature. Eclipse automatically took care of the Groovy runtime so I was able to run Groovy classes just as they were standard Java classes.

Today I will show you how to run Groovy classes (here Groovy JUnit tests) using Maven2.

Thursday, 24 September 2009

GroovyWS terrifies me!

Share
Later this week I was writing one Web Service and I wanted to test it very quickly. My first thought was: Apache CXF. Then I thought, maybe Groovy had some killer WS support.

I wasn't mistaken.

Groovy has GroovyWS module which terrifies me... in an extremely positive way!

Want to see why?

Wednesday, 23 September 2009

Preparing for SCDJWS Part 4: Creating SOAP Messages that contain attachments

Share
Last point of Section 2: SOAP 1.2 Web Service Standards of SCDJWS exam objectives states:
Describe SOAP Message Construct and create a SOAP message that contains an attachment.
Let's do it.

Monday, 21 September 2009

JDOM, XPath, Namespaces and ASR Grammars

Share
Previous week I had to convert Loquendo ASR Grammars into Nuance compliant ones. I decided to write a small & simple Java program that would do all it automatically.

The input grammar file was:
<grammar xml:lang="pl-PL" xmlns="http://www.w3.org/2001/06/grammar" version="1.0" root="___ROOT___" tag-format="semantics/1.0">
<rule id="___ROOT___" scope="public">
<item repeat="0-1">
<one-of>
<item>Myślę</item>
<item>Chyba</item>
<!-- some more placeholders -->
</one-of>
</item>
<item>
<one-of>
<item>tak<tag>out.sltReturnValue="tak";</tag></item>
<item>ta<tag>out.sltReturnValue="tak";</tag></item>
<item>no<tag>out.sltReturnValue="tak";</tag></item>
<!-- some more "tak" and "nie" items -->
</one-of>
</item>
</rule>
</grammar>
and had to be transformed into:
<grammar xmlns="http://www.w3.org/2001/06/grammar" xml:lang="pl-PL" version="1.0" root="___ROOT___" tag-format="semantics/1.0">
<rule id="___ROOT___" scope="public">
<item>
<count number="optional">
<one-of>
<item>Myślę</item>
<item>Chyba</item>
<!-- some more placeholders -->
</one-of>
</count>
</item>
<item>
<one-of>
<item tag="sltReturnValue='tak';">tak</item>
<item tag="sltReturnValue='tak';">ta</item>
<item tag="sltReturnValue='tak';">no</item>
<!-- some more "tak" and "nie" items -->
</one-of>
</item>
</rule>
</grammar>
Here is how I did it using JDOM and XPath.

Thursday, 17 September 2009

Preparing for SCDJWS Part 3: SOAP Processing Model

Share
SOAP Processing Model is listed as one of the objectives for SCDJWS exam.

Quoting SOAP 1.2 spec (http://www.w3.org/TR/2003/REC-soap12-part1-20030624/#msgexchngmdl) SOAP Processing Model is "a distributed processing model that assumes a SOAP message originates at an initial SOAP sender and is sent to an ultimate SOAP receiver via zero or more SOAP intermediaries".

Today I'm hopping to translate the SOAP Processing Model specification into a more humane form.

Friday, 11 September 2009

Preparing for SCDJWS Part 2: SOAP encodings/bindings

Share
SOAP encodings are listed in SCDJWS exam objectives in section 2.

According to SOAP spec the following SOAP encodings/bindings are allowed:
  • RPC/encoded
  • RPC/literal
  • Document/literal
I found a pretty interesting article on IBM's Developer Works entitled Discover SOAP encoding's impact on Web service performance.

It shows that RPC/encoded Web Services are slower and may seriously affect system scalability and reliability.

On the other hand, RPC/literal and Document/literal encodings' performance is pretty the same (see the article for more details).

Probably the overall performance and for sure the interoperability issues forced WS-I to deprecate encoded style. Thus, according to WS-I Basic Profile 1.1 only the following SOAP bindings are legal:
  • RCP/literal
  • Document/literal
Today I will show you the difference between these two bindings and how to manipulate them using JAX-WS API.

Wednesday, 9 September 2009

Preparing for SCDJWS Part 1: W3C and OASIS specs

Share
Starting from today I'm officially preparing for the Sun Certified Developer for Java Web Services 5 (CX-310-230).

Today's post is very short, purely theoretical and covers the first section of exam objectives.

First section talks about XML Web Service Standards you have to be fluent in: XML (and XML namespaces), XSD, SOAP 1.1 & SOAP 1.2, WSDL 1.1, UDDI v2 & UDDI v3, and WS-I Basic Profile 1.1.

So here I provide you with a collection of W3C and OASIS links to above mentioned standards:
Have a look at them, scan them, make eventual notes. Frankly, I don't think that reading XML, XML names or XSD specs is crucial here. Also, specs are generally boring, but some of the above specs have primers which are more "humane" :)

If you're preparing to SCDJWS, I assume that you already have a good knowledge of the above standards.

But there is one spec I will talk about a little bit more in a week or two. It's WS-I Basic Profile 1.1 which aims at providing interoperability guidance for core Web Services specifications such as mentioned SOAP, WSDL, and UDDI.

Stay tuned,
Łukasz

Monday, 7 September 2009

First steps with Groovy and its XML support

Share
I am currently working with a platform for building voice applications which offers developers a mechanism of embedding Groovy scripts in call flows.

One of my first tasks was to write a module which manipulates XML documents.

Groovy makes manipulation of XML documents extremely easy.

Here I show you some basics of Groovy's XML support.

Tuesday, 1 September 2009

WS-BPEL: flow activity and parallel processing

Share
Imagine you have a partner Web Service whose invocation takes quite a considerable amount of time.

Instead of processing it sequentially you may want to fork the process by using <bpws:flow /> activity which allows parallel processing.

Today I will show you <bpws:flow /> in action. I will show you how it sped my exemplary WS-BPEL process.