Service Bus 12c – Using XQuery map

In this post, you will learn to create and use XQuery maps in message flow using the same Service Bus project used in previous posts.

And here we are creating XQuery map for Address transformation. The Source WSDL CustomerPS.wsdl and Target WSDL AddrValidationService.wsdl are available here and here respectively. Make sure that you have these WSDLs copied in your project before proceeding with XQuery map creation.

Creating XQuery map:

Right click XQueries folder in XYZCustomer project and select New -> XQuery File ver1.0 to create new XQuery. Give both file and function name as AddrToAddrBSInput as shown below.

Click OK and retain default values for all the other properties in Function Parameter Type window as shown below.

Go back to Create XQuery Map window by clicking OK twice. Now click pencil icon for Target to bring up Function Result Type window. Click browse icon and select addrval_input element as shown below. Observe that the WSDL being used is AddrValidationService.wsdl.

Click OK thrice to bring up the Transformation editor and also do the initial mapping of attributes as shown below. You can map the fields by connecting Source and Target elements directly.

Click save icon and give file name as SampleCustomerInput.xml and click Add to Sequence.

Click OK and go back to Run XQuery screen. Give Target file name as AddrServiceInput by clicking Save icon.

Click Run and verify output of XQuery map to see mapping is working as you expected. You can observe that all address elements in Source concatenated and assigned to single element address_line in Target. You can also verify sample Source and Target files created in your XQueries folder.

Using XQuery map:

Drag Assign activity into Service Callout from Message Processing or place it at any other place in your Message Flow depending on where you want to use this transformation.