Subscribe to

<2017 April>

On this page ...
XPath and Namespaces
Something for your walls
SOA and BPM Conference - Day 1, Oslo unveiled
SOA and Business Process Conference


Send me an email Send mail to the author(s)

© Copyright 2017

Powered by: newtelligence dasBlog 2.0.7180.0
 Wednesday, 28 November 2007
XPath and Namespaces

When you work with BizTalk, you work with XML, and when you work with XML, you are bound to run in to the need to do simple queries against an XML file. The answer of course is XPath queries; essentially just a matter of indicating a path through an XML file leading to a specific element – or set of elements – you want to extract.

As is the case – again when working with BizTalk – these files will typically have one or several namespaces. I created two very similar XML files for the sample (full links to all files are found at the end of the post). The files are invoices and have a standard items loop with some references at the item level that I will be accessing. In overview the files look like the following.

What I want is to find the value of the reference to the order number for the first Item. That is the value of the ReferenceValue element when the sibling ReferenceType element has a value of ‘OrderNumber’.

XML with one namespace

 1 <?xml version="1.0" encoding="utf-8" ?>

 2 <ns0:Invoice xmlns:ns0="http://XPathTest/Schemas/Invoice">

 3   <Items>

 4     <Item>

 5       <Reference>

 6         <ReferenceType>OrderNumber</ReferenceType>

 7         <ReferenceValue>1</ReferenceValue>

 8       </Reference>

 9       <Reference>

10         <ReferenceType>DeliveryNoteNumber</ReferenceType>

11         <ReferenceValue>1</ReferenceValue>

12       </Reference>

13     </Item>

14     .

15     .

For our file with one namespace this is quite simple as XPath assumes all elements in our query are from the default namespace – because nothing else is expressed. Therefore we only have to include the name of the elements in our query which ends up looking like the following.


I am applying two different filters; the index filter to get the first Item element out of a number of repeating elements and a value filter to get the Reference element where the child ReferenceType element has a specific value.

With two namespaces

 1 <?xml version="1.0" encoding="utf-8" ?>

 2 <ns0:Invoice xmlns:ns0="http://XPathTest/Schemas/Invoice">

 3   <Items>

 4     <ns2:Item xmlns:ns2="http://XPathTest/Schemas/Item">

 5       <ns2:Reference>

 6         <ns2:ReferenceType>OrderNumber</ns2:ReferenceType>

 7         <ns2:ReferenceValue>1</ns2:ReferenceValue>

 8       </ns2:Reference>

 9       <ns2:Reference>

10         <ns2:ReferenceType>DeliveryNoteNumber</ns2:ReferenceType>

11         <ns2:ReferenceValue>1</ns2:ReferenceValue>

12       </ns2:Reference>

13     </ns2:Item>

14     .

15     .

