Sidebar

Why does source "HTTP Receiver" force the format to XML?

0 votes
750 views
asked Apr 26, 2017 by brandon-w-8204 (33,170 points)
I want to receive HL7, JSON, CSV or some other Format type using a HTTP receiver but when i select HTTP Receiver the Format changes to XML. How can I setup my channel to receive another format type via HTTP?

1 Answer

0 votes
 
Best answer

HTTP requests are not simple messages, but are objects that have many attributes.  Because of this, QIE needs to be able to pass all of the information regarding the HTTP request in a single message.   This includes header information and request attributes as well as the actual payload for the message.  This can be complicated even more when an MTOM request is sent to an HTTP receiver.  QIE needs to let the channel know that there are multiple payloads that were contained in this single request.

With this in mind, Qvera decided that an XML message would be the most reasonable message type to transport all of the information regarding the HTTP request.  QIE converts the HTTP request java object into an XML Message allowing the channel full access to all of the attributes of the request and the payload.

Here is an example of an HTTP request that has been converted to an XML message:

<Request>
   <Content-Type>
      <![CDATA[null]]>
   </Content-Type>
   <Method>GET</Method>
   <RequestURI>/testurl</RequestURI>
   <QueryString>testparam</QueryString>
   <RemoteUser>null</RemoteUser>
   <RemoteAddress>127.0.0.1</RemoteAddress>
   <RemoteHost>127.0.0.1</RemoteHost>
   <RemotePort>62879</RemotePort>
   <Headers/>
   <Part>
      <Content>This is the content</Content>
   </Part>
</Request>

The payload from the HTTP or Webservice call is always placed in the "Content" XML tag. In the event that the HTTP request was an MTOM request, you will find multiple Part elements, one for each MTOM part.

So, when receiving any message, you will first extract and parse the '/Request/Part/Content' into the format that corresponds to the type of message being received.

Here is an exmple of the first mapping node that will convert the request payload content into the desired message type:

XML:

message = qie.createXMLMessage(qie.base64Decode(source.getNode('//Content')));

JSON:

message = qie.createJSONMessage(qie.base64Decode(source.getNode('//Content')));

HL7:

message = qie.createHL7Message();
message.setNode('/', qie.base64Decode(source.getNode('//Content')));

CSV:

message = qie.createCSVMessage();
message.setNode('/', qie.base64Decode(source.getNode('//Content')));

answered Apr 26, 2017 by brandon-w-8204 (33,170 points)
selected Mar 19, 2018 by brandon-w-8204
...