Command line tool for testing NXSD Translator
By Srimant on May 11, 2011
Several times, you simply wish to test the nXSD schema to make sure that nXSD annotations are correct and that the generated xml/native data conforms to the business semantics and so on. If you wish to do that now, you are required to write a BPEL process with an inbound and/or outbound File Adapter partner link configured with the appropriate nXSD schema and test them on the SOA server and this is both time consuming and error prone .
What we actually need is a simple standalone test client that lets you verify your nXSD schemas and this blog entry showcases such a tool.
Pre-requisites for the tool:
You will need to add the following jars in the classpath. Please note that these jars (with the exception of test-translator.jar) are available as a part of your soa installation. Please use Java 6 in order to run the test client.
- bpm-infra.jar [This is the nXSD runtime jar available under $SOA_HOME/soa/modules/oracle.soa.fabric_11.1.1/]
- xmlparserv2.jar [This is the Oracle XDK library for parsing available under $FMW_HOME/oracle_common/modules/oracle.xdk_11.1.0]
- xml.jar [This is the Oracle XDK library for schema validation available under $FMW_HOME/oracle_common/modules/oracle.xdk_11.1.0]
- mail.jar [Java mail API]
- test-translator.jar [Please note that you will need to rename the extension from jarr to jar]
Now you can run: java xlator.util.Translate -help and the usage should be displayed as shown below.
Sample run to convert address-csv.txt to address-csv.xml.
java xlator.util.Translate -inbound -schema address-csv.xsd -root Root-Element -input address-csv.txt -output address-csv.xml
Sample run to convert address-csv.xml to address-csv.txt.
java xlator.util.Translate -outbound -schema address-csv.xsd -root Root-Element -input address-csv.xml -output address-csv.txt
Sample run to convert address-csv.txt to a series of address-csv.xml_batch_%SEQ%.xml files using de-batching.
java xlator.util.Translate -inbound -debatch 1 -schema address-csv.xsd -root Root-Element -input address-csv.txt -output address-csv.xml