John Juliciana wrote:i have a requirement to read a xml from a 3rd party which is sent via xml over http in the request body and post it to a different WEB service. I have to write a web service to capture that XML and post it. How do i read the XML which comes in the request body and post it using Axis? Im new to web services and need help on this. i have a setup axis 2 and apache successfully.
Any help is highly appreciated
Thanks in advance
John
Kumar Gaurav wrote:Hi All,
Using JAXB i have to create XML file for a Java object, which i am able to create, below is the code :
@XmlRootElement (name="employee")
@XmlAccessorType (XmlAccessType.FIELD)
public class Employee implements Serializable {
@XmlElement
private String name;
@XmlElement
private String age;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
public Employee () {
}
public Employee (String name, String age) {
this.name = name;
this.age = age;
}
public void addPlaceDetail (PlaceDetail detail) {
if (null == placeDetail){
placeDetail = new ArrayList<PlaceDetail>();
}
placeDetail.add(detail);
}
public static void main (String[] args) throws JAXBException, IOException {
Employee employee = new Employee("Nitish","25")
JAXBContext context = JAXBContext.newInstance(Employee.class);
FileWriter writer = new FileWriter("D://EmpXML.xml");
context.createMarshaller().marshal(employee, writer);
writer.close();
}
}
Problem is i am using annotations to mark root element and other element and i am not supposed to use annotations.
I have to do it using schema (may be xsd file). Can any one guide me how to do this.
Rob Spoor wrote:
Darryl Burke wrote:And what exactly does this have to do with Swing / AWT / SWT / JFace? I think it would sit better in the Blatant Advertising section.
https://coderanch.com/forums/f-39/ba
Exactly.