TicketAgentClient { @SuppressWarnings("unchecked") public List<BigInteger> listFlights() { ObjectFactory factory = new ObjectFactory(); TListFlights tListFlights = factory.createTListFlights(); JAXBElement<TListFlights> request = factory.createListFlightsRequest(tListFlights); JAXBElement<TFlightsResponse> response = (JAXBElement<TFlightsResponse>) webServiceTemplate.marshalSendAndReceive(request, new SoapActionCallback("http: return response.getValue().getFlightNumber(); }  @SuppressWarnings("unchecked") List<BigInteger> listFlights();  }
@Test public void testListFlights() { Source requestPayload = new StringSource("<ns3:listFlightsRequest xmlns:ns3=\"http: + "</ns3:listFlightsRequest>"); Source responsePayload = new StringSource("<v1:listFlightsResponse xmlns:v1=\"http: + "<flightNumber>101</flightNumber>" + "</v1:listFlightsResponse>"); mockWebServiceServer.expect(new SoapActionMatcher("http: .andExpect(payload(requestPayload)).andRespond(withPayload(responsePayload)); List<BigInteger> flights = ticketAgentClient.listFlights(); assertThat(flights.get(0)).isEqualTo(BigInteger.valueOf(101)); mockWebServiceServer.verify(); }