Hi,
My question is related to unfortunately unanswered question:
4593906
Big picture: There is a Jetty server on local network with SpringMVC controllers which respond with JSON. The only way to communicate from frontend application to that server is through the OSB. So OSB should work as transparent proxy, passing headers and respond with original JSON message.
I tried to build such proxy, following some blogs entries. Proxy worked for the REST services based on XML, but when I go to the JSON business service I get stuck.
I think that business service to communicate with JSON server should be a Messaging Service, with Response Type: Text and Request Type: None.
All headers should be passed (Outbound request) so the JSON server receives them in same state as frontend send.
Business service should be invoked from 'Service Callout' because I don't need any asynchronous calls, or routing - just call the business service endpoint, which will call JSON server and pass the response.
There are some problems in which I stepped into when tried this approach:
1. When using Request Type: None the Service Callout give me an error of type:
A callout cannot invoke a one-way operation
When switching Request Type to Text I get it working, but some services on JSON server which operates only on GET method stop work (because switching to Text automatically require to use POST method, which is obvious but not necessary in my case).
2. Even with above modification I cannot get the response from business service - I guess it's because the JSON response isn't wrapped into any XML elements. So in Service Callout any logger prints the message on Request side, but anything is written by Response logger inside the Service Callout. The browser which launch the Proxy Service also answers with:
HTTP 500 (Internal Server Error)
and I don't see any errors in logs, last message is from Request logger inside Service Callout.
3. Business Service itself seems to work - here is an output from 'Run on Server':
Business Service Testing - SampleJSON
Request Document
Response Document
{"models":[],"success":1}
Response Metadata
<con:metadata xmlns:con="http://www.bea.com/wli/sb/test/config">
<tran:headers xsi:type="http:HttpResponseHeaders" xmlns:http="http://www.bea.com/wli/sb/transports/http" xmlns:tran="http://www.bea.com/wli/sb/transports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<http:Content-Length>696</http:Content-Length>
<http:Content-Type>application/json;charset=ISO-8859-1</http:Content-Type>
<http:Server>Jetty(7.4.2.v20110526)</http:Server>
</tran:headers>
<tran:response-code xmlns:tran="http://www.bea.com/wli/sb/transports">0</tran:response-code>
<tran:response-message xmlns:tran="http://www.bea.com/wli/sb/transports">OK</tran:response-message>
<tran:encoding xmlns:tran="http://www.bea.com/wli/sb/transports">ISO-8859-1</tran:encoding>
<http:http-response-code xmlns:http="http://www.bea.com/wli/sb/transports/http">200</http:http-response-code>
</con:metadata>
But when calling it from a service proxy I don't get any logger message on the JSON server, which appears normally when I runs business service tests. So it seems that the request doesn't even reach it.
If anyone has a time to look at this problem I can share the configuration jar ready to import: http://dl.dropbox.com/u/21341604/sample-osb-json/sample-json.jar, to make it working you need change Endpoint URI in SampleJSON.biz.
Thanks in advance for any kind of help or tips,
Adrian