wsdl2java namespace problem
---------------------------
Key: AXIS2-3333
URL: https://issues.apache.org/jira/browse/AXIS2-3333
Project: Axis 2.0 (Axis2)
Issue Type: Bug
Components: Tools
Affects Versions: 1.3
Environment: Windows XP 5.1.2600
Axis2 1.3
Maven 2.0.7
Java 1.5.0_12
Reporter: Benoit Guillon
I'm having problems with the code generated by wsdl2java (precisely using the
maven2 plugin). I'm using Axis2 1.3 with the ADB binding.
It seems that the generator gets confused because an operation is declared in a
given XML namespace and a bean used in the response of the operation is
declared in a different namespace.
The sample WSDL in attachment illustrates the situation. The operation "timer"
and its associated messages "timerRequest" and "timerResponse" belong to the
namespace "http://mycompany.com/myservice" however the data structure
ReturnStructure is defined with the namespace "http://mycompany.com/core/beans".
In this situation, the generated code for the message TimerResponse expects an
element ReturnStructure with namespace http://mycompany.com/myservice instead
of "http://mycompany.com/core/beans".
When the code is run, the parse method of TimerResponse class throws an
ADBException "Unexepected subelement ReturnStructure" when the response is
parsed.
Is there something wrong with my WSDL (which is generated using another tool)?
Or is this a bug?
The part of my pom.xml that defines the use of the maven2 plugin:
<build>
<plugins>
<plugin>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-wsdl2code-maven-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<goals>
<goal>wsdl2code</goal>
</goals>
<configuration>
<databindingName>adb</databindingName>
<packageName>org.mycompany.myservice.axis2client</packageName>
<wsdlFile>src/main/resources/myservice.wsdl</wsdlFile>
<outputDirectory>target/generated-sources/axis2/wsdl2code</outputDirectory>
<unpackClasses>true</unpackClasses>
<syncMode>sync</syncMode>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
The portion of code that causes the problem is located in TimerResponse.java
if (reader.isStartElement() && new
javax.xml.namespace.QName("http://mycompany.com/myservice","ReturnStructure").equals(reader.getName())){
nillableValue =
reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil");
if ("true".equals(nillableValue) || "1".equals(nillableValue)){
object.setReturnStructure(null);
reader.next();
reader.next();
}else{
object.setReturnStructure(com.mycompany.core.beans.ReturnStructure.Factory.parse(reader));
reader.next();
}
} // End of if for expected property start element
else{
// A start element we are not expecting indicates an invalid parameter
was passed
throw new org.apache.axis2.databinding.ADBException("Unexpected
subelement " + reader.getLocalName()); }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]