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 "Denis Rachal (JIRA)" <ji...@apache.org> on 2007/07/04 11:19:04 UTC

[jira] Created: (AXIS2-2902) jaxbri databinding cannot handle multiple XML elements of the same type

jaxbri databinding cannot handle multiple XML elements of the same type
-----------------------------------------------------------------------

                 Key: AXIS2-2902
                 URL: https://issues.apache.org/jira/browse/AXIS2-2902
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: databinding
    Affects Versions: 1.2
            Reporter: Denis Rachal
         Attachments: test.wsdl

wsdl2java with jaxbri databinding cannot handle multiple XML elements of the same type. I have two elements of the same type. If I define two messages in my WSDL with the two different XML elements that are of the same type, a message is generated for the second element with the name of the first element.

WSDL is attached for an example. 

In short. I have defined two request messages:


	<wsdl:message name="ReplyToRequestMessage">
		<wsdl:part name="ReplyTo" element="wsa:ReplyTo" />
	</wsdl:message>

and 
	<wsdl:message name="FromResponseMessage">
		<wsdl:part name="From" element="wsa:From" />
	</wsdl:message>

WS Addressing (http://schemas.xmlsoap.org/ws/2004/08/addressing/) defines the elements "ReplyTo" & "From" as follows:

  <xs:element name="From" type="wsa:EndpointReferenceType" /> 
  <xs:element name="ReplyTo" type="wsa:EndpointReferenceType" /> 

They are both the same type, "wsa:EndpointReferenceType"

The stub code generated has a toOM() method that is used to generate both the "ReplyTo" element and the "From" element, but the method has hardcoded the element name "ReplyTo" making it incorrect for the use with the "From" case. See generated code below:

                private org.apache.axiom.om.OMElement toOM(org.xmlsoap.schemas.ws._2004._08.addressing.EndpointReferenceType param, org.apache.axiom.soap.SOAPFactory factory, boolean optimizeContent) {
                    try {
                        javax.xml.bind.JAXBContext context = org_xmlsoap_schemas_ws__2004__08_addressing_EndpointReferenceType;
                        javax.xml.bind.Marshaller marshaller = context.createMarshaller();
                        marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_FRAGMENT, Boolean.TRUE);            

                        JaxbRIDataSource source = new JaxbRIDataSource( org.xmlsoap.schemas.ws._2004._08.addressing.EndpointReferenceType.class,
                                                                        param,
                                                                        marshaller,
                                                                        "http://schemas.xmlsoap.org/ws/2004/08/addressing",
                                                                        "ReplyTo");
                        org.apache.axiom.om.OMNamespace namespace = factory.createOMNamespace("",
                                                                           null);
                        return factory.createOMElement(source, "ReplyTo", namespace);
                    } catch (javax.xml.bind.JAXBException bex){
                        throw new RuntimeException(bex);
                    }
                }

To duplicate use the attached WSDL. Download the http://schemas.xmlsoap.org/ws/2004/08/addressing schema to "addressing.xsd" in the same directory as the "test.wsdl" and run the following command:

wsdl2java -uri test.wsdl -o gen-src -p com.test -s -t -d jaxbri




-- 
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] Commented: (AXIS2-2902) jaxbri databinding cannot handle multiple XML elements of the same type

Posted by "Denis Rachal (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-2902?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12518720 ] 

Denis Rachal commented on AXIS2-2902:
-------------------------------------

The example WSDL given is not actually realistic. "ReplyTo" and "From" are actually WS Addressing headers and should not be in the body. I put them in the body to illustrate the problem. Had I put them in the headers where they belong it would have exposed another bug: http://issues.apache.org/jira/browse/AXIS2-2852.

As WS Addressing headers they should be allowed as headers in any of the messages in the WSDL that support WS Addressing. While "From" is only optional, "ReplyTo" is required by WS Addressing if a reply is expected. This is the case for many, if not most, SOAP requests. Not using "From" at all avoids the problem. This may turn up in other cases of headers, though.

