Question
· Oct 21, 2019

How to send a file via JSON

I have a text file that I pick up in a Business Service and need to send it to our vendor via JSON.  I assumed (probably wrongly) that I could just create a RESTful Business Operation, plug in the server IP and URL as well as complete some of the other fields on the BO to send the file.  When I do this, I get the following error:

ERROR <Ens>ErrException: <PROPERTY DOES NOT EXIST>zOnMessage+5^EnsLib.HTTP.GenericOperation.1 *HTTPHeaders,Ens.StreamContainer -- logged as '-' number - @' Set tHeaderKey="" For { Set tHeaderKey=pRequest.HTTPHeaders.Next(tHeaderKey) Quit:""=tHeaderKey Set tHeaderLwr=$ZCVT(tHeaderKey,"L")'

Is there some other information that I am missing?  Has anyone performed a similar situation as this?  I did some searching in the WRC, however I couldn't find a similar situation as what I am performing.
 

Discussion (4)1
Log in or sign up to continue

Ok, EnsLib.REST.GenericOperation also expects to receive an EnsLib.HTTP.GenericMessage.

Are you using EnsLib.File.PassthroughService to pick up the files? If so, it is sending an Ens.StreamContainer message to the target component (your business operation). You'll need to create a data transformation that creates a new EnsLib.HTTP.GenericMessage and populates it with the stream content from the Ens.StreamContainer. Then you'll need a router in the middle to run the data transformation and send the resulting EnsLib.HTTP.GenericMessage to the business operation.