Need way to automatically convert HTTP request to XML payload in default message body
-------------------------------------------------------------------------------------
Key: JBESB-3191
URL:
https://jira.jboss.org/jira/browse/JBESB-3191
Project: JBoss ESB
Issue Type: Feature Request
Security Level: Public (Everyone can see)
Components: Transports
Affects Versions: 4.7 CP1
Environment: SOA-P 5.0 GA
Reporter: Aaron Pestel
Currently, the http-gateway puts the payload of the HTTP message (whatever is POSTed) in
the default message body of the ESB message. The information in the HttpRequest (uri,
query string parameters, http properties, etc.) is stored in a Java object in the ESB
message properties. In this way, only a custom action with Java (or possibly a script
like Groovy) can access the actual HttpRequest data. In cases of GET or many other
RESTful type scenarios, the data in the HttpRequest is really the most important data and
should be easy to access.
The http_gateway quickstart has an example action that gets the HttpRequest object from
the message, converts it to XML via XStream, and stores it in the default message body.
It seems this would be an ideal option to be able to specify on the http-gateway rather
than having to write a custom action to do this. In this way, one could use the ESB to
present a SOAP service as a REST service, by only writing a few XSLTs and no Java code.
For example, the REST GET request could come in through the gateway and be automatically
converted to XML. An XSLT action could convert the HttpRequest XML to a SOAP message. A
SoapProxy could route the message to a SOAP service. Another XLST action could convert
the SOAP response into a raw XML response or even a JSON response. All this could be done
with no custom Java code, if there were a way for the http-gateway to automatically put
the HttpRequest on the message body as XML.
One possible way to implement this would be to add a new property flag like this to the
http-gateway: <http-gateway useHttpRequestXmlForMessageBody='true'/> Or,
one could possibly add a messageComposer property capability like the file-providers allow
with an out of the box implementation that converts the HttpRequest object to XML for the
default ESB message body. That would be even more flexible, but slightly more complex and
would need good documentation.
In the end, the goal is that via simple configuration, the http-gateway can put something
like the below XML in the default ESB message body rather than nothing in the GET case or
rather than whatever was POSTed in the HTTP POST case:
----------------------------------------------------------------------------------------------------------
<org.jboss.soa.esb.http.HttpRequest>
<contextPath>/Quickstart_http_gateway</contextPath>
<localAddr>127.0.0.1</localAddr>
<localName>localhost.localdomain</localName>
<method>GET</method>
<pathInfo>/XXXX/yyy</pathInfo>
<protocol>HTTP/1.1</protocol>
<queryString>a=1,b=2</queryString>
<remoteAddr>127.0.0.1</remoteAddr>
<remoteHost>127.0.0.1</remoteHost>
<contentLength>-1</contentLength>
<requestURI>/Quickstart_http_gateway/http/index/XXXX/yyy</requestURI>
<scheme>http</scheme>
<serverName>localhost</serverName>
<requestPath>/http/index</requestPath>
<pathInfoTokens>
<string>XXXX</string>
<string>yyy</string>
</pathInfoTokens>
<queryParams>
<entry>
<string>a</string>
<string-array>
<string>1,b=2</string>
</string-array>
</entry>
</queryParams>
<headers>
<org.jboss.soa.esb.http.HttpHeader>
<name>host</name>
<value>localhost:8080</value>
</org.jboss.soa.esb.http.HttpHeader>
<org.jboss.soa.esb.http.HttpHeader>
<name>user-agent</name>
<value>Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.11) Gecko/2009061118
Fedora/3.0.11-1.fc9 Firefox/3.0.11</value>
</org.jboss.soa.esb.http.HttpHeader>
<org.jboss.soa.esb.http.HttpHeader>
<name>accept</name>
<value>text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8</value>
</org.jboss.soa.esb.http.HttpHeader>
<org.jboss.soa.esb.http.HttpHeader>
<name>accept-language</name>
<value>en-us,en;q=0.5</value>
</org.jboss.soa.esb.http.HttpHeader>
<org.jboss.soa.esb.http.HttpHeader>
<name>accept-encoding</name>
<value>gzip,deflate</value>
</org.jboss.soa.esb.http.HttpHeader>
<org.jboss.soa.esb.http.HttpHeader>
<name>accept-charset</name>
<value>ISO-8859-1,utf-8;q=0.7,*;q=0.7</value>
</org.jboss.soa.esb.http.HttpHeader>
<org.jboss.soa.esb.http.HttpHeader>
<name>keep-alive</name>
<value>300</value>
</org.jboss.soa.esb.http.HttpHeader>
<org.jboss.soa.esb.http.HttpHeader>
<name>connection</name>
<value>keep-alive</value>
</org.jboss.soa.esb.http.HttpHeader>
</headers>
</org.jboss.soa.esb.http.HttpRequest>
----------------------------------------------------------------------------------------------------------
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira