I am trying to receive from a post, an object, could be a text file, could be zip. I am also providing a parm for the file name, so I will know where to put it once I receive it. I dont want to process or read this data, I just want to pass it on, as is, and name it using the value supplied
So, I receive a string ‘parm’ such as ‘filename.zip’ or ‘filename.txt’ then I want to put the object on an endpoint using the string ‘parm’ as the file name. I also receive a null object, often named after the content of the data.
So, my question, how do i force the contents of the object into the content as an object 'objectTarget" that is not xml or node, and not receive a new object named {file contents} that is null?
clear as mud?
Jmplested -
Since you posted this a while ago, I’m not sure if you’ve figured out a solution or not.
The way webMethods handles the content coming in is via Content Handlers based upon the HTTP content-type parameter that comes across in the HTTP Header. For example, when webMethods receives something with a content-type of text/xml, it knows that it is receiving XML so the text/xml Content Handler is called under the hood prior to the invoke being handed off to your service. This Content Handler then parses the inbound XML into that *node parameter that is automatically in your pipeline.
In your case, you basically want to pass on your data somewhere else and not have webMethods do anything with it. We have a similar situation where we just want to receive some sort of text data and not have wM muck with it prior to our service running in that under-the hood Content Handler. So we created a service with two inputs. One of type object named “contentStream” and another of type string called “Filename” (or “parm” in your case). The input “contentStream” is important. The reason being is if wM gets a post that has a content-type it doesn’t know how to handle (ie, it doesn’t have a Content Handler for it), it will dump the post into the pipeline in a variable named “contentStream”.
So in our case, we post to this service with a content-type of “application/text” - and this prevents wM from trying to parse any XML we’re sending in, or EDI, or a flat file, etc. We can then convert that contentStream to a string (using the built in streamToString services), and write it out wherever we want. Your case is different since you’re really wanting to deal with byte data (zip, etc), so I’m not 100% sure off the top of my head of a content-type that would work best for you.
One thing to note is that the “contentStream” variable is dependent on the context of the post. So if you put a savePipeline as the first step in your service and try and post something to it and then step through your code with a restorePipeline, that “contentStream” will no longer be valid/available since it exists only in the context of the post because it represents the bytes streaming over your HTTP socket. So usually you have to put your savePipeline after a few steps of streamToString or streamToBytes that way you “consume” the stream into a variable that is actually in memory.
I hope this helps,
Jason
I did some digging and found this in an other flow. Unfortunatly, I didnt see anything like this on Advantage.
In the http header, I set “headers/Content-Type = application/x-wmflatfile” and it worked like a charm.
After bashing my head on the desk a few times, I figured out that I needed to actually receive/process something from the post in order to save the pipeline, cause i just wanted to see what was happening at the gate, but there would never be anything there. The problem is, if the content type isnt right, there is nothing to process.
Thank you