Hi, everyone,
My 1st wM project involves retrieving data from a DB through an Adapter Service, and send the data through SMTP as file attachment. I have 2 questions:
-
Each time I run my project, the adapter service will prompt to remind me “The Service Has no input fields”. I have to manually click OK to continue. In production, we don’t want any human intervention. So is there any way to tell it just shut up and run?
-
Is there any way to dump queried data from adapter service into a physical disk file (for archive purpose), and then email that file as file attachment? “SavePipelineToFile” will create a disk file in Server box, but I have to FTP to get the file from my development box. Any ideas?
Thanks for your inputs!
Jin
Jin,
1)Tell us more about your created AdapterService(Select template).Are you specifying Where condition and passing any input params to extract the data from DB?If so define the InputField in the adapter service,if not just ignore it and it should not ask for any inputs.So cross check in the Input/Output tab section of the AdapterService whether the SelectInput doesn’t have any fields displayed.
One more thing are you wrapping this select AdapterService inside a flowservice and running it which has service inputs to specify?
2)There are different ways to accomplish this,Once you have the queried data from the AdapterServices of Results output then loop thru the data and append the data to a string in a format or else create a Flatfile Schema(delimiter,csv file) and map the Adapter fields to this flatfile document structure and use wm.flatfile:convertToString and finally using writeToFile (get this in the WmSamples package (sample.IO.test:writeToFile)to the disk and transport it via Email Attachment
And if you are using (pub.client:smtp)built in service then map string directly to attachments[0]/content,set attachments[0]/contenttype=text/plain and set attachments[0]/filename=file.txt what ever.
So no need of storing the file in the disk unless your requirement wants for Archive.
HTH,
RMG.
Small Correction in the above post…
When mapping to smtp service,convert the file String to bytes(stringTobytes) and map this bytes to attachments[0]/content(object).