IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.


#TechXchangePresenter
 View Only
  • 1.  Why getNextXMLNode returns null?

    Posted Tue August 14, 2007 12:13 AM

    When I view my xmlNode in queryXMLNode variable tab, I get:

    soap:Body
    prefix1:ABC
    attr_a
    comment_a
    prefix1:element_a
    prefix1:element_b
    prefix1:element_c
    and so on…

    Question 1:
    I am trying to loop thru the node to get the data. I create the Iterator with getXMLIterator, without any criteria. The first time I call getNextXMLNode, I get back null. Why am I not getting element ABC back in the 1st round?

    Question 2:
    prefix1 is added automatically by webMethods because there is a default namespace (xmlns=urn:something, with no prefix) defined in element ABC. Does it do any damage?

    I have been seeing a lot of issues related to namespace. Is 6.5 SP2 the latest? Is there a later sp to fix some of these issues?

    Please help.

    Thanks.


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 2.  RE: Why getNextXMLNode returns null?

    Posted Tue August 14, 2007 02:31 PM

    The XML namespace and prefix “issues” that we’ve seen here on wMUsers lately have not been related to software defects, but rather to inexperience with IS and with XML in general.

    Are you providing an XQL query when you create your Iterator? If so, what is the query?

    Mark


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 3.  RE: Why getNextXMLNode returns null?

    Posted Tue August 14, 2007 03:56 PM

    soap:Body
    ----prefix1:ABC
    ----attr_a
    --------comment_a
    --------prefix1:element_a
    --------prefix1:element_b
    --------prefix1:element_c
    --------and so on…

    I see the above structure in queryXMLNode (I only use the query window to see the structure, not to do any actual query). The node was obtained from getBody of a soap request. In order to loop thru the loop, I passed body to node when invoking getXMLIterator. All other parameters were left as default. Then I called getNextXMLNode, expecting to get ABC back as a node. But instead, I got null value.

    Please advise what I did wrong.
    :sad:


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 4.  RE: Why getNextXMLNode returns null?

    Posted Tue August 14, 2007 06:48 PM

    I think something may be wrong with the SOAP request you are attempting to process.

    I used the following request, extracted the body and then passed that to getXMLIterator followed by getNextXMLNode. That service returned a node name of “ns1:CreateOrderRequest” which is the expected behavior.

    Mark


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 5.  RE: Why getNextXMLNode returns null?

    Posted Tue August 14, 2007 07:28 PM

    I don’t rule out the possibility that something’s wrong with my SOAP request. However, I don’t have enough experience to conclude that to the Request sender. Perhaps you could help with your expertise.

    Comparing with your SOAP request, mine is different in the following ways:

    1. my request uses prefix soap:, yours use prefix SOAP-ENV:. I have a feeling wm likes SOAP-ENV but not sure if wm is OK with others as well even though it likes SOAP-ENV. My request sender refuses to make it SOAP-ENV.

    2. xmlns:SOAP-ENC=… is missing in mine. However, in my request, there is no reference to SOAP-ENC. Not sure if this is OK to omit SOAP-ENC if it is not referenced anyway?

    3. My request Envelope does not have namespaces xmlns:xsd and xmlns:xsi. Instead, xmlns:xsi is defined in the Root element of the body. But even though I prefer your way, it is still a valid soap request to do put them in Body root element, right?

    4. Your request uses explicit ns as xmlns:ns1=“urn:…”. in the Root element of your body. Mine uses default ns as xmlns=“urn:…” in the Root element of my body. I am having problem using XQL in queryXMLNode when referring to elements by name (but OK with WQL). However, default ns is a valid XML syntax and I don’t think my request sender will change this. If it causes problem in XQL queries, I can work around with WQL. But not sure if default ns is also causing problem in XMLNodeIterator.

    Please advise if the above differences are acceptable to a valid SOAP request or not.:confused:


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 6.  RE: Why getNextXMLNode returns null?

    Posted Tue August 14, 2007 07:38 PM

    If you can remove any confidential information and post a sample request, I’ll take a look.

    Differences in prefixes should never matter so long as the namespaces are defined correctly. I would assume that your service consumer is sending a valid soap envelope. What WSDL did they use to generate the request? If possible, please attach.

    A web services testing tool might come in handy as it would allow you to use a WSDL to generate a valid request or allow you to quickly send a sample request to your IS using a “literal XML” view. I like the free, personal edition of SOAP Sonar, but there are other similar tools that may also do the trick.

    IMHO, not using a (good) tool to test your web services is asking your service consumers to do your testing for you.

    Also, what happens when you do not use a xmlNodeIterator and simply do a xmlNodeToDocument instead?

    Mark


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 7.  RE: Why getNextXMLNode returns null?

    Posted Tue August 14, 2007 10:01 PM

    Hi,
    Finally, I have got it working. All I need is to define nsDecls for getXMLIterator, giving a prefix to the default ns. It will return next\name based on whatever prefix I set in nsDecls and ignors the original prefix in the incoming xml.

    I am finding this very flexible so that I don’t have to care if 10 different people send me request with 10 different prefix of their own. I can override with my own in nsDecls.

    Thanks for everybody’s help.


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 8.  RE: Why getNextXMLNode returns null?

    Posted Wed August 15, 2007 01:23 AM

    Yes, that is exactly the purpose of the “nsDecls” parameter. Use it wisely, use it often. :slight_smile:

    Mark


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services