Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is the working solution to your problem:</p> <p>add this dependencies to your <strong>pom.xml</strong></p> <p><img src="https://i.stack.imgur.com/iyFqA.png" alt="enter image description here"></p> <p><strong>Change the imports in your source for jdom to jdom2</strong></p> <p>And this is the updated version of HolidayEndpoint:</p> <pre><code>package com.mycompany.ws_template.endpoint; import com.mycompany.ws_template.service.HumanResource; import java.text.SimpleDateFormat; import java.util.Date; import org.jdom2.JDOMException; import org.jdom2.Namespace; import org.jdom2.Element; import org.jdom2.filter.Filters; import org.jdom2.xpath.XPathExpression; import org.jdom2.xpath.XPathFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.ws.server.endpoint.annotation.Endpoint; import org.springframework.ws.server.endpoint.annotation.PayloadRoot; import org.springframework.ws.server.endpoint.annotation.RequestPayload; @Endpoint public class HolidayEndpoint { private static final String NAMESPACE_URI = "http://www.mycompany.com/holiday-service/schemas/holiday-request"; private XPathExpression&lt;Element&gt; startDateExpression; private XPathExpression&lt;Element&gt; endDateExpression; private XPathExpression&lt;Element&gt; nameExpression; private XPathExpression&lt;Element&gt; surnameExpression; @Autowired private HumanResource holidayService; public HolidayEndpoint() throws JDOMException { Namespace namespace = Namespace.getNamespace("hr", NAMESPACE_URI); XPathFactory xpathFactory = XPathFactory.instance(); startDateExpression = xpathFactory.compile("//hr:StartDate", Filters.element(), null, namespace); endDateExpression = xpathFactory.compile("//hr:EndDate", Filters.element(), null, namespace); nameExpression = xpathFactory.compile("//hr:EmployeeName", Filters.element(), null, namespace); surnameExpression = xpathFactory.compile("//hr:EmployeeSurname", Filters.element(), null, namespace); } @PayloadRoot(namespace = NAMESPACE_URI, localPart = "HolidayRequest") public void handleHolidayRequest(@RequestPayload Element holidayRequest) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date startDate = sdf.parse(startDateExpression.evaluate(holidayRequest).get(0).getValue()); Date endDate = sdf.parse(endDateExpression.evaluate(holidayRequest).get(0).getValue()); String name = nameExpression.evaluate(holidayRequest).get(0).getValue() + surnameExpression.evaluate(holidayRequest).get(0).getValue(); holidayService.bookHoliday(startDate, endDate, name); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload