2012-06-21

XPath with bad XML

My problems yesterday with the HTTP header got solved. I just needed to figure out the correct soapAction. After adding the soapAction of CreateTicket the other system accepted my webservice call and responded with a big chunk of XML. My next problem for today was to retrieve the ticket id from the other systems XML response.

I was expecting it to look like this:
<PrimaryTicketID>20120621:002</PrimaryTicketID>

But instead it looks like this:
<Result ID="20120621:002">
<PrimaryTicketID \>

How do pull out the attribute value using XPath? Actually it is not hard at all if you have done some XPath before, but as you remember I am totally new to this XML business. After trying different syntax and not getting anything out at all, I started to google for an answer. By mistake I started reading pages about XSLT and tried to get clues from there. After some time I actually managed to figure out how to do by comparing XSLT from an example web page and the XPath I was working with.

I just had to do:
Result/@ID

And got the result:
<result>20120621:002</result>

But for that to work I first had to edit the XML. With the original XML from the adapter response it still didn't work. Something seemed to be wrong with the XML format and no nodes could be filtered out.

I even tried:
//Result/attribute::ID

In the end I got a tip to ignore the nodes and just search for any attribute with the name "ID":
//@ID

Finally I got the result I needed even with the original XML.

I found some good information about XPath on W3Schools, but I really need to buy myself a book about XPath because this is really new to me.

2012-06-20

My first BMC Atrium Orchestrator project

I am now working on my first BMC Atrium Orchestrator project. I went to the admin course a couple of months ago and didn't have the chance to do any real work with the product until now. It is quite fun and challenging because of the very tight time schedule.

I am supposed to integrate our BMC Remedy ITSM with a vendors system. First we are focusing in sending incidents over web-services back and forth. After this we will continue with changes and problems and later probably even service requests.

I have never worked with web-services before so there are a couple of things that I have to learn. Even working with XML is new for me but that shouldn't be too hard I guess, because orchestrator helps a lot in that area.

So far I have built orchestrator processes that query ARS for incident information, updates the incident with vendor ticket ID and relates work info and another incident to the original incident. I got some hints from some work that a consultant did for us so that saved me some time. Now I am struggling with the vendors system because it doesn't like the HTTP header I'm sending. Strange because it worked OK when I was doing the same to the mock service in soapUI.