views:

223

answers:

1

Web service wsdl contains following schema:

<xs:complexType name="DocumentSearchInfo">
    <xs:sequence>
     ...
       <xs:element minOccurs="0" name="Industries" nillable="true" type="tns:ListCondition">
        <xs:annotation>
          <xs:appinfo>
            <DefaultValue EmitDefaultValue="false" xmlns="http://schemas.microsoft.com/2003/10/Serialization/" />
          </xs:appinfo>
        </xs:annotation>
       </xs:element>
   ...
    </xs:sequence>
  </xs:complexType>

This code was generated by adding a web reference in NetBeans 6.7:

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "DocumentSearchInfo", propOrder = {
    "analysts",
    "companyIDCondition",
    "contributorCondition",
    "countries",
    "dateRange",
    "documentIDCondition",
    "documentPageCondition",
    "industries",
    "keywordCondition",
    "languages",
    "profileID",
    "purchasedOnly",
    "regions",
    "researchCategories",
    "researchProduct"
})

    public class DocumentSearchInfo {
    ...
      @XmlElementRef(name = "Industries", namespace = "http://somenshere", type = JAXBElement.class)
        protected JAXBElement<ListCondition> industries;
    ...
    }

which, in its turn, serializes into

<ns2:SearchInfo>
 ...
   <ns2:ListCondition>
     <ns2:Values>
       <ns3:string>1385</ns3:string>
       <ns3:string>1386</ns3:string>
     </ns2:Values>
   </ns2:ListCondition>
 ...
</ns2:SearchInfo>

I expect to see 'Industries', not 'ListCondition' in this XML.

I had no problems consuming this service with .net: both svcutil and wsdl.exe work fine regardless of serializer used, but looks like I'm totally missing something obvious about serialization in Java.

Can anyone help?

+1  A: 

Resolved. I should have called createDocumentSearchInfoIndustries method of the ObjectFactory. Very different from what I was used to in .net )

Dmitry Ornatsky