Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JAXB marshalling: a required object is missing

843834Jul 17 2003 — edited Nov 23 2003
Hi,

Theres not much to be found on the new JAXB, so I'll open with a question here. My schema looks like this:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="1.0">
  <xs:element name="getUserListRequest">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="sessionId" type="xs:string"/>
        <xs:element name="webservice" type="xs:string"/>
        <xs:element name="group" type="xs:int"/>
        <xs:element name="company" type="xs:int"/>
        <xs:element name="stock" type="xs:int"/>
        <xs:element name="select" type="xs:boolean"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
And the code looks like this:
    ObjectFactory factory = new ObjectFactory();
    GetUserListRequest requestBean = factory.createGetUserListRequest();
    requestBean.setSessionId( sessionId1idTemp);
    requestBean.setGroup( Integer.parseInt( group2idTemp));
    requestBean.setCompany( Integer.parseInt( company3idTemp));
    requestBean.setStock( Integer.parseInt( stock4idTemp));
    requestBean.setSelect( "1".equals( select5idTemp)?true:false);

    DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
    Document document = docFactory.newDocumentBuilder().newDocument();

    JAXBContext context = JAXBContext.newInstance( "com.company.beans");
    Validator validator = context.createValidator();
    logger.info( "validator: " + validator.validate( request));

    Marshaller mar = context.createMarshaller();
    mar.marshal( request, document);
Anyways - no details from the DefaultValidationEventHandler - it just gives me the hashcode of the requestBean object.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 21 2003
Added on Jul 17 2003
3 comments
299 views