Monday, March 03, 2008

Java2WSDL generation with custom schema - Axis2

Today I implemented a way to provide a custom schema when you generate WSDL from a Java class. In order to give a custom schema file you need to use the option

  • csl “location of the schema file”

In addition to that you can feed the mapping file to use your custom schema , then you have to give the full qualified class name and the schema Qname you can feed the mapping file using following option.

  • mfl – “Location of the mapping file”

Structure of the mapping file look like below;


org.foo.bar.FooException|http://www.ebay.com/soaframework/common/types|ErrorMessage

[You can have any number of above entries]


Then if your class is something like below;


package org.foo;

import org.foo.bar.FooException;


public class MyClass {

public String doFoo(String foo) throws FooException {

return foo;

}

}


Will generate the correct WSDL file using the mapping file as well as using the custom schema.



1 comment:

Weian said...

Is there a way to specify that I want to use ErrorMessage for all the Exception types, like a wildcard?

Thanks!