Working with XSLT Service Engine: Part 2

Project summary: In This project, I am going to do xml to xml transformation using Service Bridge. Please Check working with XSLT Service Engine Part 1 for more details about XSLT Service engine and sample project for Request-Reply service of XSLT service Engine. In this sample project I am going to take customer information like Name , Address , Personal Data in separate node and then merge all above info in single node. Creating Sample Project Using   Service Bridge (xml to xml transformation) In Service Bridge we can apply multiple xml transformation on request xml and then send output back to source. We need to have same number of wsdl operation as number of transformation we want to do. In this project I am going to apply two xml transformations. So I need to create two wsdl as webservice operation to perform transformation. Let’s  say Request1 and response 1 – first operation Request2 and response 2 – second operation Client will send request via request 1 and response 1 will get back to client but over all process will something like this . (Client input xml)Request1–>apply xsl on input to generate request2–>  request 2àappy xsl on request 2 generate response 2–>  response 2 –> apply xsl on response2 to generate response1 –> response 1(client output xml). Create XSLT Module: Please refer to part 1 for details to create XSLT module. Create XSD for request and reply operation <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xml.netbeans.org/schema/CustomerDetails" xmlns:tns="http://xml.netbeans.org/schema/CustomerDetails" elementFormDefault="qualified"> <xsd:complexType name="CustomerName"> <xsd:sequence> <xsd:element name="firstName" type="xsd:string"/> <xsd:element name="lastName" type="xsd:string"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="CustomerAddress"> <xsd:sequence> <xsd:element name="HomeAddress"/> <xsd:element name="OfficeAddress"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="PersonalData"> <xsd:sequence> <xsd:element name="gender" type="xsd:string"/> <xsd:element...

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...