I have a business case where i need to get a gif/jpeg file (a map) from one location and send that file to another location. The middleware involved is off course webMethods v6.1. what could he the best methods to do this…??
Could you please elaborate a bit the “location” in your business case? It could be something like receiving your map file into a webMethods flow service as FTP, persisting it into DB and may be sending it over an MQ channel. But if we are clear about your back-ends (location, as you said), then may be people here can suggest better solutions.
“Be Good, Do Good”.
One approach we can think of is that the sender will put the jpg file in a specified location and based on file poling we can process the file. But i am not sure if jpg file can be handled by file poling. Once we are able to receive the file we are required to ftp the file to some fixed location…Any idea/experience handling with this kind of scenario…
How about this:
- Read the file from the file system using pub.io:getFile as an InputStream
- Use pub.string:base64Encode to convert the InputStream to a string
- Create a simple document with a string field to hold your base64 encoded image
- Map the base64 string to your document
- Convert your document to an XML string using pub.xml:documentToXMLNode and pub.xml:XMLNodeToXMLString
- Use pub.client:http to post the xmldata to your target server
- The target server extracts the base64 encoded string, decodes it and does something useful with it.
This approach assumes that the target server is capabile of receive an http post and that the image files are reasonably small.
In re-reading your previous post you mention that you may receive the image file via FTP and then have to FTP it somewhere else. Why is webMethods IS in the middle of this process? Can’t the source simply FTP the image to the target?