I have found a bug in the HolidayRequestClient class. In the createHolidayRequest method where adding the startDate and endDate to the rootElement content, it looks like a misplaced end bracket embeds the endDate attribute inside the startDate ie:
Produces the following XML:Code:document.getRootElement() .addContent(new Element("Holiday", hrNs) .addContent(new Element("StartDate", hrNs).setText(fmt.format(startDate)) .addContent(new Element("EndDate", hrNs).setText(fmt.format(endDate))))) .addContent(new Element("Employee", hrNs) .addContent(new Element("Number", hrNs).setText(String.valueOf(employeeId))) .addContent(new Element("FirstName", hrNs).setText(firstName)) .addContent(new Element("Number", hrNs).setText(lastName)));
What should be actually this in the code:Code:<?xml version="1.0" encoding="UTF-8"?> <hr:HolidayRequest xmlns:hr="http://mycompany.com/hr/schemas"> <hr:Holiday> <hr:StartDate> 2008-08-01 <hr:EndDate>2008-08-31</hr:EndDate> </hr:StartDate> </hr:Holiday> <hr:Employee> <hr:Number>1</hr:Number> <hr:FirstName>William</hr:FirstName> <hr:Number>Nicholson</hr:Number> </hr:Employee> </hr:HolidayRequest>
Produces the correct XMLCode:document.getRootElement() .addContent(new Element("Holiday", hrNs) .addContent(new Element("StartDate", hrNs).setText(fmt.format(startDate)))//<-- ADD HERE .addContent(new Element("EndDate", hrNs).setText(fmt.format(endDate)))) //REMOVED HERE .addContent(new Element("Employee", hrNs) .addContent(new Element("Number", hrNs).setText(String.valueOf(employeeId))) .addContent(new Element("FirstName", hrNs).setText(firstName)) .addContent(new Element("Number", hrNs).setText(lastName)));
Can we get someone from Springsource to check this out, and make amends in their deployer files for the tutorials.Code:<hr:HolidayRequest xmlns:hr="http://mycompany.com/hr/schemas"> <hr:Holiday> <hr:StartDate>2008-08-01</hr:StartDate> <hr:EndDate>2008-08-31</hr:EndDate> </hr:Holiday> <hr:Employee> <hr:Number>1</hr:Number> <hr:FirstName>William</hr:FirstName> <hr:Number>Nicholson</hr:Number> </hr:Employee> </hr:HolidayRequest>


Reply With Quote
