http post to webMethods [IS]

We are trying to create a java web application that posts to a webMethods flow. We were successfully posting to a flow when we append the name/value pairs as part of the url. The problem we found is when the data is too long, we are getting a 414 error.

We are trying to do the post with the data as part of body but are having difficulty with webMethods seeing the inbound name/value pairs. (We have content-type set to “text/xml”.) Can anyone show me some sample java code that successfully posts to a webMethods flow where the data being posted is contained in the body?

There are couple of examples on the forums here that demonstrate how to post to Integration Server using Java. Use the search facilities to find them. If you use text/xml as the content-type, then you don’t want the body to be name/value pairs. The body will need to be XML. If you really want to post name/value pairs, you’ll need to use a different content-type although I can’t remember exactly which one off the top of my head. Perhaps someone else can provide that answer?

Thanks. I did look around for some examples none jumped out at me. Interesting about “text/xml”, I thought that was a requirement on a post into wM.

Integration Server (not wM or webMethods–webMethods is a company, not product) can accept data in a number of different ways. Name/value pairs is simply one of them. It excels in working with XML–that’s its main strength.

Search using the terms http post java and you’ll get some hits. Here’s one.

Thanks. We were able to get it working. Content-Type was the key. We needed to set it to “application/x-www-form-urlencoded”.

Snolan,

Be careful with just setting the content-type to to something that “Works!” without knowing the implications. For example, if you set the content-type to application/x-www-form-urlencoded, one of the things that you’re telling the receiver is that your data is “URL-encoded.” Therefore, if you do not URL encode it and you happen to have a special character within the data (example, &), you will most likely run into an error.

Like Rob was saying, if all you want to do is to post an XML message to a Flow service from a Java application, then set your content-type to “text/xml” and send the XML in the body of the HTTP POST request. The IS content handler will then pass the XML as an XML node to your Flow service.

  • Percio