> jaxbri databinding cannot handle multiple XML elements of the same type
> -----------------------------------------------------------------------
>
>                 Key: AXIS2-2902
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2902
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: databinding
>    Affects Versions: 1.2
>            Reporter: Denis Rachal
>            Assignee: Amila Chinthaka Suriarachchi
>         Attachments: test.wsdl
>
>
> wsdl2java with jaxbri databinding cannot handle multiple XML elements of the same type. I have two elements of the same type. If I define two messages in my WSDL with the two different XML elements that are of the same type, a message is generated for the second element with the name of the first element.
> WSDL is attached for an example. 
> In short. I have defined two request messages:
> 	<wsdl:message name="ReplyToRequestMessage">
> 		<wsdl:part name="ReplyTo" element="wsa:ReplyTo" />
> 	</wsdl:message>
> and 
> 	<wsdl:message name="FromResponseMessage">
> 		<wsdl:part name="From" element="wsa:From" />
> 	</wsdl:message>
> WS Addressing (http://schemas.xmlsoap.org/ws/2004/08/addressing/) defines the elements "ReplyTo" & "From" as follows:
>   <xs:element name="From" type="wsa:EndpointReferenceType" /> 
>   <xs:element name="ReplyTo" type="wsa:EndpointReferenceType" /> 
> They are both the same type, "wsa:EndpointReferenceType"
> The stub code generated has a toOM() method that is used to generate both the "ReplyTo" element and the "From" element, but the method has hardcoded the element name "ReplyTo" making it incorrect for the use with the "From" case. See generated code below:
>                 private org.apache.axiom.om.OMElement toOM(org.xmlsoap.schemas.ws._2004._08.addressing.EndpointReferenceType param, org.apache.axiom.soap.SOAPFactory factory, boolean optimizeContent) {
>                     try {
>                         javax.xml.bind.JAXBContext context = org_xmlsoap_schemas_ws__2004__08_addressing_EndpointReferenceType;
>                         javax.xml.bind.Marshaller marshaller = context.createMarshaller();
>                         marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_FRAGMENT, Boolean.TRUE);            
>                         JaxbRIDataSource source = new JaxbRIDataSource( org.xmlsoap.schemas.ws._2004._08.addressing.EndpointReferenceType.class,
>                                                                         param,
>                                                                         marshaller,
>                                                                         "http://schemas.xmlsoap.org/ws/2004/08/addressing",
>                                                                         "ReplyTo");
>                         org.apache.axiom.om.OMNamespace namespace = factory.createOMNamespace("",
>                                                                            null);
>                         return factory.createOMElement(source, "ReplyTo", namespace);
>                     } catch (javax.xml.bind.JAXBException bex){
>                         throw new RuntimeException(bex);
>                     }
>                 }
> To duplicate use the attached WSDL. Download the http://schemas.xmlsoap.org/ws/2004/08/addressing schema to "addressing.xsd" in the same directory as the "test.wsdl" and run the following command:
> wsdl2java -uri test.wsdl -o gen-src -p com.test -s -t -d jaxbri

-- 
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] Commented: (AXIS2-2902) jaxbri databinding cannot handle multiple XML elements of the same type

Posted by "Upul Godage (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-2902?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12518071 ] 

Upul Godage commented on AXIS2-2902:
------------------------------------

It seems to me in the codegen templates, it assumes all in, out message types of each operation are different from each other.  That means each of the in, out return types can be used only once.  It looks like it is not specific to jaxbri code generation.   In other code generation methods each of the in, out argument types are generated unique for each message.  So that problem is not there for others.  

