JAXB Marshalling supply name space for root element dynamically

Posted by Venkat on Stack Overflow See other posts from Stack Overflow or by Venkat
Published on 2013-11-09T09:50:06Z Indexed on 2013/11/09 9:53 UTC
Read the original article Hit count: 231

Filed under:
|
|

I have to pass the namespace for root element dynamically while marshalling using jaxb (JAXB 2.1.10 - JDK 6). i will be using the genrated xml to call different webservices which is qualified with different namespaces but same input xml. here is my sample jaxb annotated class .....guide me with your valuable inputs.

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "taskName",
    "taskType"
})
@XmlRootElement(name = "TaskRequest")
public class TaskRequest {

@XmlElement(name = "TaskName", required = true)
protected String taskName;
@XmlElement(name = "TaskType", required = true)
protected String taskType;

public String getTaskName() {
    return taskName;
}

public void setTaskName(String value) {
    this.taskName = value;
}

public String getTaskType() {
    return taskType;
}

public void setTaskType(String value) {
    this.taskType = value;
}

}

© Stack Overflow or respective owner

Related posts about java

Related posts about Xml