Add-Ons & Services

Abusing XMLConfiguration - in a good way

Tips and tricks for POCO C++ Libraries users.

Abusing XMLConfiguration - in a good way

Postby rmoffer » 14 May 2011, 04:10

I've been working on a project whose core business logic is inside a Poco ServerApplication but had a Axis2/C SOAP component running in apache.

Recently I had issues (well I've had issues with Axis2/C for a while now - but only recently discovered how bad they were ...) the support for xsd:anyType in Axis2C was pretty poor for a SOAP client.

I could see the response - but Axis would not decode it into valid C objects. In fact it wouldn't even decode it into its own internal tree, whole swathes of the response were silently ignored.

I had a light bulb - why not use XMLConfiguration - it reads an XML file, it provides an easy query option for the document.

So my code does this

Construct a XMLConfiguration object
Set key/value/attributes representing the SOAP message body
Save the XML configuration data to a stream - that's also connected to the sendRequest() stream of the HTTP request.

Get the response back
Load the response into another XMLConfiguration object
Query the response using simple getString(key).

Success. No more access. Took me a couple of hours to get working after spending a week debugging Axis.

I'm now looking to use a similar technique in other parts of the project. Parts that did not have the xsd:anyType issue - and had been quite
happy with using Axis.

You might ask why am I not using the Poco Remoting classes? I looked at them last year, but we need to build our software from a WSDL definition and at the time there was no support for generating the stubs from WSDL.

I quite like this solution, it feels right = simple key/value pairs, no complex object management/allocation.
Posts: 49
Joined: 09 Feb 2009, 19:20
Location: San Francisco bay area.

Re: Abusing XMLConfiguration - in a good way

Postby guenter » 14 May 2011, 21:00

I have also occasionally "abused" XMLConfiguration for handling RSS feeds. Works great ;-)
Posts: 1177
Joined: 11 Jul 2006, 16:27
Location: Austria

Return to “%s” Tips & Tricks

Who is online

Users browsing this forum: No registered users and 1 guest