> jaxbri databinding cannot handle multiple XML elements of the same type
> -----------------------------------------------------------------------
>
>                 Key: AXIS2-2902
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2902
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: databinding
>    Affects Versions: 1.2
>            Reporter: Denis Rachal
>            Assignee: Amila Chinthaka Suriarachchi
>         Attachments: test.wsdl
>
>
> wsdl2java with jaxbri databinding cannot handle multiple XML elements of the same type. I have two elements of the same type. If I define two messages in my WSDL with the two different XML elements that are of the same type, a message is generated for the second element with the name of the first element.
> WSDL is attached for an example. 
> In short. I have defined two request messages:
> 	<wsdl:message name="ReplyToRequestMessage">
> 		<wsdl:part name="ReplyTo" element="wsa:ReplyTo" />
> 	</wsdl:message>
> and 
> 	<wsdl:message name="FromResponseMessage">
> 		<wsdl:part name="From" element="wsa:From" />
> 	</wsdl:message>
> WS Addressing (http://schemas.xmlsoap.org/ws/2004/08/addressing/) defines the elements "ReplyTo" & "From" as follows:
>   <xs:element name="From" type="wsa:EndpointReferenceType" /> 
>   <xs:element name="ReplyTo" type="wsa:EndpointReferenceType" /> 
> They are both the same type, "wsa:EndpointReferenceType"
> The stub code generated has a toOM() method that is used to generate both the "ReplyTo" element and the "From" element, but the method has hardcoded the element name "ReplyTo" making it incorrect for the use with the "From" case. See generated code below:
>                 private org.apache.axiom.om.OMElement toOM(org.xmlsoap.schemas.ws._2004._08.addressing.EndpointReferenceType param, org.apache.axiom.soap.SOAPFactory factory, boolean optimizeContent) {
>                     try {
>                         javax.xml.bind.JAXBContext context = org_xmlsoap_schemas_ws__2004__08_addressing_EndpointReferenceType;
>                         javax.xml.bind.Marshaller marshaller = context.createMarshaller();
>                         marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_FRAGMENT, Boolean.TRUE);            
>                         JaxbRIDataSource source = new JaxbRIDataSource( org.xmlsoap.schemas.ws._2004._08.addressing.EndpointReferenceType.class,
>                                                                         param,
>                                                                         marshaller,
>                                                                         "http://schemas.xmlsoap.org/ws/2004/08/addressing",
>                                                                         "ReplyTo");
>                         org.apache.axiom.om.OMNamespace namespace = factory.createOMNamespace("",
>                                                                            null);
>                         return factory.createOMElement(source, "ReplyTo", namespace);
>                     } catch (javax.xml.bind.JAXBException bex){
>                         throw new RuntimeException(bex);
>                     }
>                 }
> To duplicate use the attached WSDL. Download the http://schemas.xmlsoap.org/ws/2004/08/addressing schema to "addressing.xsd" in the same directory as the "test.wsdl" and run the following command:
> wsdl2java -uri test.wsdl -o gen-src -p com.test -s -t -d jaxbri

-- 
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] Assigned: (AXIS2-2902) jaxbri databinding cannot handle multiple XML elements of the same type

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

Deepal Jayasinghe reassigned AXIS2-2902:
----------------------------------------

    Assignee: Amila Chinthaka Suriarachchi

> jaxbri databinding cannot handle multiple XML elements of the same type
> -----------------------------------------------------------------------
>
>                 Key: AXIS2-2902
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2902
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: databinding
>    Affects Versions: 1.2
>            Reporter: Denis Rachal
>            Assignee: Amila Chinthaka Suriarachchi
>         Attachments: test.wsdl
>
>
> wsdl2java with jaxbri databinding cannot handle multiple XML elements of the same type. I have two elements of the same type. If I define two messages in my WSDL with the two different XML elements that are of the same type, a message is generated for the second element with the name of the first element.
> WSDL is attached for an example. 
> In short. I have defined two request messages:
> 	<wsdl:message name="ReplyToRequestMessage">
> 		<wsdl:part name="ReplyTo" element="wsa:ReplyTo" />
> 	</wsdl:message>
> and 
> 	<wsdl:message name="FromResponseMessage">
> 		<wsdl:part name="From" element="wsa:From" />
> 	</wsdl:message>
> WS Addressing (http://schemas.xmlsoap.org/ws/2004/08/addressing/) defines the elements "ReplyTo" & "From" as follows:
>   <xs:element name="From" type="wsa:EndpointReferenceType" /> 
>   <xs:element name="ReplyTo" type="wsa:EndpointReferenceType" /> 
> They are both the same type, "wsa:EndpointReferenceType"
> The stub code generated has a toOM() method that is used to generate both the "ReplyTo" element and the "From" element, but the method has hardcoded the element name "ReplyTo" making it incorrect for the use with the "From" case. See generated code below:
>                 private org.apache.axiom.om.OMElement toOM(org.xmlsoap.schemas.ws._2004._08.addressing.EndpointReferenceType param, org.apache.axiom.soap.SOAPFactory factory, boolean optimizeContent) {
>                     try {
>                         javax.xml.bind.JAXBContext context = org_xmlsoap_schemas_ws__2004__08_addressing_EndpointReferenceType;
>                         javax.xml.bind.Marshaller marshaller = context.createMarshaller();
>                         marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_FRAGMENT, Boolean.TRUE);            
>                         JaxbRIDataSource source = new JaxbRIDataSource( org.xmlsoap.schemas.ws._2004._08.addressing.EndpointReferenceType.class,
>                                                                         param,
>                                                                         marshaller,
>                                                                         "http://schemas.xmlsoap.org/ws/2004/08/addressing",
>                                                                         "ReplyTo");
>                         org.apache.axiom.om.OMNamespace namespace = factory.createOMNamespace("",
>                                                                            null);
>                         return factory.createOMElement(source, "ReplyTo", namespace);
>                     } catch (javax.xml.bind.JAXBException bex){
>                         throw new RuntimeException(bex);
>                     }
>                 }
> To duplicate use the attached WSDL. Download the http://schemas.xmlsoap.org/ws/2004/08/addressing schema to "addressing.xsd" in the same directory as the "test.wsdl" and run the following command:
> wsdl2java -uri test.wsdl -o gen-src -p com.test -s -t -d jaxbri

