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.

 View Only
Expand all | Collapse all

returning xml document (complete) as string from web service

  • 1.  returning xml document (complete) as string from web service

    Posted Thu December 27, 2007 02:36 PM

    Greetings. I am fairly new to webMethods and have what I suspect is a really simple problem -
    only I haven’t come across the solution in any of the documentation I have read so far.
    One of the requirements for the project that I am working on is to provide a
    webService that takes and Xml Document as the input parameter and returns an
    XmlDocument e.g. CreateOrder in OrderResponse out. It seemed fairly simple so
    I ran off an created an entire flow complete with underlying business rules
    only to find that the when calling the webservice I was not getting what I
    expected back. In order to get a better idea of what was going on I decided
    to create a simple proof of concept that took as an input a string (xmlIn)
    and returned a string as an output (xmlOut).
    In this POC the outPut should be exactly what was passed in, obviously this would not be the case in reality.
    When I call this webService and pass in any string like “The cat in the Hat.”
    everything works fine. However, if I pass a simple xml document as a string
    the calling application barfs (.Net).
    string xyz = “<?xml version='1.0' encoding='utf-8'?><Message source=‘String’” +
    “target=‘String’ type=‘CWCreateOrder’ >”;
    The first error is from duplicate document declarations - so the flow has been modified to remove

    <?xml version='1.0' encoding='utf-8'?> from the returning string. At this point the output should

    consist of only <Message source='String’target=‘String’ type=‘CWCreateOrder’ >. In the flow I have
    a series of debugLog services that dump the variables values so I know that all is working as it should
    within the flow.
    If I keep the output from the service as a string the web service client continues to error out. When I change it
    to an object all works fine. Except that I get a XmlNode array back. So in order to get the value I need to cast
    the object and iterate the array ( length of 1)
    string s = string.Empty;
    foreach (System.Xml.XmlNode n in (System.Xml.XmlNode)obj)
    s += n.OuterXml;
    I also created a java client using NetBeans to see what, if any differences
    are related to .net vs java in calling webMethods web services. With NetBeans I get “Access Denied”
    error at runtime.
    So this is a long winded of asking 2 simple questions:

    1. Why is it that string containing xml data is not treated as a string when returning from a webservice?
    2. Does anyone know how the ACL needs to be set up for a NetBeans Client. For .Net I had to change ExecuteACL to
      Annonymous.
      Any insights would be greatly appreciated,
      l

    #API-Management
    #soa
    #webMethods


  • 2.  RE: returning xml document (complete) as string from web service

    Posted Thu December 27, 2007 09:29 PM

    Soap Binding Style = rpc
    Soap Binding Use = encoded

    NetBeans ACL
    Read = Annonymous
    Execute = Annonymous


    #soa
    #webMethods
    #API-Management


  • 3.  RE: returning xml document (complete) as string from web service

    Posted Sat December 29, 2007 12:04 AM

    I’m on the road so this will be brief. Don’t send XML inside a text variable. That is not a web service or at least not a good one. Instead, set the input of your Flow to a doc type.

    Check out the examples in the “sticky” threads in this forum.

    Mark


    #webMethods
    #soa
    #API-Management