WSO2 Carbon Studio: How to specify the namespace to a synapse artifact (endpoint/sequence/proxy/local entry)
By Saminda Wijeratne
- 21 Oct, 2010
Projects: ESB, Carbon Studio
Note: The Synapse artifact which I have referred here can be a synapse configuration file, an endpoint, a sequence, a proxy server or a local entry
Determining which namespace to use is easy if you know which carbon server version you are going to deploy the synapse artifacts.
- If you are going to deploy the synapse artifacts in to a carbon server version 3.0.1 or before (also ESB server version 3.0.1 or before), then you need to use the old synapse namespace version which is "http://ws.apache.org/ns/synapse".
- From carbon version 3.1 onwards (i.e. ESB server version 4.0 onwards) you are required to use the namespace "https://synapse.apache.org/ns/2010/04/configuration" in all your synapse configurations.
Now that you know which namespace to use lets see how you can specify it.
When you create a new synapse configuration through Carbon Studio ESB tools there is a namespace applied to them by default. You can specify this default namespace through the Carbon Studio preferences.
- From the main menu select
- Window -> Preferences
- In left handside tree, you will find the preference page "ESB" under the category "Carbon Studio"
- Select the "ESB" preference page
- At the right hand side the preference page will show settings related to ESB.
- Change the setting "Default namepsace" by selecting the namespace you want from the drop down list (which contains the namespaces available)
- Click "Apply"
- Click "OK"
- Now when you create new synapse artifacts the namespace specified in them by default will be the namespace you've just selected.
Once you have created a synapse artifact inside Carbon Studio or have imported to Carbon Studio, if you need to change the namespace, you will have to use the source view.
- Double click to open the synapse artifact file
- Note that you may use either the ESB editor or the standard XML editor in Eclipse for this
- Select the "Source" tab in the multi-page editor which just opened
- On the document element (the root element) of the synapse artifact there will be an attribute called "xmlns" and it is this attribute which corresponds to the namespace of the main synapse artifact
- Specify the required namespace as the value of the "xmlns" attribute
- Note that there could be other namespaces defined in the root element with different namespace prefixes. Their namespaces should not be altered unless the context requires you to do so
Author : Saminda Wijeratne, Product Manager WSO2 Tools, WSO2 Inc, [email protected]