When consuming a webserice with CXF 2.1.4 (the generated client) I am having problem getting the response based on the following XSD snippet in the WSDL. CXF Generates a List representing it, but when I execute the service, the response comes null. I used wireshark to what I was reciving and indeed the response XMl is coming as expected, but CXF just give me null object. The exposed services is implemented using .NET.
Below the XSD of the response object. And
<!--- chunk -->
<s:element name="GestionSIIFResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GestionSIIFResult">
<s:complexType mixed="true">
<s:sequence>
<s:any />
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
<!--- chunk -->
And this is the response I am getting from the service:
<soap:Body>
<GestionSIIFResponse xmlns="http://tempuri.org/">
<GestionSIIFResult>
<Siif xmlns="">
<Pagina>NUY001B</Pagina>
<Exitos>
<ExitoRep>
<CodExito>SIL0082</CodExito>
<DesExito>La transaccion se ha aplicado satisfactoriamente</DesExito>
</ExitoRep>
</Exitos>
<InformacionCab/>
<Repeticiones/>
</Siif>
</GestionSIIFResult>
</GestionSIIFResponse>
Below is the Generated java class that should "hold" the response from the web service
/*
* some imports here
*/
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="GestionSIIFResult" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <any/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
#XmlAccessorType(XmlAccessType.FIELD)
#XmlType(name = "", propOrder = {
"gestionSIIFResult"
})
#XmlRootElement(name = "GestionSIIFResponse")
public class GestionSIIFResponse {
#XmlElement(name = "GestionSIIFResult")
protected GestionSIIFResponse.GestionSIIFResult gestionSIIFResult;
/**
* Gets the value of the gestionSIIFResult property.
*
* #return
* possible object is
* {#link GestionSIIFResponse.GestionSIIFResult }
*
*/
public GestionSIIFResponse.GestionSIIFResult getGestionSIIFResult() {
return gestionSIIFResult;
}
/**
* Sets the value of the gestionSIIFResult property.
*
* #param value
* allowed object is
* {#link GestionSIIFResponse.GestionSIIFResult }
*
*/
public void setGestionSIIFResult(GestionSIIFResponse.GestionSIIFResult value) {
this.gestionSIIFResult = value;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <any/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
#XmlAccessorType(XmlAccessType.FIELD)
#XmlType(name = "", propOrder = {
"content"
})
public static class GestionSIIFResult {
#XmlMixed
#XmlAnyElement(lax = true)
protected List<Object> content;
/**
* Gets the value of the content property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the content property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getContent().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {#link Object }
* {#link String }
*
*
*/
public List<Object> getContent() {
if (content == null) {
content = new ArrayList<Object>();
}
return this.content;
}
}
}
Below the generated proxy port
/**
* This class was generated by Apache CXF 2.1.4
* Mon Jan 17 12:02:39 COT 2011
* Generated source version: 2.1.4
*
*/
#WebService(targetNamespace = "http://tempuri.org/", name = "WSGYG05Soap")
#XmlSeeAlso({ObjectFactory.class})
public interface WSGYG05Soap {
#ResponseWrapper(localName = "GestionSIIFResponse", targetNamespace = "http://tempuri.org/", className = "suramericana.banw.servicios.tuya.v2.GestionSIIFResponse"/*"org.tempuri.GestionSIIFResponse"*/)
#RequestWrapper(localName = "GestionSIIF", targetNamespace = "http://tempuri.org/", className = "suramericana.banw.servicios.tuya.v2.GestionSIIF"/*"org.tempuri.GestionSIIF"*/)
#WebResult(name = "GestionSIIFResult", targetNamespace = "http://tempuri.org/")
#WebMethod(operationName = "GestionSIIF", action = "http://tempuri.org/GestionSIIF")
public GestionSIIFResponse.GestionSIIFResult gestionSIIF(
#WebParam(name = "Peticion", targetNamespace = "http://tempuri.org/")
GestionSIIF.Peticion peticion,
#WebParam(header = true,name="CabAut", targetNamespace = "http://tempuri.org/")
CabAut cabAut
);
//#ResponseWrapper(localName = "GestionSIIFResponse", targetNamespace = "http://tempuri.org/", className = "suramericana.banw.servicios.tuya.v2.GestionSIIFResponse"/*"org.tempuri.GestionSIIFResponse"*/)
//#RequestWrapper(localName = "GestionSIIF", targetNamespace = "http://tempuri.org/", className = "suramericana.banw.servicios.tuya.v2.GestionSIIF"/*"org.tempuri.GestionSIIF"*/)
//#WebResult(name = "GestionSIIFResult", targetNamespace = "http://tempuri.org/")
//#WebMethod(operationName = "GestionSIIF", action = "http://tempuri.org/GestionSIIF")
/*public GestionSIIFResponse.GestionSIIFResult gestionSIIF(
#WebParam(name = "Peticion", targetNamespace = "http://tempuri.org/")
GestionSIIF.Peticion peticion,
#WebParam(header = true,name="CabAut", targetNamespace = "http://tempuri.org/")
CabAut cabAut
);*/
}
The List returned by getContent() could potentially contains a variety of org.w3c.dom.Element, JAXBElement, or fully-bound classes.
If the JAXB context doesn't recognise the <Siif> element, then JAXB will play it safe and populate the list with a single Element object representing the <Siif> and its children. If it does recognise them , it'll either contain JAXBElementwhich in turn contains aSiifobject, or it may contain theSiif` object directly.
Java cannot express this variety in its types, so just binds to List<Object>.
Related
I'm currently working on generating Java classes from XSD files.
I created an XSD file using restrictions.
As example heredown, I want to parse a date in a specific format MMYY.
Example:
<xsd:element name="dummyDate" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:date">
<xsd:pattern value="MMYY" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
However, the generated class doesn't contain/import the restriction.
protected XMLGregorianCalendar dummyDate;
/**
* Gets the value of the dummyDate property.
*
* #return
* possible object is
* {#link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getdummyDate() {
return dummyDate;
}
/**
* Sets the value of the dummyDate property.
*
* #param value
* allowed object is
* {#link XMLGregorianCalendar }
*
*/
public void setdummyDate(XMLGregorianCalendar value) {
this.dummyDate= value;
}
Since I'm blocked with this issue, I'm having the two following questions:
What would be the best way to proceed in order to enable those
restriction while parsing?
How to implement it?
HINTS:
JAXB Bindings [https://docs.oracle.com/cd/E17802_01/webservices/webservices/docs/1.5/tutorial/doc/JAXBUsing4.html]
krasa-jaxb-tools [https://github.com/krasa/krasa-jaxb-tools]
Update
So I created I binding file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jaxb:bindings version="2.0" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
jaxb:extensionBindingPrefixes="xjc">
<jaxb:globalBindings>
<xjc:simple />
<xjc:serializable uid="-1" />
<jaxb:javaType name="java.util.Date" xmlType="xs:date"
parseMethod="general.CalendarFormatConverter.parseDate"
printMethod="general.CalendarFormatConverter.printDate" />
</jaxb:globalBindings>
</jaxb:bindings>
The CalendarFormatConverter.java:
package general;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class CalendarFormatConverter {
/**
* Calendar to custom format print to XML.
*
* #param val
* #return
*/
public static Date parseDate(String val) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MMYY");
Date date = null;
try {
date = simpleDateFormat.parse(val);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return date;
}
/**
* Date to custom format print to XML.
*
* #param val
* #return
*/
public static String printDate(Date val) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MMYY");
return simpleDateFormat.format(val);
}
}
So I can convert now, but the format of the date isn't matching the restrinction...
I have the following Classes, I'm basically re-writing some existing services and had to use 'wsimport' to generate the following classes from the wsdl. The Soap response has to be exactly similar to how it used to return in the legacy code. The following is the generated classes from the import.
Somehow the <return> element got added to the soap response, I've checked my classes and I do not see that anywhere in the imports that were generated. Any idea on how to remove these?
I looked at this solution here Remove element <return> in JAX-WS SOAP Response but it is not ideal for me.
package org.openuri;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import net.tds.msa.address.addressvalues.Values;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://xx.net/msa/Address/AddressValues.xsd}AddressValuesResponse"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
#XmlAccessorType(XmlAccessType.FIELD)
#XmlType(name = "", propOrder = {
"addressValuesResponse"
})
#XmlRootElement(name = "getPostDirectionalResponse")
public class GetPostDirectionalResponse {
#XmlElement(name = "AddressValuesResponse", namespace = "http://xx.net/msa/Address/AddressValues.xsd", required = true)
protected Values addressValuesResponse;
/**
* Gets the value of the addressValuesResponse property.
*
* #return
* possible object is
* {#link Values }
*
*/
public Values getAddressValuesResponse() {
return addressValuesResponse;
}
/**
* Sets the value of the addressValuesResponse property.
*
* #param value
* allowed object is
* {#link Values }
*
*/
public void setAddressValuesResponse(Values value) {
this.addressValuesResponse = value;
}
}
and
package net.xx.msa.address.addressvalues;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for values complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="values">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="AddressValue" type="{http://xx.net/msa/Address/AddressValues.xsd}AddressValue" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
#XmlAccessorType(XmlAccessType.FIELD)
#XmlType(name = "values", propOrder = {
"addressValue"
})
public class Values {
#XmlElement(name = "AddressValue")
protected List<AddressValue> addressValue;
/**
* Gets the value of the addressValue property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the addressValue property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getAddressValue().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {#link AddressValue }
*
*
*/
public List<AddressValue> getAddressValue() {
if (addressValue == null) {
addressValue = new ArrayList<AddressValue>();
}
return this.addressValue;
}
}
Response is where <return> element is added. How do I remove this without using soap handler in jaxws?
<ns3:getPostDirectionalResponse xmlns:ns2="http://xx.net/msa/Address/AddressValues.xsd" xmlns:ns3="http://www.openuri.org/">
<return>
<ns2:AddressValuesResponse>
<ns2:AddressValue>
<ns2:value>South</ns2:value>
<ns2:valueAbbrev>S</ns2:valueAbbrev>
</ns2:AddressValuesResponse>
</return>
</ns3:getPostDirectionalResponse>
In your service endpoint interface, add #SOAPBinding(parameterStyle=ParameterStyle.BARE) to your #WebMethod:
package org.openuri;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.ParameterStyle;
#WebService
public interface ExampleService {
#WebMethod
#SOAPBinding(parameterStyle=ParameterStyle.BARE)
GetPostDirectionalResponse getPostDirectional(String input);
}
This changes the generated schema (for me) for getPostDirectionalResponse element to:
<xs:element name="getPostDirectionalResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="AddressValuesResponse" type="tns:values" form="qualified"/>
</xs:sequence>
</xs:complexType>
</xs:element>
and the resultant soap response is bare (unwrapped, no <return>):
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns3:getPostDirectionalResponse xmlns:ns2="http://xx.net/msa/Address/AddressValues.xsd" xmlns:ns3="http://openuri.org/">
<ns2:AddressValuesResponse>
<AddressValue>hello</AddressValue>
</ns2:AddressValuesResponse>
</ns3:getPostDirectionalResponse>
</S:Body>
</S:Envelope>
However, BARE comes with a constraint - the service operation can only have one argument/input.
Hi i had the same problem and my solution was:
in the webservice file
#WebService(serviceName = "MyService")
public class MyService{
#WebResult(header = true, name = "ResponseLastWrapperElement", targetNamespace = "")
//the contain of the service
I hope this works for more people!!!
I'm working on a XML schema and I'd like to change the name of the field in the generated class from 'value' to 'name'. Here is what I would like my StackOverflow.xsd file to look like:
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:StackOverflow="http://stackoverflow.com"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
targetNamespace="http://stackoverflow.com"
attributeFormDefault="unqualified"
elementFormDefault="qualified"
jaxb:version="2.1">
<element name="toolbar">
<complexType>
<sequence>
<element name="action" type="StackOverflow:action" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute type="string" name="id" use="required"/>
</complexType>
</element>
<simpleType name="actionName">
<restriction base="string">
<enumeration value="Start"/>
<enumeration value="Stop"/>
<enumeration value="Cancel"/>
</restriction>
</simpleType>
<complexType name="action">
<simpleContent>
<extension base="StackOverflow:actionName">
<annotation>
<appinfo>
<!--This ensures that the field in the Action class will be called 'name' rather than 'value'-->
<jaxb:property name="name"/>
</appinfo>
</annotation>
<attribute name="isActive" type="boolean" default="false"/>
</extension>
</simpleContent>
</complexType>
</schema>
As you can see I've tried to add a jaxb:property to change the name of the field 'value' to 'name', but XJC is complaining that "Specified property customization is not used". Here is the command I ran
$ xjc StackOverflow.xsd -d tmp/
parsing a schema...
[ERROR] Specified property customization is not used.
line 33 of file:/D:/dev/workspace-action-engine/jris/jris/branches/action-engine/client/com.agfa.ris.client.lta/src/main/resources/com/agfa/ris/client/lta/listarea/controller/actionsmodel/StackOverflow.xsd
Failed to parse a schema.
If I remove this section from the XSD file:
<annotation>
<appinfo>
<!--This ensures that the field in the Action class will be called 'name' rather than 'value'-->
<jaxb:property name="name"/>
</appinfo>
</annotation>
, then this is the Action.java file that is created
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2015.05.20 at 09:05:26 AM CEST
//
package com.stackoverflow;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
/**
* <p>Java class for action complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="action">
* <simpleContent>
* <extension base="<http://stackoverflow.com>actionName">
* <attribute name="isActive" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
* </extension>
* </simpleContent>
* </complexType>
* </pre>
*
*
*/
#XmlAccessorType(XmlAccessType.FIELD)
#XmlType(name = "action", propOrder = {
"value"
})
public class Action {
#XmlValue
protected ActionName value;
#XmlAttribute(name = "isActive")
protected Boolean isActive;
/**
* Gets the value of the value property.
*
* #return
* possible object is
* {#link ActionName }
*
*/
public ActionName getValue() {
return value;
}
/**
* Sets the value of the value property.
*
* #param value
* allowed object is
* {#link ActionName }
*
*/
public void setValue(ActionName value) {
this.value = value;
}
/**
* Gets the value of the isActive property.
*
* #return
* possible object is
* {#link Boolean }
*
*/
public boolean isIsActive() {
if (isActive == null) {
return false;
} else {
return isActive;
}
}
/**
* Sets the value of the isActive property.
*
* #param value
* allowed object is
* {#link Boolean }
*
*/
public void setIsActive(Boolean value) {
this.isActive = value;
}
}
As you can see the #XmlValue field is called 'value', but I would prefer that it be called 'name' or 'actionName', but I can't figure out how to do that. I'd appreciate any help someone can provide.
Thanks
I am stuck with very strange problem with following tech-stack:
Weblogic 12c
JDK 1.7
Axis2 1.5.2 with integrated JAXB
Activity: Upgrading project from Weblogic 10.3.6 to 12.1.1 including JDK upgrade from 1.6 to 1.7
Problem Description: While creating OM Element, JAXB is putting object ID of child object instead of value of parameter under child object. The issue is seen in JDK 1.7 only where as it's working perfect in JDK 1.6
Request.java
import java.math.BigInteger;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://w3.org.com/spec/prd/services/2011/02}NumberOfNotes"/>
* <element ref="{http://w3.org.com/spec/prd/services/2011/02}NoteData"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
#XmlAccessorType(XmlAccessType.FIELD)
#XmlType(name = "", propOrder = {
"NumberOfNotes",
"NoteData"
})
#XmlRootElement(name = "Request")
public class Request {
#XmlElement(required = true)
#XmlSchemaType(name = "nonNegativeInteger")
protected BigInteger NumberOfNotes;
#XmlElement(name = "NoteData", required = true)
protected NoteData NoteData;
/**
* Gets the value of the NumberOfNotes property.
*
* #return
* possible object is
* {#link BigInteger }
*
*/
public BigInteger getNumberOfNotes() {
return NumberOfNotes;
}
/**
* Sets the value of the NumberOfNotes property.
*
* #param value
* allowed object is
* {#link BigInteger }
*
*/
public void setNumberOfNotes(BigInteger value) {
this.NumberOfNotes = value;
}
/**
* Gets the value of the NoteData property.
*
* #return
* possible object is
* {#link NoteData }
*
*/
public NoteData getNoteData() {
return NoteData;
}
/**
* Sets the value of the NoteData property.
*
* #param value
* allowed object is
* {#link NoteData }
*
*/
public void setNoteData(NoteData value) {
this.NoteData = value;
}
}
NoteData.java
package com.org.w3.spec.prd.services._2011._02;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="NoteDataDetails" maxOccurs="50" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://w3.org.com/spec/prd/services/2011/02}numberOfNoteLines"/>
* <sequence>
* <element ref="{http://w3.org.com/spec/prd/services/2011/02}NoteLineText" maxOccurs="10" minOccurs="0"/>
* </sequence>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
#XmlAccessorType(XmlAccessType.FIELD)
#XmlType(name = "", propOrder = {
"NoteDataDetails"
})
#XmlRootElement(name = "NoteData")
public class NoteData {
protected List<NoteData.NoteDataDetails> NoteDataDetails;
/**
* Gets the value of the NoteDataDetails property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the NoteDataDetails property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getNoteDataDetails().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {#link NoteData.NoteDataDetails }
*
*
*/
public List<NoteData.NoteDataDetails> getNoteDataDetails() {
if (NoteDataDetails == null) {
NoteDataDetails = new ArrayList<NoteData.NoteDataDetails>();
}
return this.NoteDataDetails;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://w3.org.com/spec/prd/services/2011/02}numberOfNoteLines"/>
* <sequence>
* <element ref="{http://w3.org.com/spec/prd/services/2011/02}NoteLineText" maxOccurs="10" minOccurs="0"/>
* </sequence>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
#XmlAccessorType(XmlAccessType.FIELD)
#XmlType(name = "", propOrder = {
"numberOfNoteLines",
"NoteLineText"
})
public static class NoteDataDetails {
#XmlElement(required = true)
protected BigInteger numberOfNoteLines;
#XmlElement(required = true)
protected List<NoteLineText> NoteLineText;
/**
* Gets the value of the numberOfNoteLines property.
*
* #return
* possible object is
* {#link BigInteger }
*
*/
public BigInteger getNumberOfNoteLines() {
return numberOfNoteLines;
}
/**
* Sets the value of the numberOfNoteLines property.
*
* #param value
* allowed object is
* {#link BigInteger }
*
*/
public void setNumberOfNoteLines(BigInteger value) {
this.numberOfNoteLines = value;
}
/**
* Gets the value of the NoteLineText property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the NoteLineText property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getNoteLineText().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {#link NoteLineText }
*
*
*/
public List<NoteLineText> getNoteLineText() {
if (NoteLineText == null) {
NoteLineText = new ArrayList<NoteLineText>();
}
return this.NoteLineText;
}
}
}
NoteLoneText.java
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Line">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="50"/>
* <whiteSpace value="collapse"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
#XmlAccessorType(XmlAccessType.FIELD)
#XmlType(name = "", propOrder = {
"line"
})
#XmlRootElement(name = "NoteLineText")
public class NoteLineText {
#XmlElement(name = "Line", required = true)
protected String line;
/**
* Gets the value of the line property.
*
* #return
* possible object is
* {#link String }
*
*/
public String getLine() {
return line;
}
/**
* Sets the value of the line property.
*
* #param value
* allowed object is
* {#link String }
*
*/
public void setLine(String value) {
this.line = value;
}
}
SendNoteStub.java
private org.apache.axiom.om.OMElement toOM(com.org.w3.spec.prd.services._2011._02.prdAddNoteRes param, boolean optimizeContent)
throws org.apache.axis2.AxisFault {
try {
javax.xml.bind.JAXBContext context = wsContext;
javax.xml.bind.Marshaller marshaller = context.createMarshaller();
marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_FRAGMENT, Boolean.TRUE);
org.apache.axiom.om.OMFactory factory = org.apache.axiom.om.OMAbstractFactory.getOMFactory();
JaxbRIDataSource source = new JaxbRIDataSource( com.org.w3.spec.prd.services._2011._02.prdAddNoteRes.class,
param,
marshaller,
"http://w3.org.com/spec/prd/services/2011/02",
"AddNoteRes");
org.apache.axiom.om.OMNamespace namespace = factory.createOMNamespace("http://w3.org.com/spec/prd/services/2011/02",
null);
return factory.createOMElement(source, "prdAddNoteRes", namespace);
} catch (javax.xml.bind.JAXBException bex){
throw org.apache.axis2.AxisFault.makeFault(bex);
}
}
Generated XML:
<PrdAddLoanNoteReq xmlns="http://w3.org.com/spec/Prd/services/2011/02"><transactionId>BZNSQT</transactionId><numberOfLoanNotes>1</numberOfLoanNotes><LoanNoteData><loanNoteDataDetails><numberOfLoanNoteLines>3</numberOfLoanNoteLines><loanNoteLineText>com.org.w3.spec.Prd.services._2011._02.LoanNoteLineText#1182716</loanNoteLineText><loanNoteLineText>com.org.w3.spec.Prd.services._2011._02.LoanNoteLineText#58ae15e9</loanNoteLineText><loanNoteLineText>com.org.w3.spec.Prd.services._2011._02.LoanNoteLineText#d20a17b</loanNoteLineText></loanNoteDataDetails></LoanNoteData></PrdAddLoanNoteReq>
Issue in generated XML is that under LoanNoteLineText tag, JAXB is putting Object ID instead of value of parameter Line.
Any help in this regards in highly appreciated.
Thanks a lot.
This issue was occurring due to incorrect JAXB implementation getting loaded. Updating Weblogic Start-up Arguments resolved the issue.
I'm facing a problem when sending an object through ActiveMQ to a queue. The object I send is a BrokerRequest and it contains an UUID, a priority (1,2,3) and a DocumentType which is a JAXB object.
Here's the block of code I'm using:
DocumentType jaxbDoc = getJaxbFromFile("/home/dev/document.xml");
BrokerRequest brokerRequest = new BrokerRequest(UUID.randomUUID(), 1, jaxbDoc);
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(ActiveMQConnection.DEFAULT_BROKER_URL);
Connection connection = connectionFactory.createConnection();
connection.start();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Destination destination = session.createQueue(topic);
MessageProducer producer = session.createProducer(destination);
producer.setDeliveryMode(DeliveryMode.PERSISTENT);
ObjectMessage objectMessage = session.createObjectMessage(brokerRequest);
producer.send(objectMessage);
connection.close();
The method "getJaxbFromFile" receives the path in which I have an xml document representing this Jaxb type, what I do in that method is unmarshall that xml into the Jaxb DocumentType to include it inside my BrokerRequest object.
But I receive this exception of notSerializable whenever I try to send the objectMessage to the broker, but all the elements involved in the JaxB are serializable, that's why I don't understand why I'm receiving this error.
Exception in thread "main" java.lang.RuntimeException: jaxb.mapped.elements.xsd.commons.MonetaryTotalType
at org.apache.activemq.command.ActiveMQObjectMessage.storeContent(ActiveMQObjectMessage.java:111)
at org.apache.activemq.command.ActiveMQObjectMessage.setObject(ActiveMQObjectMessage.java:162)
at org.apache.activemq.ActiveMQSession.createObjectMessage(ActiveMQSession.java:381)
at efact.alfa1lab.test.commons.MessageUtils.putMessageOnBroker(MessageUtils.java:184)
at test.commons.MessageUtils.main(MessageUtils.java:97)
Caused by: java.io.NotSerializableException: jaxb.mapped.elements.xsd.commons.MonetaryTotalType
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1180)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
at org.apache.activemq.command.ActiveMQObjectMessage.storeContent(ActiveMQObjectMessage.java:105)
I will really appreciate if somebody could help me and I'll be grateful if somebody could give me a clue about this issue.
==============================
The code for the MonetaryType is the following:
import javax.xml.bind.annotation.XmlAccessType;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_2.AllowanceTotalAmountType;
import oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_2.ChargeTotalAmountType;
import oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_2.LineExtensionAmountType;
import oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_2.PayableAmountType;
import oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_2.PayableRoundingAmountType;
import oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_2.PrepaidAmountType;
import oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_2.TaxExclusiveAmountType;
import oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_2.TaxInclusiveAmountType;
/**
*
*
* <pre>
* <?xml version="1.0" encoding="UTF-8"?><ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ccts:ComponentType>ABIE</ccts:ComponentType><ccts:DictionaryEntryName>Monetary Total. Details</ccts:DictionaryEntryName><ccts:Definition>Information about Monetary Totals.</ccts:Definition><ccts:ObjectClass>Monetary Total</ccts:ObjectClass>
* </ccts:Component>
* </pre>
*
*
*
* <p>Java class for MonetaryTotalType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="MonetaryTotalType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}LineExtensionAmount" minOccurs="0"/>
* <element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}TaxExclusiveAmount" minOccurs="0"/>
* <element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}TaxInclusiveAmount" minOccurs="0"/>
* <element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}AllowanceTotalAmount" minOccurs="0"/>
* <element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}ChargeTotalAmount" minOccurs="0"/>
* <element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}PrepaidAmount" minOccurs="0"/>
* <element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}PayableRoundingAmount" minOccurs="0"/>
* <element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}PayableAmount"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
#XmlAccessorType(XmlAccessType.FIELD)
#XmlType(name = "MonetaryTotalType", propOrder = {
"lineExtensionAmount",
"taxExclusiveAmount",
"taxInclusiveAmount",
"allowanceTotalAmount",
"chargeTotalAmount",
"prepaidAmount",
"payableRoundingAmount",
"payableAmount"
})
public class MonetaryTotalType implements Serializable {
#XmlElement(name = "LineExtensionAmount", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")
protected LineExtensionAmountType lineExtensionAmount;
#XmlElement(name = "TaxExclusiveAmount", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")
protected TaxExclusiveAmountType taxExclusiveAmount;
#XmlElement(name = "TaxInclusiveAmount", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")
protected TaxInclusiveAmountType taxInclusiveAmount;
#XmlElement(name = "AllowanceTotalAmount", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")
protected AllowanceTotalAmountType allowanceTotalAmount;
#XmlElement(name = "ChargeTotalAmount", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")
protected ChargeTotalAmountType chargeTotalAmount;
#XmlElement(name = "PrepaidAmount", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")
protected PrepaidAmountType prepaidAmount;
#XmlElement(name = "PayableRoundingAmount", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")
protected PayableRoundingAmountType payableRoundingAmount;
#XmlElement(name = "PayableAmount", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2", required = true)
protected PayableAmountType payableAmount;
/**
*
*
* <pre>
* <?xml version="1.0" encoding="UTF-8"?><ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ccts:ComponentType>BBIE</ccts:ComponentType><ccts:DictionaryEntryName>Monetary Total. Line Extension Amount. Amount</ccts:DictionaryEntryName><ccts:Definition>The total of Line Extension Amounts net of tax and settlement discounts, but inclusive of any applicable rounding amount.</ccts:Definition><ccts:Cardinality>0..1</ccts:Cardinality><ccts:ObjectClass>Monetary Total</ccts:ObjectClass><ccts:PropertyTerm>Line Extension Amount</ccts:PropertyTerm><ccts:RepresentationTerm>Amount</ccts:RepresentationTerm><ccts:DataType>Amount. Type</ccts:DataType>
* </ccts:Component>
* </pre>
*
*
*
* #return
* possible object is
* {#link LineExtensionAmountType }
*
*/
public LineExtensionAmountType getLineExtensionAmount() {
return lineExtensionAmount;
}
/**
* Sets the value of the lineExtensionAmount property.
*
* #param value
* allowed object is
* {#link LineExtensionAmountType }
*
*/
public void setLineExtensionAmount(LineExtensionAmountType value) {
this.lineExtensionAmount = value;
}
/**
*
*
* <pre>
* <?xml version="1.0" encoding="UTF-8"?><ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ccts:ComponentType>BBIE</ccts:ComponentType><ccts:DictionaryEntryName>Monetary Total. Tax Exclusive Amount. Amount</ccts:DictionaryEntryName><ccts:Definition>The total amount exclusive of taxes.</ccts:Definition><ccts:Cardinality>0..1</ccts:Cardinality><ccts:ObjectClass>Monetary Total</ccts:ObjectClass><ccts:PropertyTerm>Tax Exclusive Amount</ccts:PropertyTerm><ccts:RepresentationTerm>Amount</ccts:RepresentationTerm><ccts:DataType>Amount. Type</ccts:DataType>
* </ccts:Component>
* </pre>
*
*
*
* #return
* possible object is
* {#link TaxExclusiveAmountType }
*
*/
public TaxExclusiveAmountType getTaxExclusiveAmount() {
return taxExclusiveAmount;
}
/**
* Sets the value of the taxExclusiveAmount property.
*
* #param value
* allowed object is
* {#link TaxExclusiveAmountType }
*
*/
public void setTaxExclusiveAmount(TaxExclusiveAmountType value) {
this.taxExclusiveAmount = value;
}
/**
*
*
* <pre>
* <?xml version="1.0" encoding="UTF-8"?><ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ccts:ComponentType>BBIE</ccts:ComponentType><ccts:DictionaryEntryName>Monetary Total. Tax Inclusive Amount. Amount</ccts:DictionaryEntryName><ccts:Definition>The total amount inclusive of taxes.</ccts:Definition><ccts:Cardinality>0..1</ccts:Cardinality><ccts:ObjectClass>Monetary Total</ccts:ObjectClass><ccts:PropertyTerm>Tax Inclusive Amount</ccts:PropertyTerm><ccts:RepresentationTerm>Amount</ccts:RepresentationTerm><ccts:DataType>Amount. Type</ccts:DataType>
* </ccts:Component>
* </pre>
*
*
*
* #return
* possible object is
* {#link TaxInclusiveAmountType }
*
*/
public TaxInclusiveAmountType getTaxInclusiveAmount() {
return taxInclusiveAmount;
}
/**
* Sets the value of the taxInclusiveAmount property.
*
* #param value
* allowed object is
* {#link TaxInclusiveAmountType }
*
*/
public void setTaxInclusiveAmount(TaxInclusiveAmountType value) {
this.taxInclusiveAmount = value;
}
/**
*
*
* <pre>
* <?xml version="1.0" encoding="UTF-8"?><ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ccts:ComponentType>BBIE</ccts:ComponentType><ccts:DictionaryEntryName>Monetary Total. Allowance Total Amount. Amount</ccts:DictionaryEntryName><ccts:Definition>The total amount of all allowances.</ccts:Definition><ccts:Cardinality>0..1</ccts:Cardinality><ccts:ObjectClass>Monetary Total</ccts:ObjectClass><ccts:PropertyTerm>Allowance Total Amount</ccts:PropertyTerm><ccts:RepresentationTerm>Amount</ccts:RepresentationTerm><ccts:DataType>Amount. Type</ccts:DataType>
* </ccts:Component>
* </pre>
*
*
*
* #return
* possible object is
* {#link AllowanceTotalAmountType }
*
*/
public AllowanceTotalAmountType getAllowanceTotalAmount() {
return allowanceTotalAmount;
}
/**
* Sets the value of the allowanceTotalAmount property.
*
* #param value
* allowed object is
* {#link AllowanceTotalAmountType }
*
*/
public void setAllowanceTotalAmount(AllowanceTotalAmountType value) {
this.allowanceTotalAmount = value;
}
/**
*
*
* <pre>
* <?xml version="1.0" encoding="UTF-8"?><ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ccts:ComponentType>BBIE</ccts:ComponentType><ccts:DictionaryEntryName>Monetary Total. Charge Total Amount. Amount</ccts:DictionaryEntryName><ccts:Definition>The total amount of all charges.</ccts:Definition><ccts:Cardinality>0..1</ccts:Cardinality><ccts:ObjectClass>Monetary Total</ccts:ObjectClass><ccts:PropertyTerm>Charge Total Amount</ccts:PropertyTerm><ccts:RepresentationTerm>Amount</ccts:RepresentationTerm><ccts:DataType>Amount. Type</ccts:DataType>
* </ccts:Component>
* </pre>
*
*
*
* #return
* possible object is
* {#link ChargeTotalAmountType }
*
*/
public ChargeTotalAmountType getChargeTotalAmount() {
return chargeTotalAmount;
}
/**
* Sets the value of the chargeTotalAmount property.
*
* #param value
* allowed object is
* {#link ChargeTotalAmountType }
*
*/
public void setChargeTotalAmount(ChargeTotalAmountType value) {
this.chargeTotalAmount = value;
}
/**
*
*
* <pre>
* <?xml version="1.0" encoding="UTF-8"?><ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ccts:ComponentType>BBIE</ccts:ComponentType><ccts:DictionaryEntryName>Monetary Total. Prepaid Amount. Amount</ccts:DictionaryEntryName><ccts:Definition>The total prepaid amount.</ccts:Definition><ccts:Cardinality>0..1</ccts:Cardinality><ccts:ObjectClass>Monetary Total</ccts:ObjectClass><ccts:PropertyTerm>Prepaid Amount</ccts:PropertyTerm><ccts:RepresentationTerm>Amount</ccts:RepresentationTerm><ccts:DataType>Amount. Type</ccts:DataType>
* </ccts:Component>
* </pre>
*
*
*
* #return
* possible object is
* {#link PrepaidAmountType }
*
*/
public PrepaidAmountType getPrepaidAmount() {
return prepaidAmount;
}
/**
* Sets the value of the prepaidAmount property.
*
* #param value
* allowed object is
* {#link PrepaidAmountType }
*
*/
public void setPrepaidAmount(PrepaidAmountType value) {
this.prepaidAmount = value;
}
/**
*
*
* <pre>
* <?xml version="1.0" encoding="UTF-8"?><ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ccts:ComponentType>BBIE</ccts:ComponentType><ccts:DictionaryEntryName>Monetary Total. Payable_ Rounding Amount. Amount</ccts:DictionaryEntryName><ccts:Definition>The rounding amount (positive or negative) added to the calculated Line Extension Total Amount to produce the rounded Line Extension Total Amount.</ccts:Definition><ccts:Cardinality>0..1</ccts:Cardinality><ccts:ObjectClass>Monetary Total</ccts:ObjectClass><ccts:PropertyTermQualifier>Payable</ccts:PropertyTermQualifier><ccts:PropertyTerm>Rounding Amount</ccts:PropertyTerm><ccts:RepresentationTerm>Amount</ccts:RepresentationTerm><ccts:DataType>Amount. Type</ccts:DataType>
* </ccts:Component>
* </pre>
*
*
*
* #return
* possible object is
* {#link PayableRoundingAmountType }
*
*/
public PayableRoundingAmountType getPayableRoundingAmount() {
return payableRoundingAmount;
}
/**
* Sets the value of the payableRoundingAmount property.
*
* #param value
* allowed object is
* {#link PayableRoundingAmountType }
*
*/
public void setPayableRoundingAmount(PayableRoundingAmountType value) {
this.payableRoundingAmount = value;
}
/**
*
*
* <pre>
* <?xml version="1.0" encoding="UTF-8"?><ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ccts:ComponentType>BBIE</ccts:ComponentType><ccts:DictionaryEntryName>Monetary Total. Payable_ Amount. Amount</ccts:DictionaryEntryName><ccts:Definition>The total amount to be paid.</ccts:Definition><ccts:Cardinality>1</ccts:Cardinality><ccts:ObjectClass>Monetary Total</ccts:ObjectClass><ccts:PropertyTermQualifier>Payable</ccts:PropertyTermQualifier><ccts:PropertyTerm>Amount</ccts:PropertyTerm><ccts:RepresentationTerm>Amount</ccts:RepresentationTerm><ccts:DataType>Amount. Type</ccts:DataType>
* </ccts:Component>
* </pre>
*
*
*
* #return
* possible object is
* {#link PayableAmountType }
*
*/
public PayableAmountType getPayableAmount() {
return payableAmount;
}
/**
* Sets the value of the payableAmount property.
*
* #param value
* allowed object is
* {#link PayableAmountType }
*
*/
public void setPayableAmount(PayableAmountType value) {
this.payableAmount = value;
}
}
Thanks in advance again.
It looks like your unmarshalling the XML file to custom classes, one of which is of type jaxb.mapped.elements.xsd.commons.MonetaryTotalType. This class is not serializable, causing the exception to be thrown. Usually you should be fine marking the class as serializable by implementing Serializable interface.
Also, consider using package names prefixed using your product or at least company name; having a root package called jaxb is confusing because it isn't immediately apparent that is your own code.
I had a similar problem. My serializable object had an unserializable member object variable. After making it implement serializable the error went away.