Hi,

I am connecting to a .NET webservice using CXF. I have generated the clients
using the wsd2ljava ant task. It works well for calling service methods to
get objects, but calling service method and passing an object with list of
objects does not work.

The outbound message is not formatted according to the schema. 

On .NET side I have this DTO (similar to this):

class UserRole {
  public IList<int> IntList {set; get;}
  public IList<Range> RangeList {set; get; }
}

class Range {
  public int Index {get; set;}
  public decimal Minimum {get; set;}
  public decimal Rate { get; set; }
  public int RangeType { get; set; }
}

The wsdl2java generates these java classes:

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "UserRole",
namespace="http://schemas.datacontract.org/2004/07/DTO";, propOrder={
  "intList",
  "rangeList"
})
class UserRole {
  @XmlElementRef(name = "IntList", namespace="...", type=JAXBElement.class,
required=false)
  protected JAXBElement<ArrayOfint> intList;
  @XmlElementRef(name = "RangeList", namespace="...",
type=JAXBElement.class, required=false)
  protected JAXBElement<ArrayOfRange> rangeList;
}

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ArrayOfint", namespace =
"http://schemas.microsoft.com/2003/10/Serialization/Arrays";, propOrder = {
    "_int"
})
class ArrayOfint {
  @XmlElement(name = "int", type = Integer.class)
    protected List<Integer> _int;
}

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ArrayOfRange", namespace =
"http://schemas.datacontract.org/2004/07/DTO";, propOrder = {
    "range"
})
class ArrayOfRange {
    @XmlElement(name = "Range", nillable = true)
    protected List<Range> range;
}

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Range", namespace =
"http://schemas.datacontract.org/2004/07/DTO";, propOrder = {
    "minimum",
    "index",
    "rate",
    "rangeType"
})
class Range {
    @XmlElement(name = "Minimum")
    protected BigDecimal minimum;
    @XmlElement(name = "Index")
    protected Integer index;
    @XmlElement(name = "Rate")
    protected BigDecimal rate;
    @XmlElement(name = "RangeType")
    protected Integer rangeType;
}


When I construct an object with ObjectFactory to of UserRole to pass it from
java to the .net side. The outbound message looks like this:

<ParamUserRole>
  <ns4:IntList>
     <ns3:int>1</ns3:int>
     <ns3:int>2</ns3:int>
  <ns4:IntList>
  <ns4:ArrayOfRange>
     <ns4:Range>
        <ns4:Minimum>1.00</ns4:Minimum>
        <ns4:Rate>1.00</ns4:Rate>
        <ns4:Index>1</ns4:Index>
        <ns4:RangeType>1</ns4:RangeType>
     </ns4:Range>
  </ns4:ArrayOfRange>
</ParamUserRole>


Although the message should look like this:


<ParamUserRole>
  <ns4:IntList>
     <ns3:int>1</ns3:int>
     <ns3:int>2</ns3:int>
  <ns4:IntList>
  <ns4:RangeList>
     <ns4:Range>
        <ns4:Minimum>1.00</ns4:Minimum>
        <ns4:Rate>1.00</ns4:Rate>
        <ns4:Index>1</ns4:Index>
        <ns4:RangeType>1</ns4:RangeType>
     </ns4:Range>
  </ns4:RangeList>
</ParamUserRole>


As you can see instead of ns4:RangeList the message contains
ns4:ArrayOfRange element.

I have tried with version 2.4.5 and 2.5.2.

Is there something I am missing during the wsdl2java call?
It seems to me the classes were defined with the proper names and field
names, yet the outbound message does not follow the schema.

Thank you,
Csaba

--
View this message in context: 
http://cxf.547215.n5.nabble.com/invalid-outbound-message-content-tp5544605p5544605.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to