You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Peter Liljenberg (JIRA)" <ji...@apache.org> on 2007/09/20 15:56:31 UTC

[jira] Created: (CXF-1052) CXF generates errornous client code when multiple elements have the same name in WSDL

CXF generates errornous client code when multiple elements have the same name in WSDL
-------------------------------------------------------------------------------------

                 Key: CXF-1052
                 URL: https://issues.apache.org/jira/browse/CXF-1052
             Project: CXF
          Issue Type: Bug
          Components: JAX-WS Runtime
    Affects Versions: 2.0.1
         Environment: Windows XP, Java 1.5
            Reporter: Peter Liljenberg
            Priority: Blocker



I'm getting ClassCastExceptions from within a dynamically created proxy when using CXF as a client against a webservice. The WSDL for the service is attached, but some parts are shown here:

 <message name='InvoiceDS_getInvoiceData'>
  <part element='tns:getInvoiceData' name='parameters'/>  </message> <message name='InvoiceDS_getInvoiceDataResponse'>
  <part element='tns:getInvoiceDataResponse' name='result'/>  </message> <portType name='InvoiceDS'>
  <operation name='getInvoiceData'>
   <input message='tns:InvoiceDS_getInvoiceData'/>
   <output message='tns:InvoiceDS_getInvoiceDataResponse'/>
   <fault message='tns:WebServiceFault' name='WebService'/>
  </operation>
 </portType>

All classes are genereated with WSDL2Java, the resulting interface for the service being (removed annotations for readability):

public interface InvoiceDS {
    public java.util.List<localhost.jaws.InvoiceData> getInvoiceData(
        localhost.jaws.InvoiceRequest invoiceRequest
    ) throws WebServiceFault_Exception;
}

The InvoiceDS interface specifies that a List of InvoiceData objects should be returned from the method. This means that the GetInvoiceDataResponse type is not used and CXF must unwrap the result from the response before returning it to the client.

My testcode looks something like this:
{
       QName SERVICE = new QName("http://localhost/jaws", "InvoiceServiceDS");
        InvoiceServiceDS service = new InvoiceServiceDS(new URL("InvoiceWs.wsdl"), SERVICE);
        InvoiceDS client =service.getInvoiceDSPort();
        InvoiceRequest invoiceRequest = new InvoiceRequest();
        invoiceRequest.setCustId("test123");

        List<InvoiceData> invoiceData =
client.getInvoiceData(invoiceRequest);
}

Digging into the CXF framework with the debugger we end up in the
JaxWsClientProxy.invoke() method, line 191 has the return statement:
191        return result;

result is of type GetInvoiceDataResponse (as specified in the WSDL) and not the list that was expected.


After looking into this issue more closely I discovered that the problem arises from the fact that 2 elements in the WSDL have the same name and this makes CXF generate the wrong client code.

Snippet of original WSDL file:

   <complexType name='InvoiceData'>
    <sequence>
     <element name='custID' nillable='true' type='string'/>
    </sequence>
   </complexType>
   <complexType name='InvoiceRequest'>
    <sequence>
     <element name='custId' nillable='true' type='string'/>
    </sequence>
   </complexType>
   <complexType name='getInvoiceData'>
    <sequence>
     <element name='InvoiceRequest' nillable='true'
type='tns:InvoiceRequest'/>
    </sequence>
   </complexType>
   <complexType name='getInvoiceDataResponse'>
    <sequence>
     <element maxOccurs='unbounded' minOccurs='0' name='result'
nillable='true' type='tns:InvoiceData'/>
    </sequence>
   </complexType>
   <element name='getInvoiceData' type='tns:getInvoiceData'/>
   <element name='getInvoiceDataResponse'
type='tns:getInvoiceDataResponse'/>
  </schema>
 </types>
 <message name='InvoiceDS_getInvoiceData'>
  <part element='tns:getInvoiceData' name='parameters'/>  </message>  <message name='InvoiceDS_getInvoiceDataResponse'>
  <part element='tns:getInvoiceDataResponse' name='result'/>  </message>  <portType name='InvoiceDS'>
  <operation name='getInvoiceData'>
   <input message='tns:InvoiceDS_getInvoiceData'/>
   <output message='tns:InvoiceDS_getInvoiceDataResponse'/>
  </operation>
 </portType>

------
In the new version I've changed the operation name to "getInvoiceDataOperation" and thus CXF will render a working client for me.

WSDL snippet:
			<complexType name='InvoiceData'>
				<sequence>
					<element name='custID'
nillable='true'
						type='string' />
				</sequence>
			</complexType>
			<complexType name='InvoiceRequest'>
				<sequence>
					<element name='custId'
nillable='true'
						type='string' />
				</sequence>
			</complexType>
			<complexType name='getInvoiceData'>
				<sequence>
					<element name='InvoiceRequest'
nillable='true'
	
type='tns:InvoiceRequest' />
				</sequence>
			</complexType>
			<complexType name='getInvoiceDataResponse'>
				<sequence>
					<element maxOccurs='unbounded'
minOccurs='0'
						name='result'
nillable='true' type='tns:InvoiceData' />
				</sequence>
			</complexType>
			<element name='getInvoiceData'
type='tns:getInvoiceData' />
			<element name='getInvoiceDataResponse'
				type='tns:getInvoiceDataResponse' />
		</schema>
	</types>
	<message name='InvoiceDS_getInvoiceData'>
		<part element='tns:getInvoiceData' name='parameters' />
	</message>
	<message name='InvoiceDS_getInvoiceDataResponse'>
		<part element='tns:getInvoiceDataResponse' name='result'
/>
	</message>
	<portType name='InvoiceDS'>
		<operation name='getInvoiceDataOperation'>
			<input message='tns:InvoiceDS_getInvoiceData' />
			<output
message='tns:InvoiceDS_getInvoiceDataResponse' />
		</operation>
	</portType>



   public localhost.jaws.GetInvoiceDataResponse getInvoiceDataOperation(
        @WebParam(targetNamespace = "http://localhost/jaws", partName = "parameters", name = "getInvoiceData")
        localhost.jaws.GetInvoiceData parameters
    );

Seems to be a problem when there are multiple elements with the same name (a datatype and a message) but I'm assuming that should be ok according to the specs - since the WSDL works with other SOAP stacks (.Net, Axis2, JBoss-WS)?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1052) CXF throws ClassCastException from generated client code [when multiple elements have the same name in WSDL]

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1052?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12529993 ] 

Daniel Kulp commented on CXF-1052:
----------------------------------


I believe this is already fixed for the 2.0.2 release that should (hopefully) be released tomorrow.   I took the wsdl and generated a simple client and server and it seems to work OK.

You can try it at:
http://people.apache.org/~dkulp/stage_cxf/2.0.2-incubator-take2/



