org.springframework.ws.client.core.WebServiceTemplate Java Examples

The following examples show how to use org.springframework.ws.client.core.WebServiceTemplate. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TraceeSpringWsConfiguration.java    From tracee with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
	if (bean instanceof WebServiceTemplate) {
		final WebServiceTemplate webServiceTemplate = (WebServiceTemplate)bean;
		final ClientInterceptor[] interceptors = webServiceTemplate.getInterceptors();
		final ClientInterceptor[] newInterceptors;
		if (interceptors != null) {
			newInterceptors = Arrays.copyOf(interceptors, interceptors.length+1);
		} else {
			newInterceptors = new ClientInterceptor[1];
		}
		newInterceptors[newInterceptors.length-1] = interceptor;
		webServiceTemplate.setInterceptors(newInterceptors);
	}
	return bean;
}
 
Example #2
Source File: TestData.java    From Spring-MVC-Blueprints with MIT License 5 votes vote down vote up
public static void main(String args[]){
	 ApplicationContext context =  new FileSystemXmlApplicationContext(".\\src\\main\\webapp\\WEB-INF\\applicationContext.xml");  
	  //Calculation calculation = (Calculation)context.getBean("calculationBeanHessian");
	 InvoiceProductRequest request = new InvoiceProductRequest();
	 request.setInvoiceId(123);
	 WebServiceTemplate wsTemplate = (WebServiceTemplate) context.getBean("webServiceTemplate");
	 InvoiceProductResponse response = (InvoiceProductResponse) wsTemplate.marshalSendAndReceive(request);
	 InvoicedProducts product =  response.getInvoicedProduct();
	 System.out.println(product.getId());
}
 
Example #3
Source File: WebServiceClientConverter.java    From citrus-admin with Apache License 2.0 5 votes vote down vote up
@Override
protected Map<String, Class<?>> getOptionTypeMappings() {
    Map<String, Class<?>> mappings = super.getOptionTypeMappings();
    mappings.put("messageSender", WebServiceMessageSender.class);
    mappings.put("endpointResolver", EndpointUriResolver.class);
    mappings.put("messageFactory", SoapMessageFactory.class);
    mappings.put("webServiceTemplate", WebServiceTemplate.class);
    return mappings;
}
 
Example #4
Source File: ApplicationIntegrationTests.java    From spring-boot-samples with Apache License 2.0 5 votes vote down vote up
@Test
public void testSendAndReceive() {
    WebServiceTemplate ws = new WebServiceTemplate(marshaller);
    GetCountryRequest request = new GetCountryRequest();
    request.setName("Spain");

    assertThat(ws.marshalSendAndReceive("http://localhost:"
            + port + "/ws", request)).isNotNull();
}
 
Example #5
Source File: ApplicationIntegrationTest.java    From tutorials with MIT License 5 votes vote down vote up
@Test
public void whenSendRequest_thenResponseIsNotNull() {
    WebServiceTemplate ws = new WebServiceTemplate(marshaller);
    GetCountryRequest request = new GetCountryRequest();
    request.setName("Spain");

    assertThat(ws.marshalSendAndReceive("http://localhost:" + port + "/ws", request)).isNotNull();
}
 
Example #6
Source File: SimpleWebServieClient.java    From java-course-ee with MIT License 3 votes vote down vote up
public String sayHello(String name) {
    SayHelloRequest request = new SayHelloRequest();
    request.setName(name);

    WebServiceTemplate webServiceTemplate = getWebServiceTemplate();
    SayHelloResponse response = (SayHelloResponse) webServiceTemplate.marshalSendAndReceive(request);

    return response.getReturn();

}