cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Van Wart (JIRA)" <>
Subject [jira] Created: (CXF-3111) Empty SOAP element as argument to int[] parameter results in single-element of 0 int array
Date Fri, 05 Nov 2010 18:16:42 GMT
Empty SOAP element as argument to int[] parameter results in single-element of 0 int array

                 Key: CXF-3111
             Project: CXF
          Issue Type: Bug
          Components: JAXB Databinding
    Affects Versions: 2.2.11
         Environment: Ubuntu Maverick 64-bit, Java SE 1.6.0_20, Eclipse 3.6 Web Services Explorer,
Tomcat 6.0.26
            Reporter: Scott Van Wart

When I call a CXF-hosted web service that accepts an int array as a parameter, and I give
it an empty element as that parameter in the SOAP message, I end up with an int array with
a single element of '0'.

The SEI:

@WebService( name="intTest", targetNamespace="" )
public interface IntTest
  @WebMethod public String doTest(
    @WebParam( name="intArray" ) int[] intArray );

Inbound SOAP message:

<soapenv:Envelope xmlns:soapenv="" xmlns:q0=""
    xmlns:xsd="" xmlns:xsi="">

My implementation:

@WebService( endpointInterface="IntTest" )
public class IntTestImpl implements IntTest {
  public String doTest( int[] intArray ) {
    StringBuilder s = new StringBuilder( "[" );
    for ( int n = 0; n < intArray.length; ++n ) {
      if ( n > 0 ) {
        s.append( ',' );
      s.append( Integer.toString( intArray[n] ) );
    s.append( ']' );
    return s.toString();

Outbound SOAP message:

<soap:Envelope xmlns:soap="">
    <ns2:doTestResponse xmlns:ns2="">

Personally I would have expected either null or, more logically, an empty array to be passed
to my implementing method.  By giving a sentinal value in the array, it forces callers to
have separate checks and avoid sending the parameter if it has no value.  I wasn't sure whether
this was a data binding issue, something with CXF, or something about a specification I don't
understand, but I thought I'd try under JAXB binding.


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

View raw message