axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig S. Bosma (JIRA)" <>
Subject [jira] Commented: (AXIS2-1609) namespace to package (ns2p) code gen option does not work in Axis2 1.1 RC2
Date Mon, 11 Dec 2006 19:12:25 GMT
    [ ] 
Craig S. Bosma commented on AXIS2-1609:

>From what I've found so far, there appear to be at least two issues at stake here. The
first, and simplest, is that only the first namespace-to-package mapping is respected when
specified on the command line in -ns2p ns1=pkg1,ns2=pkg2,...,nsN=pkgN format. If however,
if a property file name containing the mappings is given as an argument to the -ns2p option,
all of the mappings will be respected (NOTE: this usage does not seem to be well documented).
The culprit seems to be in CodegenConfigLoader.loadConfig(CodeGenConfiguration config, Map
optionMap). At line 141 (release 1.1) the value assigned to 'value' is a string representing
only the first namespace name-value pair. Subsequently then, when 'value' is tokenized, only
one mapping emerges. I cobbled together an alternative:

            List values = commandLineOption.getOptionValues();
            if (values != null && values.size() > 0) {
                // Try treating the values as a name=value pair separated by comma's
                String value = (String) values.get(0);
                if (value.indexOf('=') != -1) {
                    HashMap map = new HashMap(values.size());
                    for (Iterator iterator = values.iterator(); iterator.hasNext();)
                        value = (String);
                        String valuepair[] = value.split("=");
                        if (valuepair.length == 2) {
                            map.put(valuepair[0], valuepair[1]);
                } else {
                    // Try loading the properties from the file specified

Now that's just off the top of my head and untested, but you see the intent.

The second issue appears when the -u (unpack) option is enabled. Even when the namespaces
are explictly mapped to packages (i.e. by the property file mentioned above), code generation
still fails with a FileNotFoundException for '.\src\web\soap\v3\analytics\siebel\com\'.
By running this through a debugger, I've observed that all the databinding classes generated
from the schema are correctly mapped to the specified packages and written to disk; however,
the ExtensionMapper class is not, because its package name comes from the 'mappingClassPackage'
field which is registered by a call to registerExtensionMapperPackageName(String) in SchemaCompiler:244.
It appears that the namespace from the schema is run through URLProcessor.makePackageName(String)
and registered as the extension mapper package name without looking at any of the namespace
mapping options given by the user. I don't think this would normally cause the whole process
to fail (though the ExtensionMapper might wind up in a different package than expected), except
that the URL Processor doesn't handle namespaces of the form well;
they end up with residual '/' characters which the file writer then chokes on.

I'd be happy to help implement any fixes; unfortunately I can't help out much more until I
get home to my working copy. Any input from someone more familiar with the codebase than I
would be welcome.

> namespace to package (ns2p) code gen option does not work in Axis2 1.1 RC2
> --------------------------------------------------------------------------
>                 Key: AXIS2-1609
>                 URL:
>             Project: Apache Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: codegen
>    Affects Versions: 1.1
>         Environment: Win XP, JDK 1.5
>            Reporter: Charitha Kankanamge
>            Priority: Critical
>         Attachments: expression.xsd,,, MathsService.wsdl,
saw-local.wsdl, SAWServices.xsd
> ns2p code gen option does not work in Axis2 1.1 RC2.
> I provided the following code gen option.
> C:\Axis\axis-rc\axis2-1.1\bin>wsdl2java -uri "C:\Documents and Settings\Charitha\workspace2\servicetest\temp2\MathsService.wsdl"
> -o "C:\Documents and Settings\Charitha\workspace2\servicetest\temp2\packagetest"
> The generated stub was not included in the given package ( Instead, it was included
inside the original package (com.test)
> The wsdl file is attached here with.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message