1 Reply Latest reply on May 30, 2006 4:33 PM by Thomas Diesler

    Marshalling annotated JAXB 2.0 objects

    Derek Adams Newbie

      I have a JAX-WS 2.0 web service which deploys and works fine on 4.0.4GA. The XML generated for the SOAP request looks fine, but the marshalled version of my bean looks really nasty. Here is a snippet from the bean being marshalled:

      @Entity
      @Table(name = "scriptresults")
      @NamedQueries( {
       @NamedQuery(name = ScriptResultsQueries.RESULTS_BY_ID, query = "select sr from ScriptResults sr where sr.id = :id"),
       @NamedQuery(name = ScriptResultsQueries.ALL_SCRIPT_RESULTS, query = "select sr from ScriptResults sr") })
      public class ScriptResults implements Serializable {
      
       @Id
       @Column(name = "id")
       private String id;
      
       @Column(name = "startTime")
       private Calendar startTime;
      
       @Column(name = "endTime")
       private Calendar endTime;
      
       @Lob
       @Column(name = "metaData")
       private String metaData;
      
       @Column(name = "EClassifier")
       private String eClassifier;
      
       @Column(name = "suggestedResourceName")
       private String suggestedResourceName;
      
       @Column(name = "externalJobId")
       private Long externalJobId;
      


      ... and here is what the SOAP response looks like ...

      <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
       <env:Header/>
       <env:Body>
       <ns1:GetScriptResultsByIdResponse xmlns:ns1="http://cadtel.com/cam" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
       <ns1:result>
       <ns_EClassifier:EClassifier xmlns:ns_EClassifier="http://model.reporting.portal.cam/jaws">test</ns_EClassifier:EClassifier>
       <ns_createdBy:createdBy xmlns:ns_createdBy="http://model.reporting.portal.cam/jaws">dadams</ns_createdBy:createdBy>
       <ns_creationTime:creationTime xmlns:ns_creationTime="http://model.reporting.portal.cam/jaws">2006-05-07T23:00:00.000-05:00</ns_creationTime:creationTime>
       <ns_deviceId:deviceId xmlns:ns_deviceId="http://model.reporting.portal.cam/jaws">xxx</ns_deviceId:deviceId>
       <ns_endTime:endTime xmlns:ns_endTime="http://model.reporting.portal.cam/jaws">2006-05-18T23:00:00.000-05:00</ns_endTime:endTime>
       <ns_externalJobId:externalJobId xmlns:ns_externalJobId="http://model.reporting.portal.cam/jaws">0</ns_externalJobId:externalJobId>
       <ns_fileId:fileId xmlns:ns_fileId="http://model.reporting.portal.cam/jaws">fileid</ns_fileId:fileId>
       <ns_id:id xmlns:ns_id="http://model.reporting.portal.cam/jaws">uid</ns_id:id>
       <ns_iterationSeqNumber:iterationSeqNumber xmlns:ns_iterationSeqNumber="http://model.reporting.portal.cam/jaws">1</ns_iterationSeqNumber:iterationSeqNumber>
       <ns_lastModified:lastModified xmlns:ns_lastModified="http://model.reporting.portal.cam/jaws">2006-05-23T23:00:00.000-05:00</ns_lastModified:lastModified>
       <ns_lastModifiedBy:lastModifiedBy xmlns:ns_lastModifiedBy="http://model.reporting.portal.cam/jaws">dadams</ns_lastModifiedBy:lastModifiedBy>
       <ns_metaData:metaData xmlns:ns_metaData="http://model.reporting.portal.cam/jaws">lotsofdatagoeshere</ns_metaData:metaData>
       <ns_scriptLocation:scriptLocation xmlns:ns_scriptLocation="http://model.reporting.portal.cam/jaws">c:\test</ns_scriptLocation:scriptLocation>
       <ns_scriptVersion:scriptVersion xmlns:ns_scriptVersion="http://model.reporting.portal.cam/jaws">4.0.1</ns_scriptVersion:scriptVersion>
       <ns_startTime:startTime xmlns:ns_startTime="http://model.reporting.portal.cam/jaws">2006-04-30T23:00:00.000-05:00</ns_startTime:startTime>
       <ns_status:status xmlns:ns_status="http://model.reporting.portal.cam/jaws">0</ns_status:status>
       <ns_suggestedResourceName:suggestedResourceName xmlns:ns_suggestedResourceName="http://model.reporting.portal.cam/jaws">bubba</ns_suggestedResourceName:suggestedResourceName>
       <ns_taskResultId:taskResultId xmlns:ns_taskResultId="http://model.reporting.portal.cam/jaws">QQQ</ns_taskResultId:taskResultId>
       </ns1:result>
       </ns1:GetScriptResultsByIdResponse>
       </env:Body>
      </env:Envelope>


      Before swapping to the new JAX-WS stuff, I was using JAXB 2.0 annotations to marshal my object to XML and everything looked great. I tried adding the annotations back in, but they are ignored when JBoss generates the WSDL. Is there any kind of mapping file I can use to clean things up?

      Thanks,
      Derek