Using MTOM in Composite Application

We recently found an issue with MTOM handling in OpenESB 2.2. Where MTOM encoded response was not been send to client as response. I am writing this blog to give the problem in general we might face when we work with MTOM in OpenESB httpbc and a workaround. What is MTOM: (Message Transmission Optimization Mechanism) MTOM is the W3C Message Transmission Optimization Mechanism, a method of efficiently sending binary data to and from Web services. Normally when we send the SOAP response from the web service, where base64 attachment is there in response. SOAP response will include the base64 string as inline. As follows <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> <ns2:downloadImageResponse xmlns:ns2="http://ws.mkyong.com/"> <return>fsf33089f!ksfof......</return> </ns2:downloadImageResponse> </S:Body> </S:Envelope> Above response is good for small attachment, where payload is less, but some time base64 is not the perfect way for responding larger binary data. With MTOM, the above response will look like : <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> <ns2:downloadImageResponse xmlns:ns2="http://ws.mkyong.com/"> <return> <xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:012eb00e-9460-407c-b622-1be987fdb2cf@example.jaxws.sun.com"> </xop:Include> </return> </ns2:downloadImageResponse> </S:Body> </S:Envelope> //Binary content --uuid:c73c9ce8-6e02-40ce-9f68-064e18843428Content-Id: <012eb00e-9460-407c-b622-1be987fdb2cf@example.jaxws.sun.com> Content-Type: image/png Content-Transfer-Encoding: binary As you can see it will have xop XML-Binary Optimized Packaging (XOP) technique : which is more appropriate standard for web service response with attachment. For more detail you can read it online specification and examples, there are lot of material present there in detail. Using MTOM in OpenESB There could be two scenario while uisng MTOM in Composite Application ExternalClient ————–>htttpbc————>bpel( or any JBI Component) bpel( or any JBI Component)———>httpbc———–>ExternalWebservice The first scenario works fine where httpbc is provisioning the service, However the second scenarion in which  an user want to use MTOM while making an Outgoing CALL (invoking...

Creating a Patient Web Service Provider

Creating a Patient Web Service Provider Written by Michael.Czapski@sun.com Updated By Mriganka Banerjee In the below document written by Michael Czapski, he demonstrates how we can write a patient webservice using OpenESB. This patient webservice will allow patient information to be upserted into a database table and will return all patient details for a patient whose Facility+Local ID are specified in the request. This service will be used to populate the patient table and to implement patient lookup portlets, discussed in other walkthroughs in this series. This is a basic Patient Service that hides the specifics of interaction with the patient data store form applications that need to interact with it, by providing a defined interface and web service-based implementation. Thus the data store may change but the service consumers need not. We use Database BC (select, insert, update, null values), SOAP/HTTP BC and BPEL SE.christmas inflatables Document link :...

What do you do if you get “Address already in use (9080) when restarting OpenESB”?

Port 9080 is the default port used by the HTTP BC. The likely cause is that an instance of GlassFish is still running while starting a new one. First try shutting down gracefully using asadmin. After you stop glassfish, to make sure all processes are gone and not holding any ports, you can do a ps -ef | grep glassfish and if there are any processes left, do a kill -9 pid on those glassfish processes. Then I would wait a minute and restart glassfish. If the issue persists, you need to find which process is holding the port. You can do ps –ef | grep port# or better yet do a, lsof –V | grep port# which will give you the pid of the process holding the port. Then you can either kill the process or determine to change the port for the HTTP BC. Similar issue can happen in a GlassFish with multiple instances if the HTTP BC port numbers are not unique in different instances. You need to ensure that port numbers are...