> CXF throws ClassCastException from generated client code [when multiple elements have the same name in WSDL]
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-1052
>                 URL: https://issues.apache.org/jira/browse/CXF-1052
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime
>    Affects Versions: 2.0.1
>         Environment: Windows XP, Java 1.5
>            Reporter: Peter Liljenberg
>            Priority: Blocker
>         Attachments: InvoiceWs.wsdl
>
>
> I'm getting ClassCastExceptions from within a dynamically created proxy when using CXF as a client against a webservice. The WSDL for the service is attached, but some parts are shown here:
>  <message name='InvoiceDS_getInvoiceData'>
>   <part element='tns:getInvoiceData' name='parameters'/>  </message> <message name='InvoiceDS_getInvoiceDataResponse'>
>   <part element='tns:getInvoiceDataResponse' name='result'/>  </message> <portType name='InvoiceDS'>
>   <operation name='getInvoiceData'>
>    <input message='tns:InvoiceDS_getInvoiceData'/>
>    <output message='tns:InvoiceDS_getInvoiceDataResponse'/>
>    <fault message='tns:WebServiceFault' name='WebService'/>
>   </operation>
>  </portType>
> All classes are genereated with WSDL2Java, the resulting interface for the service being (removed annotations for readability):
> public interface InvoiceDS {
>     public java.util.List<localhost.jaws.InvoiceData> getInvoiceData(
>         localhost.jaws.InvoiceRequest invoiceRequest
>     ) throws WebServiceFault_Exception;
> }
> The InvoiceDS interface specifies that a List of InvoiceData objects should be returned from the method. This means that the GetInvoiceDataResponse type is not used and CXF must unwrap the result from the response before returning it to the client.
> My testcode looks something like this:
> {
>        QName SERVICE = new QName("http://localhost/jaws", "InvoiceServiceDS");
>         InvoiceServiceDS service = new InvoiceServiceDS(new URL("InvoiceWs.wsdl"), SERVICE);
>         InvoiceDS client =service.getInvoiceDSPort();
>         InvoiceRequest invoiceRequest = new InvoiceRequest();
>         invoiceRequest.setCustId("test123");
>         List<InvoiceData> invoiceData =
> client.getInvoiceData(invoiceRequest);
> }
> Digging into the CXF framework with the debugger we end up in the
> JaxWsClientProxy.invoke() method, line 191 has the return statement:
> 191        return result;
> result is of type GetInvoiceDataResponse (as specified in the WSDL) and not the list that was expected.
> After looking into this issue more closely I discovered that the problem arises from the fact that 2 elements in the WSDL have the same name and this makes CXF generate the wrong client code.
> Snippet of original WSDL file:
>    <complexType name='InvoiceData'>
>     <sequence>
>      <element name='custID' nillable='true' type='string'/>
>     </sequence>
>    </complexType>
>    <complexType name='InvoiceRequest'>
>     <sequence>
>      <element name='custId' nillable='true' type='string'/>
>     </sequence>
>    </complexType>
>    <complexType name='getInvoiceData'>
>     <sequence>
>      <element name='InvoiceRequest' nillable='true'
> type='tns:InvoiceRequest'/>
>     </sequence>
>    </complexType>
>    <complexType name='getInvoiceDataResponse'>
>     <sequence>
>      <element maxOccurs='unbounded' minOccurs='0' name='result'
> nillable='true' type='tns:InvoiceData'/>
>     </sequence>
>    </complexType>
>    <element name='getInvoiceData' type='tns:getInvoiceData'/>
>    <element name='getInvoiceDataResponse'
> type='tns:getInvoiceDataResponse'/>
>   </schema>
>  </types>
>  <message name='InvoiceDS_getInvoiceData'>
>   <part element='tns:getInvoiceData' name='parameters'/>  </message>  <message name='InvoiceDS_getInvoiceDataResponse'>
>   <part element='tns:getInvoiceDataResponse' name='result'/>  </message>  <portType name='InvoiceDS'>
>   <operation name='getInvoiceData'>
>    <input message='tns:InvoiceDS_getInvoiceData'/>
>    <output message='tns:InvoiceDS_getInvoiceDataResponse'/>
>   </operation>
>  </portType>
> ------
> In the new version I've changed the operation name to "getInvoiceDataOperation" and thus CXF will render a working client for me.
> WSDL snippet:
> 			<complexType name='InvoiceData'>
> 				<sequence>
> 					<element name='custID'
> nillable='true'
> 						type='string' />
> 				</sequence>
> 			</complexType>
> 			<complexType name='InvoiceRequest'>
> 				<sequence>
> 					<element name='custId'
> nillable='true'
> 						type='string' />
> 				</sequence>
> 			</complexType>
> 			<complexType name='getInvoiceData'>
> 				<sequence>
> 					<element name='InvoiceRequest'
> nillable='true'
> 	
> type='tns:InvoiceRequest' />
> 				</sequence>
> 			</complexType>
> 			<complexType name='getInvoiceDataResponse'>
> 				<sequence>
> 					<element maxOccurs='unbounded'
> minOccurs='0'
> 						name='result'
> nillable='true' type='tns:InvoiceData' />
> 				</sequence>
> 			</complexType>
> 			<element name='getInvoiceData'
> type='tns:getInvoiceData' />
> 			<element name='getInvoiceDataResponse'
> 				type='tns:getInvoiceDataResponse' />
> 		</schema>
> 	</types>
> 	<message name='InvoiceDS_getInvoiceData'>
> 		<part element='tns:getInvoiceData' name='parameters' />
> 	</message>
> 	<message name='InvoiceDS_getInvoiceDataResponse'>
> 		<part element='tns:getInvoiceDataResponse' name='result'
> />
> 	</message>
> 	<portType name='InvoiceDS'>
> 		<operation name='getInvoiceDataOperation'>
> 			<input message='tns:InvoiceDS_getInvoiceData' />
> 			<output
> message='tns:InvoiceDS_getInvoiceDataResponse' />
> 		</operation>
> 	</portType>
>    public localhost.jaws.GetInvoiceDataResponse getInvoiceDataOperation(
>         @WebParam(targetNamespace = "http://localhost/jaws", partName = "parameters", name = "getInvoiceData")
>         localhost.jaws.GetInvoiceData parameters
>     );
> Seems to be a problem when there are multiple elements with the same name (a datatype and a message) but I'm assuming that should be ok according to the specs - since the WSDL works with other SOAP stacks (.Net, Axis2, JBoss-WS)?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1052) CXF generates errornous client code when multiple elements have the same name in WSDL

Posted by "Peter Liljenberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1052?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12529807 ] 

Peter Liljenberg commented on CXF-1052:
---------------------------------------

