Java Examples for org.springframework.ws.WebServiceMessageFactory
The following java examples will help you to understand the usage of org.springframework.ws.WebServiceMessageFactory. These source code samples are taken from different open source projects.
Example 1
| Project: smock-master File: MessageCreator.java View source code |
/**
* Creates a message. If source document is a SOAP message a message is created as it is (including SOAP faults), if it
* contains only a payload, it's wrapped in a SOAP envelope.
* @param response
* @param messageFactory
* @return
* @throws IOException
*/
protected final WebServiceMessage createMessage(URI uri, WebServiceMessage input, WebServiceMessageFactory messageFactory) throws IOException {
Source source = preprocessSource(uri, input, messageFactory);
WebServiceMessage result;
if (isSoap(source)) {
result = messageFactory.createWebServiceMessage(getSourceAsStream(source));
} else {
WebServiceMessage webServiceMessage = messageFactory.createWebServiceMessage();
transform(source, webServiceMessage.getPayloadResult());
result = webServiceMessage;
}
if (logger.isDebugEnabled()) {
logger.debug("Generated message: " + serialize(getEnvelopeSource(result)));
}
return result;
}Example 2
| Project: spring-utils-master File: FireAndForgetWebServiceConnectionAdapterTest.java View source code |
@Test
public void methodDelegation() throws Exception {
adapter.close();
adapter.getErrorMessage();
adapter.getUri();
adapter.hasError();
adapter.send(message);
assertNull(adapter.receive(null));
verify(delegate, times(1)).close();
verify(delegate, times(1)).getErrorMessage();
verify(delegate, times(1)).getUri();
verify(delegate, times(1)).hasError();
verify(delegate, times(1)).send(message);
verify(delegate, never()).receive(any(WebServiceMessageFactory.class));
}Example 3
| Project: hrs-portlets-master File: BaseSoapDaoTest.java View source code |
protected WebServiceMessage setupWebServiceMessageSender() throws IOException {
final WebServiceMessageSender webServiceMessageSender = this.getWebServiceMessageSender();
final WebServiceConnection webServiceConnection = mock(WebServiceConnection.class);
when(webServiceMessageSender.supports(any(URI.class))).thenReturn(true);
when(webServiceMessageSender.createConnection(any(URI.class))).thenReturn(webServiceConnection);
final WebServiceMessage webServiceMessage = mock(WebServiceMessage.class);
when(webServiceConnection.receive(any(WebServiceMessageFactory.class))).thenReturn(webServiceMessage);
return webServiceMessage;
}Example 4
| Project: spring-ws-master File: MessageDispatcherServlet.java View source code |
private void initWebServiceMessageFactory(ApplicationContext context) {
WebServiceMessageFactory messageFactory;
try {
messageFactory = context.getBean(getMessageFactoryBeanName(), WebServiceMessageFactory.class);
} catch (NoSuchBeanDefinitionException ignored) {
messageFactory = defaultStrategiesHelper.getDefaultStrategy(WebServiceMessageFactory.class, context);
if (logger.isDebugEnabled()) {
logger.debug("No WebServiceMessageFactory found in servlet '" + getServletName() + "': using default");
}
}
messageReceiverHandlerAdapter.setMessageFactory(messageFactory);
}Example 5
| Project: spring-ws-test-master File: WsMockControl.java View source code |
/**
* Mock will throw an exception.
*
* @param exception
* @return
*/
public WsMockControl throwException(final RuntimeException exception) {
RequestProcessor thrower = new RequestProcessor() {
public WebServiceMessage processRequest(URI uri, WebServiceMessageFactory messageFactory, WebServiceMessage request) throws IOException {
throw exception;
}
};
addRequestProcessor(thrower, "throwException(\"" + exception.getMessage() + "\")");
return this;
}Example 6
| Project: camel-spring-ws-master File: SpringWebserviceComponent.java View source code |
@Override
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
URI webServiceEndpointUri = new URI(remaining);
// Get a WebServiceTemplate from the registry if specified by an option on the component, else create a new template with Spring-WS defaults
WebServiceTemplate webServiceTemplate = resolveAndRemoveReferenceParameter(parameters, "webServiceTemplate", WebServiceTemplate.class, new WebServiceTemplate());
WebServiceMessageSender messageSender = resolveAndRemoveReferenceParameter(parameters, "messageSender", WebServiceMessageSender.class, null);
WebServiceMessageFactory messageFactory = resolveAndRemoveReferenceParameter(parameters, "messageFactory", WebServiceMessageFactory.class, null);
if (webServiceTemplate.getDefaultUri() == null) {
webServiceTemplate.setDefaultUri(webServiceEndpointUri.toString());
}
if (messageSender != null) {
webServiceTemplate.setMessageSender(messageSender);
}
if (messageFactory != null) {
webServiceTemplate.setMessageFactory(messageFactory);
}
SpringWebserviceConfiguration configuration = new SpringWebserviceConfiguration();
configuration.setWebServiceTemplate(webServiceTemplate);
EndpointHelper.setProperties(getCamelContext(), configuration, parameters);
return new SpringWebserviceEndpoint(this, configuration);
}Example 7
| Project: spring-integration-master File: WebServiceOutboundGatewayParserTests.java View source code |
@Test
public void simpleGatewayWithCustomMessageFactory() {
AbstractEndpoint endpoint = this.context.getBean("gatewayWithCustomMessageFactory", AbstractEndpoint.class);
assertEquals(EventDrivenConsumer.class, endpoint.getClass());
Object gateway = new DirectFieldAccessor(endpoint).getPropertyValue("handler");
assertEquals(SimpleWebServiceOutboundGateway.class, gateway.getClass());
DirectFieldAccessor accessor = new DirectFieldAccessor(gateway);
accessor = new DirectFieldAccessor(accessor.getPropertyValue("webServiceTemplate"));
WebServiceMessageFactory factory = (WebServiceMessageFactory) context.getBean("messageFactory");
assertEquals(factory, accessor.getPropertyValue("messageFactory"));
}Example 8
| Project: camel-master File: CamelDirectConnection.java View source code |
@Override
public WebServiceMessage receive(WebServiceMessageFactory messageFactory) throws IOException {
return null;
}