Help not receive xml data from a jsp

I have a client sending xml data via a jsp to one of my flow services which takes this xml string as an input and does the rest of processing.

The jsp client uses http post and simply sends the xml data over to this receiving service. But I am getting this error:

java.lang.Exception: missing required parameter ‘document’

com.wm.app.b2b.server.ServiceException: java.lang.Exception: missing required parameter ‘document’ at pub.xml.documentToXMLString(xml.java:643) at java.lang.reflect.Method.invoke(Native Method) at com.wm.app.b2b.server.JavaService.baseInvoke(JavaService.java:287) at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:339) at com.wm.app.b2b.server.BaseService.invoke(BaseService.java:153) at com.wm.lang.flow.FlowInvoke.invoke(FlowInvoke.java:324) at com.wm.lang.flow.FlowState.invokeNode(FlowState.java:577) at com.wm.lang.flow.FlowState.step(FlowState.java:435) at com.wm.lang.flow.FlowState.invoke(FlowState.java:400) at com.wm.app.b2b.server.FlowSvcImpl.baseInvoke(FlowSvcImpl.java:1738) at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:339) at com.wm.app.b2b.server.BaseService.invoke(BaseService.java:153) at com.wm.lang.flow.FlowInvoke.invoke(FlowInvoke.java:324) at com.wm.lang.flow.FlowState.invokeNode(FlowState.java:577) at com.wm.lang.flow.FlowState.step(FlowState.java:435) at com.wm.lang.flow.FlowState.invoke(FlowState.java:400) at com.wm.app.b2b.server.FlowSvcImpl.baseInvoke(FlowSvcImpl.java:1738) at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:339) at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:119) at com.wm.app.b2b.server.HTTPInvokeHandler._process(HTTPInvokeHandler.java:113) at com.wm.app.b2b.server.InvokeHandler.process(InvokeHandler.java:113) at com.wm.app.b2b.server.Dispatch.run(Dispatch.java:203) at com.wm.util.pool.PooledThread.run(PooledThread.java:105) at java.lang.Thread.run(Unknown Source)


the input for this service is simply an xml string, and how can I make this service to take this xml string as the value of xmldata?

Thanks a lot.

J-

You’ll have to be more clear with your question. If the jsp page’s form action submits directly to wm you won’t be able to do a pure POST since you can’t set the content-type to text/xml. If your form submits to a jsp which then forwards the request to webMethods, make sure your jsp code sets the http header content-type to text/xml. A simpler way is to use a name value pair so make sure the form field which has your XML file has a name equal to $xmldata. This is all documented in the ISXML guide.

Jake,

The error seems to indicate that your flow step “documentToXMLString” does not have any data for the “document” parameter.

I agree with Will in that we will need more information to help you. One thing that might help is if you tell us what flow steps you are using. With that said, the take and XML string as the value of xmldata, I would use the stringToDocument service and pass the name of your XML string from the ASP page to it as xmldata. Be sure to set the isXML field to yes when using this service.

hope this helps,

ajandja

it is not a http form post but a http post of xml data to a service, therefore it doesn’t have form variable and simply an xml string.
This is a little bit different from the IS XML guide.

Thanks, Andrew and Will.

Here is the service:

xmlNodeToDocument
documentToXMLString

Say, a servlet does a http post of an xml string to this service, I got the error message above…since webMethods doesn’t recognize this incoming xml string is a valid webMethods document; therefore document is not populated at all. But when I tested with an xml file, it works fine. I assume the senders send xml data in different ways. Please advise. Thanks,

J-

Jake,

I was trying to ascertain whether you were submitting from the web page or from jsp/servlet (ie. from code). Since you’re using code you have 2 options - if you’re doing a POST, make sure you set the content-type to text/xml (you have to set the http header using the java API) OR do an HTTP GET and set a name value pair request attribute of $xmldata and your string value. webMethods can’t automatically convert the input into a node (which your service expects) unless you set the content-type. I think it’s the same as what’s in the docs.

Thanks, Will.

The content-type is set to text/xml already. We are trying to standardize the way of xml messaging on data transport layer instead of posting data using nam/value pairs. Although I know for sure, using name/value pair would work as expected. Currently since the xml data is posted as an xml string alone, I am expecting a content handler to pick up the incoming data automatically. Obviously, I am not seeing any service available to handle this. If I miss something, pls correct me.

Thanks,

J-

Jake,
Here is how i’ve done it in past… b4 we go any further my understanding is “a java client does a http post (Not form submit) of xml content to a service, http header content type is set to text/xml”

java client will http post xml content to myService

->myService (node object as input)
->documentToRecord(node object as input and output is boundNode)
->recordToDocument(boundNode as input and xmlData string as output)

by now, i’ve got the xml string in my pipeline, i can process it the way i want

HTH

DG

Jake,

A XML content handler is automatically registered by the Integration Server during initialization. If you test your service through the Developer using Test->Send XML File…, everything should work fine.

If you try testing the service by invoking directly from a browser (i.e. not posting any XML data), you’ll receive the same error as you described above. Make sure that when you’re testing this service that your JSP client is setting the content type properly and that the XML document is actually included in the post. It may help to use a sniffer or pass-thru proxy to inspect the data before it gets to the Integration Server.

Ed