I have a WSDL file that doesn't declare any types of its own, but
rather imports several XSD files that declare the types it uses. This
works fine. It took a little while, but it works. Mostly. For
reference, I'm using Sun's Java 1.5 on Ubuntu 7.04, using Eclipse
Europa to check my XSD and WSDL files, and Axis2 1.2 to compile said
WSDL into Java Classes.

The first problem I have is that it doesn't put the contents of each
Schema in its own location. Note that each Schema has its own
namespace. Also, several Schemas import other schemas. e.g. WSDL
imports A, B, C, D, but D imports B and C as well, and C imports B
too. Axis seems to handle these just fine, but I'm mentioning it in
case it has a bearing on the problems I'm outlining below.

e.g. If I have the following import declarations in the WSDL
Types/Schema section:

<xsd:import schemaLocation="Schema1.xsd"
namespace="http://project.company.com/S1"; />
<xsd:import schemaLocation="Schema2.xsd"
namespace="http://project.company.com/S2"; />
<xsd:import schemaLocation="Schema3.xsd"
namespace="http://project.company.com/S3"; />

I would like the directory structure to be something like

com/company/project/S1
com/company/project/S2
com/company/project/S3

With S1 holding only those types declared in Schema1.xsd.

Instead, what I get is something like

com/company/project/S2

With all the various types shoved into the one folder. I can also see
no rhyme or reason for it picking S2, in particular, for the directory
name. It's not declared as the first import, it's not declared as the
first xmlns:... declaration in the <xsd:schema> tag, it's not declared
as the first xmlns:... in the <wsdl:definitions> tag, etc. So any idea
why it's being picked as the location to store all the types declared
across the various schemas?

Using Ant, I specify the following as arguments to
org.apache.axis2.wsdl.WSDL2Java:

<arg value="-ns2p" />
<arg 
value="app=com.company.project.app,cre=com.company.project.cre,autoscore=com.company.project.autoscore,reply=com.company.project.reply,misc=com.company.project.misc,heart=com.company.project.heart"
/>

But I'm not sure what should be on each side for that argument. Should
I specify the full namespace? e.g. instead of app=..., should it be
http://company.project.com/app=...? Though I did try that, but it
didn't work as expected...

The second problem I have is that I can't have more than one type with
the same name. I suspect this is related to the above problem.
Basically, if I have a file Schema1.xsd, and it contains the following
element declaration:

<s1:element name="reply" />

And I have a file Schema2.xsd, with the following element declaration:

<s2:element name="reply" />

Executing WSDL2Java will die with various interesting exceptions
[stack trace below] (assuming the WSDL itself is correct and such
like). They both have different namespaces, or, at least, as far as I
can tell they do. Very basic example is like so:

<s1:schema xmlns:s1="http://www.w3.org/2001/XMLSchema";
targetNamespace="http://project.company.com/s1";
xmlns="http://project.company.com/s1";>
    <s1:element name="reply" />
</s1:schema>

If necessary, I can try to provide a generic example (that won't get
me in trouble for breaching confidentiality agreements) that shows the
problems I'm having. Also, how do I set up logging for the WSDL2Java
stuff? That might make life a lot easier for me... My project doesn't
use log4j (legacy code! Yeah!), and in any event I'm executing
WSDL2Java via an Ant build file, so I'm not entirely sure where I
should put the log initializer to get the logging working.

Stack Trace for problem two:
     [java] Exception in thread "main"
org.apache.axis2.wsdl.codegen.CodeGenerationException:
java.lang.RuntimeException:
java.lang.reflect.InvocationTargetException
     [java]     at
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:256)
     [java]     at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:32)
     [java]     at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:21)
     [java] Caused by: java.lang.RuntimeException:
java.lang.reflect.InvocationTargetException
     [java]     at
org.apache.axis2.wsdl.codegen.extension.JAXBRIExtension.engage(JAXBRIExtension.java:109)
     [java]     at
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:209)
     [java]     ... 2 more
     [java] Caused by: java.lang.reflect.InvocationTargetException
     [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [java]     at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     [java]     at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     [java]     at java.lang.reflect.Method.invoke(Method.java:585)
     [java]     at
org.apache.axis2.wsdl.codegen.extension.JAXBRIExtension.engage(JAXBRIExtension.java:98)
     [java]     ... 3 more
     [java] Caused by: java.lang.RuntimeException:
java.lang.NullPointerException
     [java]     at
org.apache.axis2.jaxbri.CodeGenerationUtility.processSchemas(CodeGenerationUtility.java:126)
     [java]     ... 8 more
     [java] Caused by: java.lang.NullPointerException
     [java]     at
org.apache.axis2.jaxbri.CodeGenerationUtility.processSchemas(CodeGenerationUtility.java:105)
     [java]     ... 8 more
     [java] Java Result: 1

Anyway, thanks in advance, I hope someone out there is able to provide
me with some guidance :D.

- Andrew Thorburn

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to