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

"HTTP POST" XML cannot see node object in service

  • 1.  "HTTP POST" XML cannot see node object in service

    Posted Tue May 23, 2006 05:18 PM

    I am http posing a XML with content-type:“text/xml”; however, I cannot see the node object in service.

    I see an input name as “<?xml version”, value is the rest of the xml string.

    I use httpWebRequest from .net

    thanks for help.

    Shuren


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


  • 2.  RE: "HTTP POST" XML cannot see node object in service

    Posted Tue May 23, 2006 07:06 PM

    What variable are you seeing in the service pipeline? Are you seeing $xmldata? Put a savepipeline at the first step and restore it to debug the pipeline.

    If .net http posts xml with “text/xml” definetely you should see the *node object in the pipeline,this is standard notation.

    HTH,
    RMG


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


  • 3.  RE: "HTTP POST" XML cannot see node object in service

    Posted Tue May 23, 2006 11:49 PM

    rmg,

    Thanks for your reply. I already setup content-type=text/xml for HttpWebRequest.

    I didn’t see the node object, that is my problem.
    Also, after I add web reference by wsdl, there is no service name in proxy cs file, just a null class name, which means, I post xml without using wsdl.

    I may ask you a question first, what the input should be, I only setup object ‘node’ as input. Do I need to put the document as input siganature?

    As I know, for SOAP-MSG, I cannot put other parameter in input siganature.

    Regards,

    Shuren


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


  • 4.  RE: "HTTP POST" XML cannot see node object in service

    Posted Thu June 01, 2006 09:34 AM

    You can directly post your XML to webMethods service through HTTP.

    when your content-type = text/xml in the http header. webMethods content handler will convert the xml into node object and it will be available in your flow service.


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


  • 5.  RE: "HTTP POST" XML cannot see node object in service

    Posted Thu June 01, 2006 02:59 PM

    I tried, but i cannot see the node.

    Shuren


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


  • 6.  RE: "HTTP POST" XML cannot see node object in service

    Posted Thu June 01, 2006 05:24 PM

    Can you post the snippet of code you’re using to do the http post?


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


  • 7.  RE: "HTTP POST" XML cannot see node object in service

    Posted Thu June 01, 2006 06:55 PM

    here is the client side code from .net

    ==================================================
    [highlight=c#]
    messageBody = “<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap="[url=“http://schemas.xmlsoap.org/soap/envelope/\”]http://schemas.xmlsoap.org/soap/envelope/\[/url]” xmlns:xsi="[url=“http://www.w3.org/2001/XMLSchema-instance\”]http://www.w3.org/2001/XMLSchema-instance\[/url]" xmlns:xsd="soap:Body<ServiceAdd">XML Schema">soap:Body<ServiceAdd xmlns="fe:FeWebServiceExample.SOAP_MSG.flow"><num1 xmlns="">123<num2 xmlns="">456</soap:Body></soap:Envelope>";

    HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(“[url=“http://montreappwmd01:5555/invoke/HTTP_POST.flow/srvHttpPostAdd”]http://montreappwmd01:5555/invoke/HTTP_POST.flow/srvHttpPostAdd[/url]”);

    webRequest.Method = “POST”;

    webRequest.ContentLength = messageBody.Length;
    messageBytes = Encoding.UTF8.GetBytes(messageBody);

    Stream requestStream = webRequest.GetRequestStream();
    requestStream.Write(messageBytes,0,messageBytes.Length);
    HttpWebResponse webResponse =null;
    Stream responseStream = null;
    webRequest.ContentType = “text/xml; charset=utf-8”;

    try
    {
    webResponse = (HttpWebResponse)webRequest.GetResponse();
    }
    [/highlight]


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


  • 8.  RE: "HTTP POST" XML cannot see node object in service

    Posted Thu June 01, 2006 09:01 PM

    Set the ContentType before getting the request stream–move line 15 up before line 11.

    You don’t show a requestStream.close() so you’ll want to make sure you add that in if you don’t have that call.


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


  • 9.  RE: "HTTP POST" XML cannot see node object in service

    Posted Fri June 02, 2006 04:42 PM

    if I set the ContentType before getting the request stream,
    the file I get from SavePipelineToFile is:


     <?xml version="1.0" encoding="UTF-8"?>
    <IDataXMLCoder version="1.0">
    <record javaclass="com.wm.util.Values">
    <value name="fileName">addHTTPPost</value>
    </record>
    </IDataXMLCoder>

    if I set the ContentType after getting the request stream,
    the file I get from SavePipelineToFile is:


     <?xml version="1.0" encoding="UTF-8"?>
    <IDataXMLCoder version="1.0">
    <record javaclass="com.wm.util.Values">
    <value name="fileName">addHTTPPost</value>
    <value name="<?xml version">"1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="[URL="http://schemas.xmlsoap.org/soap/envelope/"]http://schemas.xmlsoap.org/soap/envelope/[/URL]" xmlns:xsi="[URL="http://www.w3.org/2001/XMLSchema-instance"]http://www.w3.org/2001/XMLSchema-instance[/URL]" xmlns:xsd="<A href="http://www.w3.org/2001/XMLSchema"><soap:Body><ServiceAdd">http://www.w3.org/2001/XMLSchema"><soap:Body><ServiceAdd xmlns="fe:FeWebServiceExample.SOAP_MSG.flow"><num1 xmlns="">100.6</num1><num2 xmlns="">200.5</num2></ServiceAdd></soap:Body></soap:Envelope></value>
    <array name="<?xml versionList" type="value" depth="1">
    <value>"1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="[URL="http://schemas.xmlsoap.org/soap/envelope/"]http://schemas.xmlsoap.org/soap/envelope/[/URL]" xmlns:xsi="[URL="http://www.w3.org/2001/XMLSchema-instance"]http://www.w3.org/2001/XMLSchema-instance[/URL]" xmlns:xsd="<A href="http://www.w3.org/2001/XMLSchema"><soap:Body><ServiceAdd">http://www.w3.org/2001/XMLSchema"><soap:Body><ServiceAdd xmlns="fe:FeWebServiceExample.SOAP_MSG.flow"><num1 xmlns="">100.6</num1><num2 xmlns="">200.5</num2></ServiceAdd></soap:Body></soap:Envelope></value>
    </array>
    </record>
    </IDataXMLCoder>

    that is why I put it after streaming.

    Shuren


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


  • 10.  RE: "HTTP POST" XML cannot see node object in service

    Posted Fri June 02, 2006 05:07 PM

    The reason the second approach gets more data is because the content-type is the default (can’t remember the exact name) which causes IS to treat the data as name/value pairs–which is exactly what you’re seeing in the pipeline.

    The content-type must be set before getting the request stream. I believe the problem is with the messageBody string such that IS cannot parse it properly. Does your code check the response that IS returns? Is there an error returned?

    Can you post the string again and make sure that what is posted matches exactly what is in your code? It looks like the forum software munged your earlier post by converting parts of the string to URL references. Can you try it by using a very simple XML string which avoids namespaces?


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


  • 11.  RE: "HTTP POST" XML cannot see node object in service

    Posted Fri June 02, 2006 06:30 PM

    ***********************************************

     messageBody = "<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><soap:Body><ServiceAdd xmlns=\"fe:FeWebServiceExample.SOAP_MSG.flow\"><num1 xmlns=\"\">100.6</num1><num2 xmlns=\"\">200.5</num2></ServiceAdd></soap:Body></soap:Envelope>";

    [SIZE=2]


    File saved in pipeline is (tag characters are encoded automatically as is):


    [/size]

     <?xml version="1.0" encoding="UTF-8"?>
    <IDataXMLCoder version="1.0">
    <record javaclass="com.wm.util.Values">
    <value name="fileName">addHTTPPost</value>
    <value name="<?xml version">"1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="[URL="http://schemas.xmlsoap.org/soap/envelope/"]http://schemas.xmlsoap.org/soap/envelope/[/URL]" xmlns:xsi="[URL="http://www.w3.org/2001/XMLSchema-instance"]http://www.w3.org/2001/XMLSchema-instance[/URL]" xmlns:xsd="<A href="http://www.w3.org/2001/XMLSchema"><soap:Body><ServiceAdd">http://www.w3.org/2001/XMLSchema"><soap:Body><ServiceAdd xmlns="fe:FeWebServiceExample.SOAP_MSG.flow"><num1 xmlns="">100.6</num1><num2 xmlns="">200.5</num2></ServiceAdd></soap:Body></soap:Envelope></value>
    <array name="<?xml versionList" type="value" depth="1">
    <value>"1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="[URL="http://schemas.xmlsoap.org/soap/envelope/"]http://schemas.xmlsoap.org/soap/envelope/[/URL]" xmlns:xsi="[URL="http://www.w3.org/2001/XMLSchema-instance"]http://www.w3.org/2001/XMLSchema-instance[/URL]" xmlns:xsd="<A href="http://www.w3.org/2001/XMLSchema"><soap:Body><ServiceAdd">http://www.w3.org/2001/XMLSchema"><soap:Body><ServiceAdd xmlns="fe:FeWebServiceExample.SOAP_MSG.flow"><num1 xmlns="">100.6</num1><num2 xmlns="">200.5</num2></ServiceAdd></soap:Body></soap:Envelope></value>
    </array>
    </record>
    </IDataXMLCoder>

    [SIZE=2]


    [/size]


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


  • 12.  RE: "HTTP POST" XML cannot see node object in service

    Posted Fri June 02, 2006 06:46 PM

    Put the content type before getting the request stream. The node object is not persistable–it isn’t saved when you do a savepipelinetofile so you will never see it when you restorepipelinefromfile. Call pub.xml:xmlNodeToDocument in the service that is invoked and you should see your doc. The resulting doc can be saved with savepipelinetofile.


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


  • 13.  RE: "HTTP POST" XML cannot see node object in service

    Posted Fri June 02, 2006 07:55 PM

    It doesn’t work.
    I attached the pics before and after call pub.xml:xmlNodeToDocument

    Shuren


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


  • 14.  RE: "HTTP POST" XML cannot see node object in service

    Posted Fri June 02, 2006 08:06 PM

    You cannot use restorePipelineFromFile. It will never work. The node object is not saved with savePipelineToFile. Disable the call to restorePipelineFromFile. Do a SavePipelineToFile AFTER the call pub.xml:xmlNodeToDocument. Then run your program that does the post. Then run restorePipelineFromFile separately to see if the document made it.


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


  • 15.  RE: "HTTP POST" XML cannot see node object in service

    Posted Fri June 02, 2006 08:20 PM

    It works!!! Thanks Reamon. You are great!
    I see the DOCUMENT!

    So, actually, no way to see the ‘node’, right?

    Thanks lot

    Shuren


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


  • 16.  RE: "HTTP POST" XML cannot see node object in service

    Posted Fri June 02, 2006 08:51 PM

    Correct. The node is a Java object that cannot be viewed within Developer and has not been made serializable/saveable to work with the save/restorepipeline services. You’ll find this to be the case with virtually all Java objects within IS.


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


  • 17.  RE: "HTTP POST" XML cannot see node object in service

    Posted Fri June 02, 2006 08:59 PM

    one more dig.

    When I work on SOAP-MSG, the input/output has to be soapRequestData and soapResponseData object. However, I can call SavePipelineToFile at the top line, and I can see the soapRequestData, which is a string format. I hava to convert it to soap object though, I can see it at least.

    So, what is the difference between ‘node’ in HTTPPOST and ‘soapRequestData’ in SOAP-MSG?

    Shuren


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


  • 18.  RE: "HTTP POST" XML cannot see node object in service

    Posted Fri June 02, 2006 11:01 PM

    SOAP messages take a different path. The URL used for SOAP directs the document to a different processor, which converts the document to soapRequestData before calling your service.


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