Written by

Question Larry Pinsky · 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.
 

Comments

Marc Mundt · Oct 21, 2019

What type of object is your business process sending to your business operation?

EnsLib.HTTP.GenericOperation expects to receive a message of type EnsLib.HTTP.GenericMessage.

0
Larry Pinsky  Oct 21, 2019 to Marc Mundt

I am using EnsLib.REST.GenericOperation in order to create a JSON call and send a file located on my server.  I am not using a Business Operation; just sending the file direct from the Business Service.

0
Marc Mundt  Oct 21, 2019 to Larry Pinsky

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.

0
Larry Pinsky  Oct 22, 2019 to Marc Mundt

Thanks, I will try that out.

0