-- 
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-2902) jaxbri databinding cannot handle multiple XML elements of the same type

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

Denis Rachal updated AXIS2-2902:
--------------------------------

    Attachment: test.wsdl

Example WSDL to duplicate bug.

> jaxbri databinding cannot handle multiple XML elements of the same type
> -----------------------------------------------------------------------
>
>                 Key: AXIS2-2902
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2902
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: databinding
>    Affects Versions: 1.2
>            Reporter: Denis Rachal
>         Attachments: test.wsdl
>
>
> wsdl2java with jaxbri databinding cannot handle multiple XML elements of the same type. I have two elements of the same type. If I define two messages in my WSDL with the two different XML elements that are of the same type, a message is generated for the second element with the name of the first element.
> WSDL is attached for an example. 
> In short. I have defined two request messages:
> 	<wsdl:message name="ReplyToRequestMessage">
> 		<wsdl:part name="ReplyTo" element="wsa:ReplyTo" />
> 	</wsdl:message>
> and 
> 	<wsdl:message name="FromResponseMessage">
> 		<wsdl:part name="From" element="wsa:From" />
> 	</wsdl:message>
> WS Addressing (http://schemas.xmlsoap.org/ws/2004/08/addressing/) defines the elements "ReplyTo" & "From" as follows:
>   <xs:element name="From" type="wsa:EndpointReferenceType" /> 
>   <xs:element name="ReplyTo" type="wsa:EndpointReferenceType" /> 
> They are both the same type, "wsa:EndpointReferenceType"
> The stub code generated has a toOM() method that is used to generate both the "ReplyTo" element and the "From" element, but the method has hardcoded the element name "ReplyTo" making it incorrect for the use with the "From" case. See generated code below:
>                 private org.apache.axiom.om.OMElement toOM(org.xmlsoap.schemas.ws._2004._08.addressing.EndpointReferenceType param, org.apache.axiom.soap.SOAPFactory factory, boolean optimizeContent) {
>                     try {
>                         javax.xml.bind.JAXBContext context = org_xmlsoap_schemas_ws__2004__08_addressing_EndpointReferenceType;
>                         javax.xml.bind.Marshaller marshaller = context.createMarshaller();
>                         marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_FRAGMENT, Boolean.TRUE);            
>                         JaxbRIDataSource source = new JaxbRIDataSource( org.xmlsoap.schemas.ws._2004._08.addressing.EndpointReferenceType.class,
>                                                                         param,
>                                                                         marshaller,
>                                                                         "http://schemas.xmlsoap.org/ws/2004/08/addressing",
>                                                                         "ReplyTo");
>                         org.apache.axiom.om.OMNamespace namespace = factory.createOMNamespace("",
>                                                                            null);
>                         return factory.createOMElement(source, "ReplyTo", namespace);
>                     } catch (javax.xml.bind.JAXBException bex){
>                         throw new RuntimeException(bex);
>                     }
>                 }
> To duplicate use the attached WSDL. Download the http://schemas.xmlsoap.org/ws/2004/08/addressing schema to "addressing.xsd" in the same directory as the "test.wsdl" and run the following command:
> wsdl2java -uri test.wsdl -o gen-src -p com.test -s -t -d jaxbri

-- 
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