I am trying to get an encrypted file via HTTPS. I can successfully get the file, but I then want to save it as a text file. I am trying to use convertToString, but it is creating an empty file, probably because of the schema parameter. Is there a better way to do this?
Just use pub.string:bytesToString and then save the string, or map the bytes (or stream) from the response into your save method (assuming it takes bytes or alternatively a stream).
Thanks, I used the bytesToString… but what do you mean by saving it? I tried savePipelineToFile, but I’m getting xml tags at the top, otherwise it works great. Do you know how to get rid of the tags?
There is no built-in save functionality but you might be able to obtain some utility services from webMethods support or professional services.
The savePipelineToFile method saves the pipeline variables at a specific point in your flow into a special directory on the server(ie. all the strings and objects in your flow) webMethods uses a special XML file to load and save these variables. It’s not for saving your own files to disk. You need your own java service for this.
Kim, if you want to write a file to disk, I suggest you take a look in the WmSamples package. There is an example of using Java IO classes to write to a flat file. Take a look at the sample.IO.test:writeToFile service and the supporting Java services in the sample.IO.utils folder.
Kim,
I have a similar requirement to grab a text file from a HTTPS site. I was wondering if you could share how you grabbed the file initially? Did you utilize the “GET” method or did you use some other means?
If you’re dealing with large files, I’d suggest retrieving the resource as a stream in the HTTP service. This allows you to perform streaming from network to disk to reduce overall resource use.