Have now tried the WSDL with the JAXWS reference implementation (https://jax-ws.dev.java.net/), and the client code is generated just as it is with CXF, like this:

 public List<InvoiceData> getInvoiceData(
        @WebParam(name = "InvoiceRequest", targetNamespace = "http://localhost/jaws")
        InvoiceRequest invoiceRequest);

So it seems that the code generation is correct.
The JAXWS-RI does however work in runtime, ie no ClassCastException is thrown and the correct value is returned. This means that this issue probably should be moved into JAXWS-RT instead.

> CXF generates errornous client code when multiple elements have the same name in WSDL
> -------------------------------------------------------------------------------------
>
>                 Key: CXF-1052
>                 URL: https://issues.apache.org/jira/browse/CXF-1052
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime
>    Affects Versions: 2.0.1
>         Environment: Windows XP, Java 1.5
>            Reporter: Peter Liljenberg
>            Priority: Blocker
>         Attachments: InvoiceWs.wsdl
>
>
> I'm getting ClassCastExceptions from within a dynamically created proxy when using CXF as a client against a webservice. The WSDL for the service is attached, but some parts are shown here:
>  <message name='InvoiceDS_getInvoiceData'>
>   <part element='tns:getInvoiceData' name='parameters'/>  </message> <message name='InvoiceDS_getInvoiceDataResponse'>
>   <part element='tns:getInvoiceDataResponse' name='result'/>  </message> <portType name='InvoiceDS'>
>   <operation name='getInvoiceData'>
>    <input message='tns:InvoiceDS_getInvoiceData'/>
>    <output message='tns:InvoiceDS_getInvoiceDataResponse'/>
>    <fault message='tns:WebServiceFault' name='WebService'/>
>   </operation>
>  </portType>
> All classes are genereated with WSDL2Java, the resulting interface for the service being (removed annotations for readability):
> public interface InvoiceDS {
>     public java.util.List<localhost.jaws.InvoiceData> getInvoiceData(
>         localhost.jaws.InvoiceRequest invoiceRequest
>     ) throws WebServiceFault_Exception;
> }
> The InvoiceDS interface specifies that a List of InvoiceData objects should be returned from the method. This means that the GetInvoiceDataResponse type is not used and CXF must unwrap the result from the response before returning it to the client.
> My testcode looks something like this:
> {
>        QName SERVICE = new QName("http://localhost/jaws", "InvoiceServiceDS");
>         InvoiceServiceDS service = new InvoiceServiceDS(new URL("InvoiceWs.wsdl"), SERVICE);
>         InvoiceDS client =service.getInvoiceDSPort();
>         InvoiceRequest invoiceRequest = new InvoiceRequest();
>         invoiceRequest.setCustId("test123");
>         List<InvoiceData> invoiceData =
> client.getInvoiceData(invoiceRequest);
> }
> Digging into the CXF framework with the debugger we end up in the
> JaxWsClientProxy.invoke() method, line 191 has the return statement:
> 191        return result;
> result is of type GetInvoiceDataResponse (as specified in the WSDL) and not the list that was expected.
> After looking into this issue more closely I discovered that the problem arises from the fact that 2 elements in the WSDL have the same name and this makes CXF generate the wrong client code.
> Snippet of original WSDL file:
>    <complexType name='InvoiceData'>
>     <sequence>
>      <element name='custID' nillable='true' type='string'/>
>     </sequence>
>    </complexType>
>    <complexType name='InvoiceRequest'>
>     <sequence>
>      <element name='custId' nillable='true' type='string'/>
>     </sequence>
>    </complexType>
>    <complexType name='getInvoiceData'>
>     <sequence>
>      <element name='InvoiceRequest' nillable='true'
> type='tns:InvoiceRequest'/>
>     </sequence>
>    </complexType>
>    <complexType name='getInvoiceDataResponse'>
>     <sequence>
>      <element maxOccurs='unbounded' minOccurs='0' name='result'
> nillable='true' type='tns:InvoiceData'/>
>     </sequence>
>    </complexType>
>    <element name='getInvoiceData' type='tns:getInvoiceData'/>
>    <element name='getInvoiceDataResponse'
> type='tns:getInvoiceDataResponse'/>
>   </schema>
>  </types>
>  <message name='InvoiceDS_getInvoiceData'>
>   <part element='tns:getInvoiceData' name='parameters'/>  </message>  <message name='InvoiceDS_getInvoiceDataResponse'>
>   <part element='tns:getInvoiceDataResponse' name='result'/>  </message>  <portType name='InvoiceDS'>
>   <operation name='getInvoiceData'>
>    <input message='tns:InvoiceDS_getInvoiceData'/>
>    <output message='tns:InvoiceDS_getInvoiceDataResponse'/>
>   </operation>
>  </portType>
> ------
> In the new version I've changed the operation name to "getInvoiceDataOperation" and thus CXF will render a working client for me.
> WSDL snippet:
> 			<complexType name='InvoiceData'>
> 				<sequence>
> 					<element name='custID'
> nillable='true'
> 						type='string' />
> 				</sequence>
> 			</complexType>
> 			<complexType name='InvoiceRequest'>
> 				<sequence>
> 					<element name='custId'
> nillable='true'
> 						type='string' />
> 				</sequence>
> 			</complexType>
> 			<complexType name='getInvoiceData'>
> 				<sequence>
> 					<element name='InvoiceRequest'
> nillable='true'
> 	
> type='tns:InvoiceRequest' />
> 				</sequence>
> 			</complexType>
> 			<complexType name='getInvoiceDataResponse'>
> 				<sequence>
> 					<element maxOccurs='unbounded'
> minOccurs='0'
> 						name='result'
> nillable='true' type='tns:InvoiceData' />
> 				</sequence>
> 			</complexType>
> 			<element name='getInvoiceData'
> type='tns:getInvoiceData' />
> 			<element name='getInvoiceDataResponse'
> 				type='tns:getInvoiceDataResponse' />
> 		</schema>
> 	</types>
> 	<message name='InvoiceDS_getInvoiceData'>
> 		<part element='tns:getInvoiceData' name='parameters' />
> 	</message>
> 	<message name='InvoiceDS_getInvoiceDataResponse'>
> 		<part element='tns:getInvoiceDataResponse' name='result'
> />
> 	</message>
> 	<portType name='InvoiceDS'>
> 		<operation name='getInvoiceDataOperation'>
> 			<input message='tns:InvoiceDS_getInvoiceData' />
> 			<output
> message='tns:InvoiceDS_getInvoiceDataResponse' />
> 		</operation>
> 	</portType>
>    public localhost.jaws.GetInvoiceDataResponse getInvoiceDataOperation(
>         @WebParam(targetNamespace = "http://localhost/jaws", partName = "parameters", name = "getInvoiceData")
>         localhost.jaws.GetInvoiceData parameters
>     );
> Seems to be a problem when there are multiple elements with the same name (a datatype and a message) but I'm assuming that should be ok according to the specs - since the WSDL works with other SOAP stacks (.Net, Axis2, JBoss-WS)?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CXF-1052) CXF throws ClassCastException from generated client code [when multiple elements have the same name in WSDL]

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

Peter Liljenberg updated CXF-1052:
----------------------------------

    Summary: CXF throws ClassCastException from generated client code [when multiple elements have the same name in WSDL]  (was: CXF generates errornous client code when multiple elements have the same name in WSDL)

> CXF throws ClassCastException from generated client code [when multiple elements have the same name in WSDL]
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-1052
>                 URL: https://issues.apache.org/jira/browse/CXF-1052
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime
>    Affects Versions: 2.0.1
>         Environment: Windows XP, Java 1.5
>            Reporter: Peter Liljenberg
>            Priority: Blocker
>         Attachments: InvoiceWs.wsdl
>
>
> I'm getting ClassCastExceptions from within a dynamically created proxy when using CXF as a client against a webservice. The WSDL for the service is attached, but some parts are shown here:
>  <message name='InvoiceDS_getInvoiceData'>
>   <part element='tns:getInvoiceData' name='parameters'/>  </message> <message name='InvoiceDS_getInvoiceDataResponse'>
>   <part element='tns:getInvoiceDataResponse' name='result'/>  </message> <portType name='InvoiceDS'>
>   <operation name='getInvoiceData'>
>    <input message='tns:InvoiceDS_getInvoiceData'/>
>    <output message='tns:InvoiceDS_getInvoiceDataResponse'/>
>    <fault message='tns:WebServiceFault' name='WebService'/>
>   </operation>
>  </portType>
> All classes are genereated with WSDL2Java, the resulting interface for the service being (removed annotations for readability):
> public interface InvoiceDS {
>     public java.util.List<localhost.jaws.InvoiceData> getInvoiceData(
>         localhost.jaws.InvoiceRequest invoiceRequest
>     ) throws WebServiceFault_Exception;
> }
> The InvoiceDS interface specifies that a List of InvoiceData objects should be returned from the method. This means that the GetInvoiceDataResponse type is not used and CXF must unwrap the result from the response before returning it to the client.
> My testcode looks something like this:
> {
>        QName SERVICE = new QName("http://localhost/jaws", "InvoiceServiceDS");
>         InvoiceServiceDS service = new InvoiceServiceDS(new URL("InvoiceWs.wsdl"), SERVICE);
>         InvoiceDS client =service.getInvoiceDSPort();
>         InvoiceRequest invoiceRequest = new InvoiceRequest();
>         invoiceRequest.setCustId("test123");
>         List<InvoiceData> invoiceData =
> client.getInvoiceData(invoiceRequest);
> }
> Digging into the CXF framework with the debugger we end up in the
> JaxWsClientProxy.invoke() method, line 191 has the return statement:
> 191        return result;
> result is of type GetInvoiceDataResponse (as specified in the WSDL) and not the list that was expected.
> After looking into this issue more closely I discovered that the problem arises from the fact that 2 elements in the WSDL have the same name and this makes CXF generate the wrong client code.
> Snippet of original WSDL file:
>    <complexType name='InvoiceData'>
>     <sequence>
>      <element name='custID' nillable='true' type='string'/>
>     </sequence>
>    </complexType>
>    <complexType name='InvoiceRequest'>
>     <sequence>
>      <element name='custId' nillable='true' type='string'/>
>     </sequence>
>    </complexType>
>    <complexType name='getInvoiceData'>
>     <sequence>
>      <element name='InvoiceRequest' nillable='true'
> type='tns:InvoiceRequest'/>
>     </sequence>
>    </complexType>
>    <complexType name='getInvoiceDataResponse'>
>     <sequence>
>      <element maxOccurs='unbounded' minOccurs='0' name='result'
> nillable='true' type='tns:InvoiceData'/>
>     </sequence>
>    </complexType>
>    <element name='getInvoiceData' type='tns:getInvoiceData'/>
>    <element name='getInvoiceDataResponse'
> type='tns:getInvoiceDataResponse'/>
>   </schema>
>  </types>
>  <message name='InvoiceDS_getInvoiceData'>
>   <part element='tns:getInvoiceData' name='parameters'/>  </message>  <message name='InvoiceDS_getInvoiceDataResponse'>
>   <part element='tns:getInvoiceDataResponse' name='result'/>  </message>  <portType name='InvoiceDS'>
>   <operation name='getInvoiceData'>
>    <input message='tns:InvoiceDS_getInvoiceData'/>
>    <output message='tns:InvoiceDS_getInvoiceDataResponse'/>
>   </operation>
>  </portType>
> ------
> In the new version I've changed the operation name to "getInvoiceDataOperation" and thus CXF will render a working client for me.
> WSDL snippet:
> 			<complexType name='InvoiceData'>
> 				<sequence>
> 					<element name='custID'
> nillable='true'
> 						type='string' />
> 				</sequence>
> 			</complexType>
> 			<complexType name='InvoiceRequest'>
> 				<sequence>
> 					<element name='custId'
> nillable='true'
> 						type='string' />
> 				</sequence>
> 			</complexType>
> 			<complexType name='getInvoiceData'>
> 				<sequence>
> 					<element name='InvoiceRequest'
> nillable='true'
> 	
> type='tns:InvoiceRequest' />
> 				</sequence>
> 			</complexType>
> 			<complexType name='getInvoiceDataResponse'>
> 				<sequence>
> 					<element maxOccurs='unbounded'
> minOccurs='0'
> 						name='result'
> nillable='true' type='tns:InvoiceData' />
> 				</sequence>
> 			</complexType>
> 			<element name='getInvoiceData'
> type='tns:getInvoiceData' />
> 			<element name='getInvoiceDataResponse'
> 				type='tns:getInvoiceDataResponse' />
> 		</schema>
> 	</types>
> 	<message name='InvoiceDS_getInvoiceData'>
> 		<part element='tns:getInvoiceData' name='parameters' />
> 	</message>
> 	<message name='InvoiceDS_getInvoiceDataResponse'>
> 		<part element='tns:getInvoiceDataResponse' name='result'
> />
> 	</message>
> 	<portType name='InvoiceDS'>
> 		<operation name='getInvoiceDataOperation'>
> 			<input message='tns:InvoiceDS_getInvoiceData' />
> 			<output
> message='tns:InvoiceDS_getInvoiceDataResponse' />
> 		</operation>
> 	</portType>
>    public localhost.jaws.GetInvoiceDataResponse getInvoiceDataOperation(
>         @WebParam(targetNamespace = "http://localhost/jaws", partName = "parameters", name = "getInvoiceData")
>         localhost.jaws.GetInvoiceData parameters
>     );
> Seems to be a problem when there are multiple elements with the same name (a datatype and a message) but I'm assuming that should be ok according to the specs - since the WSDL works with other SOAP stacks (.Net, Axis2, JBoss-WS)?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CXF-1052) CXF generates errornous client code when multiple elements have the same name in WSDL

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

Peter Liljenberg updated CXF-1052:
----------------------------------

    Attachment: InvoiceWs.wsdl

> CXF generates errornous client code when multiple elements have the same name in WSDL
> -------------------------------------------------------------------------------------
>
>                 Key: CXF-1052
>                 URL: https://issues.apache.org/jira/browse/CXF-1052
>             Project: CXF
>          Issue Type: Bug
>          Components: Tooling
>    Affects Versions: 2.0.1
>         Environment: Windows XP, Java 1.5
>            Reporter: Peter Liljenberg
>            Priority: Blocker
>         Attachments: InvoiceWs.wsdl
>
>
> I'm getting ClassCastExceptions from within a dynamically created proxy when using CXF as a client against a webservice. The WSDL for the service is attached, but some parts are shown here:
>  <message name='InvoiceDS_getInvoiceData'>
>   <part element='tns:getInvoiceData' name='parameters'/>  </message> <message name='InvoiceDS_getInvoiceDataResponse'>
>   <part element='tns:getInvoiceDataResponse' name='result'/>  </message> <portType name='InvoiceDS'>
>   <operation name='getInvoiceData'>
>    <input message='tns:InvoiceDS_getInvoiceData'/>
>    <output message='tns:InvoiceDS_getInvoiceDataResponse'/>
>    <fault message='tns:WebServiceFault' name='WebService'/>
>   </operation>
>  </portType>
> All classes are genereated with WSDL2Java, the resulting interface for the service being (removed annotations for readability):
> public interface InvoiceDS {
>     public java.util.List<localhost.jaws.InvoiceData> getInvoiceData(
>         localhost.jaws.InvoiceRequest invoiceRequest
>     ) throws WebServiceFault_Exception;
> }
> The InvoiceDS interface specifies that a List of InvoiceData objects should be returned from the method. This means that the GetInvoiceDataResponse type is not used and CXF must unwrap the result from the response before returning it to the client.
> My testcode looks something like this:
> {
>        QName SERVICE = new QName("http://localhost/jaws", "InvoiceServiceDS");
>         InvoiceServiceDS service = new InvoiceServiceDS(new URL("InvoiceWs.wsdl"), SERVICE);
>         InvoiceDS client =service.getInvoiceDSPort();
>         InvoiceRequest invoiceRequest = new InvoiceRequest();
>         invoiceRequest.setCustId("test123");
>         List<InvoiceData> invoiceData =
> client.getInvoiceData(invoiceRequest);
> }
> Digging into the CXF framework with the debugger we end up in the
> JaxWsClientProxy.invoke() method, line 191 has the return statement:
> 191        return result;
> result is of type GetInvoiceDataResponse (as specified in the WSDL) and not the list that was expected.
> After looking into this issue more closely I discovered that the problem arises from the fact that 2 elements in the WSDL have the same name and this makes CXF generate the wrong client code.
> Snippet of original WSDL file:
>    <complexType name='InvoiceData'>
>     <sequence>
>      <element name='custID' nillable='true' type='string'/>
>     </sequence>
>    </complexType>
>    <complexType name='InvoiceRequest'>
>     <sequence>
>      <element name='custId' nillable='true' type='string'/>
>     </sequence>
>    </complexType>
>    <complexType name='getInvoiceData'>
>     <sequence>
>      <element name='InvoiceRequest' nillable='true'
> type='tns:InvoiceRequest'/>
>     </sequence>
>    </complexType>
>    <complexType name='getInvoiceDataResponse'>
>     <sequence>
>      <element maxOccurs='unbounded' minOccurs='0' name='result'
> nillable='true' type='tns:InvoiceData'/>
>     </sequence>
>    </complexType>
>    <element name='getInvoiceData' type='tns:getInvoiceData'/>
>    <element name='getInvoiceDataResponse'
> type='tns:getInvoiceDataResponse'/>
>   </schema>
>  </types>
>  <message name='InvoiceDS_getInvoiceData'>
>   <part element='tns:getInvoiceData' name='parameters'/>  </message>  <message name='InvoiceDS_getInvoiceDataResponse'>
>   <part element='tns:getInvoiceDataResponse' name='result'/>  </message>  <portType name='InvoiceDS'>
>   <operation name='getInvoiceData'>
>    <input message='tns:InvoiceDS_getInvoiceData'/>
>    <output message='tns:InvoiceDS_getInvoiceDataResponse'/>
>   </operation>
>  </portType>
> ------
> In the new version I've changed the operation name to "getInvoiceDataOperation" and thus CXF will render a working client for me.
> WSDL snippet:
> 			<complexType name='InvoiceData'>
> 				<sequence>
> 					<element name='custID'
> nillable='true'
> 						type='string' />
> 				</sequence>
> 			</complexType>
> 			<complexType name='InvoiceRequest'>
> 				<sequence>
> 					<element name='custId'
> nillable='true'
> 						type='string' />
> 				</sequence>
> 			</complexType>
> 			<complexType name='getInvoiceData'>
> 				<sequence>
> 					<element name='InvoiceRequest'
> nillable='true'
> 	
> type='tns:InvoiceRequest' />
> 				</sequence>
> 			</complexType>
> 			<complexType name='getInvoiceDataResponse'>
> 				<sequence>
> 					<element maxOccurs='unbounded'
> minOccurs='0'
> 						name='result'
> nillable='true' type='tns:InvoiceData' />
> 				</sequence>
> 			</complexType>
> 			<element name='getInvoiceData'
> type='tns:getInvoiceData' />
> 			<element name='getInvoiceDataResponse'
> 				type='tns:getInvoiceDataResponse' />
> 		</schema>
> 	</types>
> 	<message name='InvoiceDS_getInvoiceData'>
> 		<part element='tns:getInvoiceData' name='parameters' />
> 	</message>
> 	<message name='InvoiceDS_getInvoiceDataResponse'>
> 		<part element='tns:getInvoiceDataResponse' name='result'
> />
> 	</message>
> 	<portType name='InvoiceDS'>
> 		<operation name='getInvoiceDataOperation'>
> 			<input message='tns:InvoiceDS_getInvoiceData' />
> 			<output
> message='tns:InvoiceDS_getInvoiceDataResponse' />
> 		</operation>
> 	</portType>
>    public localhost.jaws.GetInvoiceDataResponse getInvoiceDataOperation(
>         @WebParam(targetNamespace = "http://localhost/jaws", partName = "parameters", name = "getInvoiceData")
>         localhost.jaws.GetInvoiceData parameters
>     );
> Seems to be a problem when there are multiple elements with the same name (a datatype and a message) but I'm assuming that should be ok according to the specs - since the WSDL works with other SOAP stacks (.Net, Axis2, JBoss-WS)?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CXF-1052) CXF generates errornous client code when multiple elements have the same name in WSDL

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

Peter Liljenberg updated CXF-1052:
----------------------------------

    Component/s:     (was: Tooling)
                 JAX-WS Runtime

> CXF generates errornous client code when multiple elements have the same name in WSDL
> -------------------------------------------------------------------------------------
>
>                 Key: CXF-1052
>                 URL: https://issues.apache.org/jira/browse/CXF-1052
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime
>    Affects Versions: 2.0.1
>         Environment: Windows XP, Java 1.5
>            Reporter: Peter Liljenberg
>            Priority: Blocker
>         Attachments: InvoiceWs.wsdl
>
>
> I'm getting ClassCastExceptions from within a dynamically created proxy when using CXF as a client against a webservice. The WSDL for the service is attached, but some parts are shown here:
>  <message name='InvoiceDS_getInvoiceData'>
>   <part element='tns:getInvoiceData' name='parameters'/>  </message> <message name='InvoiceDS_getInvoiceDataResponse'>
>   <part element='tns:getInvoiceDataResponse' name='result'/>  </message> <portType name='InvoiceDS'>
>   <operation name='getInvoiceData'>
>    <input message='tns:InvoiceDS_getInvoiceData'/>
>    <output message='tns:InvoiceDS_getInvoiceDataResponse'/>
>    <fault message='tns:WebServiceFault' name='WebService'/>
>   </operation>
>  </portType>
> All classes are genereated with WSDL2Java, the resulting interface for the service being (removed annotations for readability):
> public interface InvoiceDS {
>     public java.util.List<localhost.jaws.InvoiceData> getInvoiceData(
>         localhost.jaws.InvoiceRequest invoiceRequest
>     ) throws WebServiceFault_Exception;
> }
> The InvoiceDS interface specifies that a List of InvoiceData objects should be returned from the method. This means that the GetInvoiceDataResponse type is not used and CXF must unwrap the result from the response before returning it to the client.
> My testcode looks something like this:
> {
>        QName SERVICE = new QName("http://localhost/jaws", "InvoiceServiceDS");
>         InvoiceServiceDS service = new InvoiceServiceDS(new URL("InvoiceWs.wsdl"), SERVICE);
>         InvoiceDS client =service.getInvoiceDSPort();
>         InvoiceRequest invoiceRequest = new InvoiceRequest();
>         invoiceRequest.setCustId("test123");
>         List<InvoiceData> invoiceData =
> client.getInvoiceData(invoiceRequest);
> }
> Digging into the CXF framework with the debugger we end up in the
> JaxWsClientProxy.invoke() method, line 191 has the return statement:
> 191        return result;
> result is of type GetInvoiceDataResponse (as specified in the WSDL) and not the list that was expected.
> After looking into this issue more closely I discovered that the problem arises from the fact that 2 elements in the WSDL have the same name and this makes CXF generate the wrong client code.
> Snippet of original WSDL file:
>    <complexType name='InvoiceData'>
>     <sequence>
>      <element name='custID' nillable='true' type='string'/>
>     </sequence>
>    </complexType>
>    <complexType name='InvoiceRequest'>
>     <sequence>
>      <element name='custId' nillable='true' type='string'/>
>     </sequence>
>    </complexType>
>    <complexType name='getInvoiceData'>
>     <sequence>
>      <element name='InvoiceRequest' nillable='true'
> type='tns:InvoiceRequest'/>
>     </sequence>
>    </complexType>
>    <complexType name='getInvoiceDataResponse'>
>     <sequence>
>      <element maxOccurs='unbounded' minOccurs='0' name='result'
> nillable='true' type='tns:InvoiceData'/>
>     </sequence>
>    </complexType>
>    <element name='getInvoiceData' type='tns:getInvoiceData'/>
>    <element name='getInvoiceDataResponse'
> type='tns:getInvoiceDataResponse'/>
>   </schema>
>  </types>
>  <message name='InvoiceDS_getInvoiceData'>
>   <part element='tns:getInvoiceData' name='parameters'/>  </message>  <message name='InvoiceDS_getInvoiceDataResponse'>
>   <part element='tns:getInvoiceDataResponse' name='result'/>  </message>  <portType name='InvoiceDS'>
>   <operation name='getInvoiceData'>
>    <input message='tns:InvoiceDS_getInvoiceData'/>
>    <output message='tns:InvoiceDS_getInvoiceDataResponse'/>
>   </operation>
>  </portType>
> ------
> In the new version I've changed the operation name to "getInvoiceDataOperation" and thus CXF will render a working client for me.
> WSDL snippet:
> 			<complexType name='InvoiceData'>
> 				<sequence>
> 					<element name='custID'
> nillable='true'
> 						type='string' />
> 				</sequence>
> 			</complexType>
> 			<complexType name='InvoiceRequest'>
> 				<sequence>
> 					<element name='custId'
> nillable='true'
> 						type='string' />
> 				</sequence>
> 			</complexType>
> 			<complexType name='getInvoiceData'>
> 				<sequence>
> 					<element name='InvoiceRequest'
> nillable='true'
> 	
> type='tns:InvoiceRequest' />
> 				</sequence>
> 			</complexType>
> 			<complexType name='getInvoiceDataResponse'>
> 				<sequence>
> 					<element maxOccurs='unbounded'
> minOccurs='0'
> 						name='result'
> nillable='true' type='tns:InvoiceData' />
> 				</sequence>
> 			</complexType>
> 			<element name='getInvoiceData'
> type='tns:getInvoiceData' />
> 			<element name='getInvoiceDataResponse'
> 				type='tns:getInvoiceDataResponse' />
> 		</schema>
> 	</types>
> 	<message name='InvoiceDS_getInvoiceData'>
> 		<part element='tns:getInvoiceData' name='parameters' />
> 	</message>
> 	<message name='InvoiceDS_getInvoiceDataResponse'>
> 		<part element='tns:getInvoiceDataResponse' name='result'
> />
> 	</message>
> 	<portType name='InvoiceDS'>
> 		<operation name='getInvoiceDataOperation'>
> 			<input message='tns:InvoiceDS_getInvoiceData' />
> 			<output
> message='tns:InvoiceDS_getInvoiceDataResponse' />
> 		</operation>
> 	</portType>
>    public localhost.jaws.GetInvoiceDataResponse getInvoiceDataOperation(
>         @WebParam(targetNamespace = "http://localhost/jaws", partName = "parameters", name = "getInvoiceData")
>         localhost.jaws.GetInvoiceData parameters
>     );
> Seems to be a problem when there are multiple elements with the same name (a datatype and a message) but I'm assuming that should be ok according to the specs - since the WSDL works with other SOAP stacks (.Net, Axis2, JBoss-WS)?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CXF-1052) CXF generates errornous client code when multiple elements have the same name in WSDL

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

Peter Liljenberg updated CXF-1052:
----------------------------------

    Component/s:     (was: JAX-WS Runtime)
                 Tooling

Debuggning the WSDL2Java generation I stumble upon the code in WSDLServiceBuilder that checks for "rules".

        // RULE No.2:
        // The input message part refers to a global element decalration whose
        // localname
        // is equal to the operation name
        MessagePartInfo inputPart = inputMessage.getMessagePartByIndex(0);
        if (!inputPart.isElement()) {
            passedRule = false;
        } else {
            QName inputElementName = inputPart.getElementQName();
            inputEl = schemas.getElementByQName(inputElementName);
            if (inputEl == null || !opInfo.getName().getLocalPart().equals(inputElementName.getLocalPart())) {
                passedRule = false;
            }
        }

        if (!passedRule) {
            return;
        }

This rule breaks down if we run it with the WSDL that I provided for this issue. If i just set the passedRule variable to false after this rule my generated client will work just fine! Is this rule really valid to enable wrapping or not?

> CXF generates errornous client code when multiple elements have the same name in WSDL
> -------------------------------------------------------------------------------------
>
>                 Key: CXF-1052
>                 URL: https://issues.apache.org/jira/browse/CXF-1052
>             Project: CXF
>          Issue Type: Bug
>          Components: Tooling
>    Affects Versions: 2.0.1
>         Environment: Windows XP, Java 1.5
>            Reporter: Peter Liljenberg
>            Priority: Blocker
>
> I'm getting ClassCastExceptions from within a dynamically created proxy when using CXF as a client against a webservice. The WSDL for the service is attached, but some parts are shown here:
>  <message name='InvoiceDS_getInvoiceData'>
>   <part element='tns:getInvoiceData' name='parameters'/>  </message> <message name='InvoiceDS_getInvoiceDataResponse'>
>   <part element='tns:getInvoiceDataResponse' name='result'/>  </message> <portType name='InvoiceDS'>
>   <operation name='getInvoiceData'>
>    <input message='tns:InvoiceDS_getInvoiceData'/>
>    <output message='tns:InvoiceDS_getInvoiceDataResponse'/>
>    <fault message='tns:WebServiceFault' name='WebService'/>
>   </operation>
>  </portType>
> All classes are genereated with WSDL2Java, the resulting interface for the service being (removed annotations for readability):
> public interface InvoiceDS {
>     public java.util.List<localhost.jaws.InvoiceData> getInvoiceData(
>         localhost.jaws.InvoiceRequest invoiceRequest
>     ) throws WebServiceFault_Exception;
> }
> The InvoiceDS interface specifies that a List of InvoiceData objects should be returned from the method. This means that the GetInvoiceDataResponse type is not used and CXF must unwrap the result from the response before returning it to the client.
> My testcode looks something like this:
> {
>        QName SERVICE = new QName("http://localhost/jaws", "InvoiceServiceDS");
>         InvoiceServiceDS service = new InvoiceServiceDS(new URL("InvoiceWs.wsdl"), SERVICE);
>         InvoiceDS client =service.getInvoiceDSPort();
>         InvoiceRequest invoiceRequest = new InvoiceRequest();
>         invoiceRequest.setCustId("test123");
>         List<InvoiceData> invoiceData =
> client.getInvoiceData(invoiceRequest);
> }
> Digging into the CXF framework with the debugger we end up in the
> JaxWsClientProxy.invoke() method, line 191 has the return statement:
> 191        return result;
> result is of type GetInvoiceDataResponse (as specified in the WSDL) and not the list that was expected.
> After looking into this issue more closely I discovered that the problem arises from the fact that 2 elements in the WSDL have the same name and this makes CXF generate the wrong client code.
> Snippet of original WSDL file:
>    <complexType name='InvoiceData'>
>     <sequence>
>      <element name='custID' nillable='true' type='string'/>
>     </sequence>
>    </complexType>
>    <complexType name='InvoiceRequest'>
>     <sequence>
>      <element name='custId' nillable='true' type='string'/>
>     </sequence>
>    </complexType>
>    <complexType name='getInvoiceData'>
>     <sequence>
>      <element name='InvoiceRequest' nillable='true'
> type='tns:InvoiceRequest'/>
>     </sequence>
>    </complexType>
>    <complexType name='getInvoiceDataResponse'>
>     <sequence>
>      <element maxOccurs='unbounded' minOccurs='0' name='result'
> nillable='true' type='tns:InvoiceData'/>
>     </sequence>
>    </complexType>
>    <element name='getInvoiceData' type='tns:getInvoiceData'/>
>    <element name='getInvoiceDataResponse'
> type='tns:getInvoiceDataResponse'/>
>   </schema>
>  </types>
>  <message name='InvoiceDS_getInvoiceData'>
>   <part element='tns:getInvoiceData' name='parameters'/>  </message>  <message name='InvoiceDS_getInvoiceDataResponse'>
>   <part element='tns:getInvoiceDataResponse' name='result'/>  </message>  <portType name='InvoiceDS'>
>   <operation name='getInvoiceData'>
>    <input message='tns:InvoiceDS_getInvoiceData'/>
>    <output message='tns:InvoiceDS_getInvoiceDataResponse'/>
>   </operation>
>  </portType>
> ------
> In the new version I've changed the operation name to "getInvoiceDataOperation" and thus CXF will render a working client for me.
> WSDL snippet:
> 			<complexType name='InvoiceData'>
> 				<sequence>
> 					<element name='custID'
> nillable='true'
> 						type='string' />
> 				</sequence>
> 			</complexType>
> 			<complexType name='InvoiceRequest'>
> 				<sequence>
> 					<element name='custId'
> nillable='true'
> 						type='string' />
> 				</sequence>
> 			</complexType>
> 			<complexType name='getInvoiceData'>
> 				<sequence>
> 					<element name='InvoiceRequest'
> nillable='true'
> 	
> type='tns:InvoiceRequest' />
> 				</sequence>
> 			</complexType>
> 			<complexType name='getInvoiceDataResponse'>
> 				<sequence>
> 					<element maxOccurs='unbounded'
> minOccurs='0'
> 						name='result'
> nillable='true' type='tns:InvoiceData' />
> 				</sequence>
> 			</complexType>
> 			<element name='getInvoiceData'
> type='tns:getInvoiceData' />
> 			<element name='getInvoiceDataResponse'
> 				type='tns:getInvoiceDataResponse' />
> 		</schema>
> 	</types>
> 	<message name='InvoiceDS_getInvoiceData'>
> 		<part element='tns:getInvoiceData' name='parameters' />
> 	</message>
> 	<message name='InvoiceDS_getInvoiceDataResponse'>
> 		<part element='tns:getInvoiceDataResponse' name='result'
> />
> 	</message>
> 	<portType name='InvoiceDS'>
> 		<operation name='getInvoiceDataOperation'>
> 			<input message='tns:InvoiceDS_getInvoiceData' />
> 			<output
> message='tns:InvoiceDS_getInvoiceDataResponse' />
> 		</operation>
> 	</portType>
>    public localhost.jaws.GetInvoiceDataResponse getInvoiceDataOperation(
>         @WebParam(targetNamespace = "http://localhost/jaws", partName = "parameters", name = "getInvoiceData")
>         localhost.jaws.GetInvoiceData parameters
>     );
> Seems to be a problem when there are multiple elements with the same name (a datatype and a message) but I'm assuming that should be ok according to the specs - since the WSDL works with other SOAP stacks (.Net, Axis2, JBoss-WS)?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CXF-1052) CXF throws ClassCastException from generated client code [when multiple elements have the same name in WSDL]

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

Peter Liljenberg resolved CXF-1052.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.2

Seems to be working just fine in 2.0.2. Thanks! 
Keep up the good work!

> CXF throws ClassCastException from generated client code [when multiple elements have the same name in WSDL]
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-1052
>                 URL: https://issues.apache.org/jira/browse/CXF-1052
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime
>    Affects Versions: 2.0.1
>         Environment: Windows XP, Java 1.5
>            Reporter: Peter Liljenberg
>            Priority: Blocker
>             Fix For: 2.0.2
>
>         Attachments: InvoiceWs.wsdl
>
>
> I'm getting ClassCastExceptions from within a dynamically created proxy when using CXF as a client against a webservice. The WSDL for the service is attached, but some parts are shown here:
>  <message name='InvoiceDS_getInvoiceData'>
>   <part element='tns:getInvoiceData' name='parameters'/>  </message> <message name='InvoiceDS_getInvoiceDataResponse'>
>   <part element='tns:getInvoiceDataResponse' name='result'/>  </message> <portType name='InvoiceDS'>
>   <operation name='getInvoiceData'>
>    <input message='tns:InvoiceDS_getInvoiceData'/>
>    <output message='tns:InvoiceDS_getInvoiceDataResponse'/>
>    <fault message='tns:WebServiceFault' name='WebService'/>
>   </operation>
>  </portType>
> All classes are genereated with WSDL2Java, the resulting interface for the service being (removed annotations for readability):
> public interface InvoiceDS {
>     public java.util.List<localhost.jaws.InvoiceData> getInvoiceData(
>         localhost.jaws.InvoiceRequest invoiceRequest
>     ) throws WebServiceFault_Exception;
> }
> The InvoiceDS interface specifies that a List of InvoiceData objects should be returned from the method. This means that the GetInvoiceDataResponse type is not used and CXF must unwrap the result from the response before returning it to the client.
> My testcode looks something like this:
> {
>        QName SERVICE = new QName("http://localhost/jaws", "InvoiceServiceDS");
>         InvoiceServiceDS service = new InvoiceServiceDS(new URL("InvoiceWs.wsdl"), SERVICE);
>         InvoiceDS client =service.getInvoiceDSPort();
>         InvoiceRequest invoiceRequest = new InvoiceRequest();
>         invoiceRequest.setCustId("test123");
>         List<InvoiceData> invoiceData =
> client.getInvoiceData(invoiceRequest);
> }
> Digging into the CXF framework with the debugger we end up in the
> JaxWsClientProxy.invoke() method, line 191 has the return statement:
> 191        return result;
> result is of type GetInvoiceDataResponse (as specified in the WSDL) and not the list that was expected.
> After looking into this issue more closely I discovered that the problem arises from the fact that 2 elements in the WSDL have the same name and this makes CXF generate the wrong client code.
> Snippet of original WSDL file:
>    <complexType name='InvoiceData'>
>     <sequence>
>      <element name='custID' nillable='true' type='string'/>
>     </sequence>
>    </complexType>
>    <complexType name='InvoiceRequest'>
>     <sequence>
>      <element name='custId' nillable='true' type='string'/>
>     </sequence>
>    </complexType>
>    <complexType name='getInvoiceData'>
>     <sequence>
>      <element name='InvoiceRequest' nillable='true'
> type='tns:InvoiceRequest'/>
>     </sequence>
>    </complexType>
>    <complexType name='getInvoiceDataResponse'>
>     <sequence>
>      <element maxOccurs='unbounded' minOccurs='0' name='result'
> nillable='true' type='tns:InvoiceData'/>
>     </sequence>
>    </complexType>
>    <element name='getInvoiceData' type='tns:getInvoiceData'/>
>    <element name='getInvoiceDataResponse'
> type='tns:getInvoiceDataResponse'/>
>   </schema>
>  </types>
>  <message name='InvoiceDS_getInvoiceData'>
>   <part element='tns:getInvoiceData' name='parameters'/>  </message>  <message name='InvoiceDS_getInvoiceDataResponse'>
>   <part element='tns:getInvoiceDataResponse' name='result'/>  </message>  <portType name='InvoiceDS'>
>   <operation name='getInvoiceData'>
>    <input message='tns:InvoiceDS_getInvoiceData'/>
>    <output message='tns:InvoiceDS_getInvoiceDataResponse'/>
>   </operation>
>  </portType>
> ------
> In the new version I've changed the operation name to "getInvoiceDataOperation" and thus CXF will render a working client for me.
> WSDL snippet:
> 			<complexType name='InvoiceData'>
> 				<sequence>
> 					<element name='custID'
> nillable='true'
> 						type='string' />
> 				</sequence>
> 			</complexType>
> 			<complexType name='InvoiceRequest'>
> 				<sequence>
> 					<element name='custId'
> nillable='true'
> 						type='string' />
> 				</sequence>
> 			</complexType>
> 			<complexType name='getInvoiceData'>
> 				<sequence>
> 					<element name='InvoiceRequest'
> nillable='true'
> 	
> type='tns:InvoiceRequest' />
> 				</sequence>
> 			</complexType>
> 			<complexType name='getInvoiceDataResponse'>
> 				<sequence>
> 					<element maxOccurs='unbounded'
> minOccurs='0'
> 						name='result'
> nillable='true' type='tns:InvoiceData' />
> 				</sequence>
> 			</complexType>
> 			<element name='getInvoiceData'
> type='tns:getInvoiceData' />
> 			<element name='getInvoiceDataResponse'
> 				type='tns:getInvoiceDataResponse' />
> 		</schema>
> 	</types>
> 	<message name='InvoiceDS_getInvoiceData'>
> 		<part element='tns:getInvoiceData' name='parameters' />
> 	</message>
> 	<message name='InvoiceDS_getInvoiceDataResponse'>
> 		<part element='tns:getInvoiceDataResponse' name='result'
> />
> 	</message>
> 	<portType name='InvoiceDS'>
> 		<operation name='getInvoiceDataOperation'>
> 			<input message='tns:InvoiceDS_getInvoiceData' />
> 			<output
> message='tns:InvoiceDS_getInvoiceDataResponse' />
> 		</operation>
> 	</portType>
>    public localhost.jaws.GetInvoiceDataResponse getInvoiceDataOperation(
>         @WebParam(targetNamespace = "http://localhost/jaws", partName = "parameters", name = "getInvoiceData")
>         localhost.jaws.GetInvoiceData parameters
>     );
> Seems to be a problem when there are multiple elements with the same name (a datatype and a message) but I'm assuming that should be ok according to the specs - since the WSDL works with other SOAP stacks (.Net, Axis2, JBoss-WS)?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.