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

Problem sending XML data using HTTP Post

  • 1.  Problem sending XML data using HTTP Post

    Posted Tue August 15, 2006 12:06 AM

    Hello,

    I have a problem sending xml data using Http post. i am getting the following error:

    1. XMLCoder decode invalid data type: com.wm.app.tn.tspace.Reservation_FileImpl
      2)XMLCoder decode invalid data type: com.wm.lang.xml.Document

    specifications:
    IS: 6.0.1

    service-in details of Http:

    url : http://servername:portname/invoke/folder/servicename
    method: Post
    data: string
    auth : suername & password
    header content-type : text/xml

    Please let me know if u have any idea about this.

    Thanks
    chags


    #webMethods
    #webmethods-Protocol-and-Transport
    #Integration-Server-and-ESB


  • 2.  RE: Problem sending XML data using HTTP Post

    Posted Tue August 15, 2006 01:46 AM

    What data is in the XML? Based on the error message it looks like objects that are not passable via XML are being used. There should really be no reason to be trying to pass the two object types listed using XML over HTTP. Can you share more about what you’re trying to accomplish?


    #webmethods-Protocol-and-Transport
    #webMethods
    #Integration-Server-and-ESB


  • 3.  RE: Problem sending XML data using HTTP Post

    Posted Tue August 15, 2006 03:21 AM

    I am trying to send the xml data to the test server and from there sending it to the AS400.
    The above errors i can see in the test server where i am trying to send the xml data.

    Thanks
    Nipun


    #webMethods
    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport


  • 4.  RE: Problem sending XML data using HTTP Post

    Posted Tue August 15, 2006 04:06 AM

    Nipun,

    What is your invoking service input type?? It should be node(object)…
    XMLNodeToDocument (as first step of the service)

    Also make sure your xml is wellformed xml string.

    HTH,
    RMG


    #Integration-Server-and-ESB
    #webMethods
    #webmethods-Protocol-and-Transport


  • 5.  RE: Problem sending XML data using HTTP Post

    Posted Tue August 15, 2006 04:09 AM

    hello,

    the input that i am using in the test server where i am sending the data is node (object).
    the error i am getting now:

    Copy failed: No source data available: to=/bytes, from=/node

    Thanks,
    chags


    #webmethods-Protocol-and-Transport
    #webMethods
    #Integration-Server-and-ESB


  • 6.  RE: Problem sending XML data using HTTP Post

    Posted Tue August 15, 2006 05:11 AM

    One more time: “What data is in the XML?”
    Please post the XML that you’re having trouble with.


    #webMethods
    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport


  • 7.  RE: Problem sending XML data using HTTP Post

    Posted Tue August 15, 2006 07:21 PM

    Hello,

    Problem resolved. Since we were getting large files i had this problem sending the data using HTTPPost. I have used node iterator and have send each node using HTTP to my test server. Everything works fine now.

    Thanks a lot for your help.

    chags


    #webMethods
    #webmethods-Protocol-and-Transport
    #Integration-Server-and-ESB


  • 8.  RE: Problem sending XML data using HTTP Post

    Posted Tue August 15, 2006 08:01 PM

    Uh!! largefile,you are in right track with nodeiterator,getnextnode etc…

    Glad it know it worked.

    HTH,
    RMG


    #webMethods
    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport


  • 9.  RE: Problem sending XML data using HTTP Post

    Posted Tue September 12, 2006 08:22 PM

    Did you ever fix this? I’m have the same issue.


    #Integration-Server-and-ESB
    #webMethods
    #webmethods-Protocol-and-Transport


  • 10.  RE: Problem sending XML data using HTTP Post

    Posted Tue September 12, 2006 08:59 PM

    Yes i did… let me know what is the exact problem that you are facing.


    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport
    #webMethods


  • 11.  RE: Problem sending XML data using HTTP Post

    Posted Tue September 12, 2006 09:17 PM

    I’m using pub.client.http to send xml from one service (service1) to another (service2).

    Service1 simply takes and an xml file and sends it to service2.
    pub.client.http variables are set as follows:
    url=http://localhost:5555/invoke/test.folder/testSvc
    method=post
    loadAs=bytes
    Content-Type=text/xml
    user=Administrator
    pass=manage

    After the call, I get a 403 response. Looking at the server log I see “Copy failed: No source data available: to=/node, from=/input”

    Service2 has a node (input) as the input. It takes input and does a xmlNodeToDocument. That’s where the exception is triggered, but it seems like service2 never successfully gets in the input.

    I get the same error if I test service2 through the browser. It works if I do an inline call from service1 to service2 and if I test it through developer/Test/SendXMLFile. But, I’m testing functionality so I really need to use http.

    My test data looks like this:

    <?xml version="1.0" encoding="UTF-8"?> 1 1111 1867 george washington 5555555555

    Thanks for you help.


    #webMethods
    #webmethods-Protocol-and-Transport
    #Integration-Server-and-ESB


  • 12.  RE: Problem sending XML data using HTTP Post

    Posted Wed September 13, 2006 12:00 AM

    If it is a large file then there is a problem with HTTP service, so I wrote the xml to a file using writetofile service and then called this xmlfile using [FONT=ArialNarrow,Bold][SIZE=4]

    pub.xml:loadXMLNode service.

    [/size][/font][FONT=ArialNarrow,Bold][SIZE=4]

    [LEFT]
    Or second option: You can use XML node iterator and send each node at one time to the 2nd service using HTTP. You can get a sample package in wmusers how to use node iterator.[/size][/font]

    Thanks
    Chags
    [/LEFT]


    #Integration-Server-and-ESB
    #webMethods
    #webmethods-Protocol-and-Transport


  • 13.  RE: Problem sending XML data using HTTP Post

    Posted Wed September 13, 2006 02:25 AM

    Why are you using an HTTP post to send an XML file from one Flow service to another? This is not necessary. If you need to test service2 by sending an XML file use Developer’s Test->Send XML File menu option to do this.

    Mark


    #webmethods-Protocol-and-Transport
    #webMethods
    #Integration-Server-and-ESB


  • 14.  RE: Problem sending XML data using HTTP Post

    Posted Wed September 13, 2006 04:33 AM

    I’m just testing functionality. I’m having each simulate an external system. Eventually, one service will send a request to an external system and expect a response in the same session. The other will receive a request from an external system and send a response in the same session. Basically, I’m just using the flow services to test each other. However, if I can’t get them to work together, then I don’t have much hope of being able to interface with the external systems.


    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport
    #webMethods


  • 15.  RE: Problem sending XML data using HTTP Post

    Posted Wed September 13, 2006 05:15 AM

    This is pretty basic stuff and is covered in the built-in services guide for pub.client:http as well as some references on sending XML to a service in the Developer’s guide.

    How are you mapping your XML doc into the pub.client:http service? Did you choose “text/xml” as the content type?

    This works every time if done correctly.

    Mark


    #webmethods-Protocol-and-Transport
    #webMethods
    #Integration-Server-and-ESB


  • 16.  RE: Problem sending XML data using HTTP Post

    Posted Wed September 13, 2006 06:24 AM

    Yeah, I know it’s basic. That’s why I was so frustrated. I poured over both documents multiple times before I submitted my issue.

    It wasn’t until I stumbed across this obscure little line in the documentation that I finally got it to work.

    “When you submit the XML document, place an extra carriage return/new line
    (\r\n) at the end of it to indicate the end of the XML document.”

    Thanks guys for all the help. I appreciate it.


    #webMethods
    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport


  • 17.  RE: Problem sending XML data using HTTP Post

    Posted Wed September 13, 2006 08:39 PM

    The problem continues…

    If I hard code the xml and the \r\n into xmldata and then map xmldata to the data/string input of pub.client.http everything works fine. But, since this is hardcoding the input, I can’t do this.

    However, if I use variable substitution (%xmldata%\r\n), pub.string.concat, or pub.string.makeString, it stops working.

    I’ve already searched this site, the built-in services docs, developer docs, etc.

    Format 1 – works

    <?xml version="1.0" encoding="UTF-8"?> 1 1111 1867 george washington 5555555555 \r\n

    Format 2 (string substitution turn on) – doesn’t work

    %xmldata%\r\n

    With either format I use, the pipeline values looks the same, so I’m guessing wm does something different in the special characters that I can’t see.

    Thanks in advance for your help.


    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport
    #webMethods


  • 18.  RE: Problem sending XML data using HTTP Post

    Posted Thu September 14, 2006 01:35 AM

    I experimented with this issue by writing two pairs of services:

    tryHttpPost —> receiveHttpPost
    and
    tryHttpGet —> receiveHttpGet

    The try version sends an xml string to the receive version. Both work ok.

    Further, I tested the receive services by mean of a browser (url for GET, and a form for POST). Both receivers worked ok.

    The services are simple, but too difficult to explain in this thread. I have attached the packages to this thread.

    The packages’ pub folder contains html files that can be used to run the receive services via a browser. The services can also be run with Developer.
    tryHttpGet.zip (9.99 KB)
    tryHttpPost.zip (10 KB)


    #webMethods
    #webmethods-Protocol-and-Transport
    #Integration-Server-and-ESB


  • 19.  RE: Problem sending XML data using HTTP Post

    Posted Thu September 14, 2006 06:34 PM

    ladson,

    Thanks for your help.

    I’m doing almost the exact same thing as you. If I start with the tryHttpPost, everthing works fine. However, if I call tryHttpPost from another service and the data happens to have been in a node or document at one point it doesn’t work.

    Please take a look at my small project. Use the starter as the entry point and see what results you get.

    I’ve included the export and the xsd for the doc.

    Thanks
    httpTest.zip (13.2 KB)
    testDoc.zip (436 Bytes)


    #webMethods
    #webmethods-Protocol-and-Transport
    #Integration-Server-and-ESB


  • 20.  RE: Problem sending XML data using HTTP Post

    Posted Fri September 15, 2006 08:02 PM

    I added a service called preStarter which calls starter with a node as input. It appears to work ok. I also renamed your document type from testDoc to testDocWrapper, to avoid confusion between the doc type (originally testDoc)and its top level element (also testDoc)

    I think you may have been confused by the nesting of the doc (at least I was).

    The debug log looks like this (note, I also changed the server to localhost):

     2006-09-15 14:19:41 EDT [ISP.0090.0003C] starter is about to send : <?xml version="1.0"?>
    <testDoc>
    <uniqueID>myUniqueID</uniqueID>
    <senderID>mySenderID</senderID>
    <receiverID>myReceiverID</receiverID>
    <data>
    <firstName>myFirstName</firstName>
    <lastName>myLastName</lastName>
    <homePhone>myHomePhone</homePhone>
    </data>
    </testDoc>
    2006-09-15 14:19:41 EDT [ISP.0090.0003C] httpPost is about to send xmldata=<?xml version="1.0"?>
    <testDoc>
    <uniqueID>myUniqueID</uniqueID>
    <senderID>mySenderID</senderID>
    <receiverID>myReceiverID</receiverID>
    <data>
    <firstName>myFirstName</firstName>
    <lastName>myLastName</lastName>
    <homePhone>myHomePhone</homePhone>
    </data>
    </testDoc>
    2006-09-15 14:19:41 EDT [ISP.0090.0003C] receiveHttpPost got : <?xml version="1.0"?>
    <testDoc>
    <uniqueID>myUniqueID</uniqueID>
    <senderID>mySenderID</senderID>
    <receiverID>myReceiverID</receiverID>
    <data>
    <firstName>myFirstName</firstName>
    <lastName>myLastName</lastName>
    <homePhone>myHomePhone</homePhone>
    </data>
    </testDoc>
    2006-09-15 14:19:41 EDT [ISP.0090.0003C] receiveHttpPost response : <?xml version="1.0"?>
    <testDoc>
    <uniqueID>myUniqueID</uniqueID>
    <senderID>myReceiverID</senderID>
    <receiverID>mySenderID</receiverID>
    <data>
    <firstName>myLastName</firstName>
    <lastName>myFirstName</lastName>
    <homePhone>myHomePhone</homePhone>
    </data>
    </testDoc>
    2006-09-15 14:19:41 EDT [ISP.0090.0003C] httpPost response : <?xml version="1.0"?>
    <testDoc>
    <uniqueID>myUniqueID</uniqueID>
    <senderID>myReceiverID</senderID>
    <receiverID>mySenderID</receiverID>
    <data>
    <firstName>myLastName</firstName>
    <lastName>myFirstName</lastName>
    <homePhone>myHomePhone</homePhone>
    </data>
    </testDoc>

    I hope this helps.
    httpTest2.zip (16.2 KB)


    #webMethods
    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport


  • 21.  RE: Problem sending XML data using HTTP Post

    Posted Thu October 07, 2010 07:22 PM

    Hi , i have one doubt in pub.client.http can we directly post xml or i have to convert it to byte or String .
    the following Input is enough:-
    url : http://servername:portname/invoke/folder/servicename
    method: Post
    data: string
    auth : suername & password
    header content-type : text/xml

    Please reply soon as its urgent

    Thanks in advance


    #webmethods-Protocol-and-Transport
    #Integration-Server-and-ESB
    #webMethods


  • 22.  RE: Problem sending XML data using HTTP Post

    Posted Fri October 08, 2010 06:30 PM

    “can we directly post xml or i have to convert it to byte or String”–>Yes you can send anyways like map data/string (xmldata) or convert xmldata to bytes or stream (large files) types.

    P.S:Make sure the invoking service input is Node (object) for parsing/down stream processing…

    HTH,
    RMG


    #webmethods-Protocol-and-Transport
    #webMethods
    #Integration-Server-and-ESB


  • 23.  RE: Problem sending XML data using HTTP Post

    Posted Mon November 08, 2010 07:07 PM

    Hi ALL,

    Which path is better to send xml data to TP:

    1)by using EDINT:send to TN and then from TN to TP
    2)By using the pub.client:http

    Encryption and signature validation is also required.

    Thanks in advance
    Abhishek


    #webMethods
    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport


  • 24.  RE: Problem sending XML data using HTTP Post

    Posted Fri November 19, 2010 12:02 AM

    Is your requirement to use Encryption and signature validation to TN? or out to the TP?

    Both can be used to send to your TP from TN. Encryption and signature validation are handled by both. AS2 requires a bit more service code handling.


    #webmethods-Protocol-and-Transport
    #webMethods
    #Integration-Server-and-ESB