You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Benoit Guillon (JIRA)" <ji...@apache.org> on 2007/11/12 11:46:51 UTC

[jira] Created: (AXIS2-3333) wsdl2java namespace problem

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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Resolved: (AXIS2-3333) wsdl2java namespace problem

Posted by "Amila Chinthaka Suriarachchi (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-3333?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Amila Chinthaka Suriarachchi resolved AXIS2-3333.
-------------------------------------------------

    Resolution: Invalid

here the element you mentioned in the second schema and the generated code is correct.

> 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
>         Attachments: myservice.wsdl
>
>
> 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Updated: (AXIS2-3333) wsdl2java namespace problem

Posted by "Benoit Guillon (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-3333?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benoit Guillon updated AXIS2-3333:
----------------------------------

    Attachment: myservice.wsdl

The WSDL file ...

> 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
>         Attachments: myservice.wsdl
>
>
> 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org