For our file with two namespaces we have to indicate the namespaces for all the elements not found in the default namespace of the file which strongly affects the readability as can be seen from the resulting query. (Where I have added line brakes for readability only)

 1 //Items

 2 /*[local-name()='Item' and namespace-uri()

 3 /*[local-name()='Reference' and namespace-uri()

 4 /*[local-name()='ReferenceType' and namespace-uri()
     ='http://XPathTest/Schemas/Item' and .= 'OrderNumber']

 5 /..

 6 /*[local-name()='ReferenceValue' and namespace-uri()

2. The index filter is applied in the same way as with the file with one namespace.

4. For the file with one namespace we applied the value filter at the level of the Reference element where we could indicate we only wanted that element when the child called ReferenceType had a specific value.

For the file with two namespaces we have to move down to the actual ReferenceType element and indicate we only want that element when it has a specific value.

5. Then we move back up to the parent of the – the Reference element.

6. Because we really want to move back down to the ReferenceValue element – which is want we wanted to find.

If you want to grab the files and test for yourself:

File with one namespace

File with two namespaces

Text file with the two XPath queries

Wednesday, 28 November 2007 20:50:19 (Romance Standard Time, UTC+01:00)#Comments [0]
 Thursday, 08 November 2007

Safely back from the SOA and BPM Conference in Seattle with a head full of new ideas and still tired from jet lag, this is just a quick post to summarize the conference and show some of the promised pictures.

As expected it was a great conference with lots of good sessions. After a first day, full of high level keynotes giving a good preview of Microsoft’s visions for the future on several aspects of the SOA world, it all got a bit more technical on the following days. 

   Seattle200701_thumb Seattle200702_thumb Seattle200703_thumb  
  The Space Needle, Seattle and Snoqualmie Falls from the tv series Twin Peaks

I saw an excellent session deep diving into the new WCF adapters for BizTalk Server 2006 R2. It was hosted by Aaron Skonnard and although it was on fast forward – an hour really isn’t much to go through WCF and the new adapter framework – it gave a good impression on how it will make BizTalk an even better backbone for a service oriented solution. The easy exposing of services through WCF combined with the strength of the technology together with BizTalk seems a really nice approach to inter service communication. I will try to post a little further on this in the coming weeks.

Another great session was on testing BizTalk solutions, held by Darren Jefford, one of the writers of the book, Professional BizTalk Server 2006. The session was really a walkthrough of best practices, and most of it can be found in that very book. It is always nice to have things repeated though and especially when it is something you just need to know on a subject most of us probably neglect – testing.

   Seattle200704_thumb Seattle200705_thumb Seattle200706_thumb  
  Twede's from same series, the worlds largest building and the Seattle Sonics

Finally there were two sessions on the ESB guidance by Marty Wasznicky. I think I have already used ‘fast forward’ in this post, but that’s ok because the term really doesn’t begin to describe these two sessions. In the first one Marty had just gotten the final build of the guidance and did a complete install as a demo including running a couple of the included samples. I really must say they have gone a long way from the earlier CTP builds I have looked at and I am looking forward to getting my hands on this final build and installing it on my machine – another thing there will probably be further postings on in the future.

Finally I just wanted to include one last picture, actually from the conference of ’06 and not this year. Take a look at the guys computer – I really like the picture.

Thursday, 08 November 2007 10:12:41 (Romance Standard Time, UTC+01:00)#Comments [0]
 Thursday, 01 November 2007
Something for your walls
Today Microsoft launched a series of posters illustrating different parts of the BizTalk world. They all look very nice, of course, and especially the ones on the runtime architecture and scale-out configurations might actually be of some practical use. As for the one on the capabilities maybe your sales guys would like to see it though.

Anyway, go grab them.


Thursday, 01 November 2007 00:44:31 (Romance Standard Time, UTC+01:00)#Comments [0]
 Wednesday, 31 October 2007
SOA and BPM Conference - Day 1, Oslo unveiled

After spending a couple of days sightseeing in the Seattle area (sorry no pictures yet – didn’t bring the cable for my digital) and desperately trying to adjust to the time difference (sorry no luck there either, still waking up at 5 in the morning) the conference was finally kicked of yesterday.

One day down of the most important thing to come out of it is Microsoft’s announcement of their vision for the future around working with SOA and services in general.

They call it Oslo and more than just being a name for a new product it is an overall vision for the next wave of products with the promise to help us cross lots of the boundaries we meet when implementing solutions today. They want to help us solve the problems we all have when we find us selves’ communication with other trading partners or even other departments within our own company. They want to help us break out of the silos which today too often stand in the way of truly cooperating towards the better solution.

They will deliver new unified ways of working together all the way from modeling our services across requirement gathering, specifications, designing, implementing and deploying. For this they will launch an all new tool actually demoed in the key note, called Universal Editor – a just about broad enough name. The tool will allow people involved in a project to work together on modeling the new solution indifferent of their unique approach – as it is a universal editor. All the time working on the same base of data and information stored in a new repository they will also be launching.

All in all, in spite of the very early and overall introduction to their visions it promises well for the future.

ISB (Internet Service Bus)
Another heavily discussed topic of the day was the ISB – the Internet Service Bus – which will bring the good ideas and loosely build architecture of the ESB to the internet. Extending the values gained from the ESB all the way to the external trading partners.

For simplicity the ISB can be seen as a hosted ESB, allowing for ‘everybody’ to utilize it’s publish/subscribe capabilities to expose and consume services. From the start Microsoft will host an ISB and it is actually their approach that smaller companies can communicate across this – how ever there is no reason why others shouldn’t host their own, a thing that in my mind is probably more likely to happen.

Finally Microsoft also launched their all new SOA website this morning.

Wednesday, 31 October 2007 14:46:37 (Romance Standard Time, UTC+01:00)#Comments [0]
 Saturday, 27 October 2007
SOA and Business Process Conference

I am Excited! I am sitting in the Copenhagen Airport feeling a little strange after a very overpriced spaghetti bolognaise, looking at a good eleven hours flight ahead of me – and still I am exited!

I am heading to the Microsoft SOA and Business Process Conference, held by the BizTalk team, right there on the Microsoft campus in Redmond. I was lucky enough to attend the same conference last year and it was great.

There were a lot of really good speakers talking about interesting things that they actually knew something about. A fine mix between sessions with business, architect and developer approaches to the world of service oriented solutions and process management. And I even got to see a couple of quite deep technical ones as well. Another overall thing I liked about the conference was that all the speakers had a realistic and practical approach to what service orientation is and how it can be utilized.  No sales talk – at least not too much – and no “SOA is the answer to all the questions you can come up with”.

And the conference was the first time I heard (I think this goes for most people) about the ESB guidance from Microsoft – I saw two excellent presentations on it given by Marty Wasznicky and Richard Seroter the masterminds behind the project. I think it is safe to say that even though the solution behind the guidance is big and quite a mouthful it contains so many good ideas and approaches that there should be something in there for everybody working with BizTalk solutions at a certain level.

Anyway I am heading back to the conference again this year and am really excited to be going. And although I admit that I due to quite a heavy workload in the last couple of weeks haven’t looked as much at the agenda and sessions, I know that there will be a lot of good stuff this year as well.

I hope to be posting throughout the conference so come back anytime for an update.

Saturday, 27 October 2007 12:33:51 (Romance Standard Time, UTC+01:00)#Comments [1]