Using Ensemble for MIME multipart/form-data

I currently have an Ensemble production which accepts and handles SOAP requests.  I now need to support the exact same data, but instead of coming in as a SOAP request, comes in as a multipart/form-data request.  The body of the message would look something like:

 

------------------------------j1ks0od6m45rjpgz5208y85917swo61hl3u63
Content-Disposition: form-data; name="TimeStamp"
 
2016-02-22T07:26:49Z
------------------------------j1ks0od6m45rjpgz5208y85917swo61hl3u63
Content-Disposition: form-data; name="ID"
 
TEST
------------------------------j1ks0od6m45rjpgz5208y85917swo61hl3u63—

 

I have looked into using Ensemble with an HTTP.InboundAdapter.  This seems to have two problems:

1) The use of the HTTP.InboundAdapter forces Ensemble to bind the service to a different port than the current CSP port.

2) The HTTP.InboundAdapter isn't correctly reading the multipart data.  

 

I also looked at using a CSP page.  This solves both of the above problems, correctly reading and populating the %request object.  However then I am stuck with the need to recreate a lot of the same logic that existed in handling the SOAP request for this alternate format. 

 

I'm thinking I'm going to need to create my own Adapter for Ensemble, but I'd rather not reinvent the wheel if I don't have to.  Has anybody already solved this problem, or can point me in the right direction?

 

 

  • 0
  • 0
  • 256
  • 1
  • 0

Comments

Hi Mike,

Would it help to have your service extend EnsLib.HTTP.GenericService?  That would support using the standard CSP port, while also giving you the Ensemble Business Service functionality.  Per the class reference docs:

 

----------------

class EnsLib.HTTP.GenericService extends EnsLib.HTTP.Service

Ensemble Generic HTTP Service based BusinessService class. Can use an HTTP InboundAdapter listener, or the standard CSP Service mechanism, or both. In order for the CSP mechanism to work, HTTP Services using this class must be configured with the invoking URL including ?CfgItem= giving the config item name. (Configured Services exposed using the HTTP Inbound Adapter may also be invoked with this URL parameter but because each configured Inbound Adapter listens on its own TCP/IP port this parameter is just a safety check for them.)

---------------------------

 

Or if you're already doing this, can you elaborate on which logic you would have to recreate here that the InboundAdapter gave you?

 

I am also curious to hear from others who have solved this problem who can offer the best approach.

 

Thanks,

Steve