I have had some success with using XML & SOAP with custom namespaces.. I
never had any problems extracting the XML data however, my issues were
all centred around needing to send SOAP requests with a specific xmlns
attribute in the elements, and there was no way of specifying the xmlns
values to use in the message without parsing the message as a string and
using string manipulation methods immediately prior to send.. 

Here's a snippet from my program that processes received SOAP messages.
FYI we have a number of the types and other common values held as
equates in an include to reduce finger trouble, and the xmlns is one of
those includes, but I copied the include into the code so you can see
what xmlns we are using:

* Open Message, and get main element from soap:Body, and determine type
RESPONSE.TYPE = ""
TEMP.STATUS = XDOMOpen(IN.DATA,XML.FROM.STRING,ROOT.DOM) 
TEMP.STATUS =
XDOMLocate(ROOT.DOM,"/soap:Envelope/soap:Body/*[1]","xmlns:soap=http://s
chemas.xmlsoap.org/soap/envelope/",RESPONSE.NODE) 
TEMP.STATUS = XDOMGetNodeName(RESPONSE.NODE,RESPONSE.TYPE) 
IF TEMP.STATUS # XML.SUCCESS THEN
  XMLACTION = "Locating Response within Message" 
  GOTO HANDLE.XML.ERROR
END
*
BEGIN CASE 
  CASE RESPONSE.TYPE = OBJ_QADATA
    OUT.DATA = "" ; OUT.DATA<RECTYPE> = RECTYPE_DATASETS 
    CHILD.NO = 0 
    LOOP 
      CHILD.NO += 1
    WHILE
XDOMLocateNode(RESPONSE.NODE,XDOM.CHILD,CHILD.NO,XDOM.ELEMENT.NODE,
CHILD.NODE) # XML.ERROR DO
      NODE.NAME = "" 
      TEMP.STATUS = XDOMGetNodeName(CHILD.NODE,NODE.NAME)
      IF NODE.NAME = OBJ_DATASET THEN
...
      END
    REPEAT
  CASE RESPONSE.TYPE = OBJ_SYSTEMINFO
...
  CASE 1

    RTN.MSG = "Unknown Message Received for processing.":@AM:IN.DATA

    RTN.STATUS = ERR_FAIL

    GOTO END.OF.PROGRAM
END CASE
*

Hope that helps...

Ray

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Symeon Breen
Sent: 22 October 2009 20:48
To: 'U2 Users List'
Subject: Re: [U2] Unidata 7.1 XDOM Support

I have never used the XDOM stuff in anger - i tend to define extraction
files and whiz through the xml using READXMLDATA etc.   We have had
problems
with namespaces in the past - it does ring a bell, i will take a look at
what our problem was.

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Kevin King
Sent: 22 October 2009 19:05
To: U2 Users List
Subject: [U2] Unidata 7.1 XDOM Support

Been spending a bit of time with Unidata 7.1 and XDOM support and I have
to
say that I'm disappointed, frustrated, and really quite concerned.

With a simple hand-constructed XML document, everything seems to work
pretty
well.  Throw any xmlns namespaces into the mix and, well, things get
butt-ugly.  In the test example, we are receiving a SOAP response with a
normal XML response.  The program holds the XML string in a variable
XML.DATA and then issues this:

STATUS = XDOMOpen(XML.DATA, XML.FROM.STRING, DOM.HANDLE)

...and everything seems to be okay.  This is then followed by:

  STATUS = XDOMLocate(DOM.HANDLE,START.NODE,'',NODE.HANDLE)

...where START.NODE is a variable containing the starting node.  This is
where things get ugly.  First, the starting node value needs a "//"
prefix,
which I see is an XPath syntax thing but the Unidata documentation say
nothing about it.  Second, for a node to be found - for whatever reason
-
there must be xmlns="" in the node.  There can be nothing between the
quotes, that doesn't work, but without the xmlns="" it's apparently
looking
to some parent name space and ... well, things don't work.  So this xml
frag
works:

<Handle xmlns="">

But this does not:

<Handle xmlns="http://....";>
...or...
<Handle>

I've tried using XDOMLocate with a full XDOM path to the node, no love.
I've tried extracting the first node in the XML document, no love.
There
are only two situations that seem to work, the first being sending in
START.NODE = "" in which case the entire document is parsed, or with
//name
in which case it'll work if the XML has been manually munged to either
remove all namespacing or to add the xmlns="" on the nodes to be
extracted.
Seems kinda wonky to have to replace something in order to allow it to
be
extracted, don't it?

I've tried different settings for the namespace variable on XDOMLocate
(which is the '' above) and nothing seems to work.  Could it be because
the
xmlns= refers to a dead URL?  Seems every time I'm in into this kind of
thing the namespace urls are dead, so it seems to be something of a
common
thing.  Could this be stopping Unidata from being able to find a
specific
node?

Clearly either I'm doing some stuff incorrectly; otherwise this is a
feature
that isn't quite fully baked.  What say ye, my genius cyberdwellers?

-Kevin
http://www.PrecisOnline.com
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users

_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to