本文整理汇总了Java中org.springframework.ws.transport.WebServiceMessageSender类的典型用法代码示例。如果您正苦于以下问题:Java WebServiceMessageSender类的具体用法?Java WebServiceMessageSender怎么用?Java WebServiceMessageSender使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WebServiceMessageSender类属于org.springframework.ws.transport包,在下文中一共展示了WebServiceMessageSender类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initGateway
import org.springframework.ws.transport.WebServiceMessageSender; //导入依赖的package包/类
@Override
protected void initGateway() throws Exception {
super.initGateway();
WebServiceMessageSender [] senders = getWebServiceTemplate().getMessageSenders();
for(WebServiceMessageSender sender: senders) {
if(sender instanceof HttpComponentsMessageSender) {
HttpComponentsMessageSender hSender = (HttpComponentsMessageSender) sender;
ClientConnectionManager connectionManager = hSender.getHttpClient().getConnectionManager();
SchemeRegistry schemeRegistry = connectionManager.getSchemeRegistry();
SSLSocketFactory sf = new SSLSocketFactory(keyStore, safeToString(keyStorePassword), trustStore);
Scheme https = new Scheme("https", 443, sf);
schemeRegistry.register(https);
log.info("initGateway connection manager with https scheme");
}
}
}
示例2: getOptionTypeMappings
import org.springframework.ws.transport.WebServiceMessageSender; //导入依赖的package包/类
@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;
}
示例3: webServiceMessageSender
import org.springframework.ws.transport.WebServiceMessageSender; //导入依赖的package包/类
@Bean
public WebServiceMessageSender webServiceMessageSender() {
HttpComponentsMessageSender httpComponentsMessageSender = new HttpComponentsMessageSender();
// timeout for creating a connection
httpComponentsMessageSender.setConnectionTimeout(timeout);
// when you have a connection, timeout the read blocks for
httpComponentsMessageSender.setReadTimeout(timeout);
return httpComponentsMessageSender;
}
示例4: opcXmlDaClient
import org.springframework.ws.transport.WebServiceMessageSender; //导入依赖的package包/类
@Bean
public OpcXmlDaClient opcXmlDaClient(Jaxb2Marshaller marshaller, WebServiceMessageSender messageSender) {
String serverUrl = env.getProperty(OPC_XMLDA_SERVER_URL_PROPERTY, "http://opc.xmlda.server.url");
LOG.info("OPC XML-DA server: {}", serverUrl);
OpcXmlDaClient client = new OpcXmlDaClient();
client.setDefaultUri(serverUrl);
client.setDefaultLocale(Locale.US);
client.setMarshaller(marshaller);
client.setUnmarshaller(marshaller);
client.setMessageSender(messageSender);
return client;
}
示例5: prepareMessageSenders
import org.springframework.ws.transport.WebServiceMessageSender; //导入依赖的package包/类
private void prepareMessageSenders(SpringWebserviceConfiguration configuration) {
// Skip this whole thing if none of the relevant config options are set.
if (!(configuration.getTimeout() > -1) && configuration.getSslContextParameters() == null) {
return;
}
WebServiceTemplate webServiceTemplate = configuration.getWebServiceTemplate();
WebServiceMessageSender[] messageSenders = webServiceTemplate.getMessageSenders();
for (int i = 0; i < messageSenders.length; i++) {
WebServiceMessageSender messageSender = messageSenders[i];
if (messageSender instanceof HttpComponentsMessageSender) {
if (configuration.getSslContextParameters() != null) {
LOG.warn("Not applying SSLContextParameters based configuration to HttpComponentsMessageSender. "
+ "If you are using this MessageSender, which you are not by default, you will need "
+ "to configure SSL using the Commons HTTP 3.x Protocol registry.");
}
if (configuration.getTimeout() > -1) {
if (messageSender.getClass().equals(HttpComponentsMessageSender.class)) {
((HttpComponentsMessageSender) messageSender).setReadTimeout(configuration.getTimeout());
} else {
LOG.warn("Not applying timeout configuration to HttpComponentsMessageSender based implementation. "
+ "You are using what appears to be a custom MessageSender, which you are not doing by default. "
+ "You will need configure timeout on your own.");
}
}
} else if (messageSender.getClass().equals(HttpUrlConnectionMessageSender.class)) {
// Only if exact match denoting likely use of default configuration. We don't want to get
// sub-classes that might have been otherwise injected.
messageSenders[i] = new AbstractHttpWebServiceMessageSenderDecorator((HttpUrlConnectionMessageSender) messageSender, configuration, getEndpoint().getCamelContext());
} else {
// For example this will be the case during unit-testing with the net.javacrumbs.spring-ws-test API
LOG.warn("Ignoring the timeout and SSLContextParameters options for {}. You will need to configure "
+ "these options directly on your custom configured WebServiceMessageSender", messageSender);
}
}
}
示例6: getMessageSenders
import org.springframework.ws.transport.WebServiceMessageSender; //导入依赖的package包/类
/**
* Configure message sender for wsa:replyTo from a camel route definition.
* The route definition has priority over this endpoint.
*/
@Override
protected WebServiceMessageSender[] getMessageSenders(Object endpoint) {
SpringWebserviceEndpoint camelEndpoint = getSpringWebserviceEndpoint(endpoint);
if (camelEndpoint.getConfiguration().getMessageSender() != null) {
return new WebServiceMessageSender[] {camelEndpoint.getConfiguration().getMessageSender()};
}
return super.getMessageSenders(endpoint);
}
示例7: createMock
import org.springframework.ws.transport.WebServiceMessageSender; //导入依赖的package包/类
/**
* Create mock {@link WebServiceMessageSender}. If behavior not defined,
* throws {@link IllegalStateException}.
*
* @return
*/
public WebServiceMessageSender createMock() throws IllegalStateException {
if (requestProcessors.isEmpty()) {
throw new IllegalStateException("No request processor defined. Please call at least returnResponse() method.");
}
MockWebServiceMessageSender messageSender = new MockWebServiceMessageSender();
messageSender.setRequestProcessors(requestProcessors);
messageSender.setInterceptors(interceptors);
return messageSender;
}
示例8: postProcessBeanFactory
import org.springframework.ws.transport.WebServiceMessageSender; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
Collection<WebServiceTemplate> templates = beanFactory.getBeansOfType(WebServiceTemplate.class).values();
if (templates.size()==0)
{
throw new BeanCreationException("No WebServiceTemplate found in the servlet context.");
}
Collection<AbstractMockWebServiceMessageSender> mockSenders = beanFactory.getBeansOfType(AbstractMockWebServiceMessageSender.class).values();
WebServiceMessageSender[] mockSenderArray = mockSenders.toArray(new WebServiceMessageSender[mockSenders.size()]);
for (WebServiceTemplate template: templates)
{
template.setMessageSenders(mockSenderArray);
}
}
示例9: testAuto
import org.springframework.ws.transport.WebServiceMessageSender; //导入依赖的package包/类
@Test
public void testAuto()
{
ApplicationContext context = new ClassPathXmlApplicationContext("inject/inject-auto.xml");
WebServiceTemplate wsTemplate = (WebServiceTemplate) context.getBean("ws-template");
WebServiceMessageSender mockSender = (WebServiceMessageSender) context.getBean("mock-sender");
assertSame(mockSender, wsTemplate.getMessageSenders()[0]);
}
示例10: testMultiple
import org.springframework.ws.transport.WebServiceMessageSender; //导入依赖的package包/类
@Test
public void testMultiple()
{
ApplicationContext context = new ClassPathXmlApplicationContext("inject/inject-multiple-templates.xml");
WebServiceTemplate wsTemplate1 = (WebServiceTemplate) context.getBean("ws-template-1");
WebServiceTemplate wsTemplate2 = (WebServiceTemplate) context.getBean("ws-template-2");
WebServiceMessageSender mockSender1 = (WebServiceMessageSender) context.getBean("mock-sender-1");
WebServiceMessageSender mockSender2 = (WebServiceMessageSender) context.getBean("mock-sender-2");
assertSame(mockSender1, wsTemplate1.getMessageSenders()[0]);
assertSame(mockSender2, wsTemplate1.getMessageSenders()[1]);
assertSame(mockSender1, wsTemplate2.getMessageSenders()[0]);
assertSame(mockSender2, wsTemplate2.getMessageSenders()[1]);
}
示例11: getMessageSender
import org.springframework.ws.transport.WebServiceMessageSender; //导入依赖的package包/类
public WebServiceMessageSender getMessageSender() {
return messageSender;
}
示例12: setMessageSender
import org.springframework.ws.transport.WebServiceMessageSender; //导入依赖的package包/类
/**
* Option to provide a custom WebServiceMessageSender. For example to perform authentication or use alternative transports
*/
public void setMessageSender(WebServiceMessageSender messageSender) {
this.messageSender = messageSender;
}
示例13: apply
import org.springframework.ws.transport.WebServiceMessageSender; //导入依赖的package包/类
/**
* Applies one-way or two-way SSL configuration to implementation of {@link WebServiceGatewaySupport}.
* Adds also RemoveSoapHeadersInterceptor, because otherwise there will be Content-Length already present exceptions
*
* @param ws Webservice client implementation
* @param keyStore KeyStore
* @param keyStorePswd Password for KeyStore
* @param trustStore TrustStore
* @param trustStorePswd Password for TrustStore
*/
public void apply(WebServiceGatewaySupport ws, Resource keyStore,
String keyStorePswd, Resource trustStore, String trustStorePswd) {
WebServiceMessageSender messageSender = getMessageSender(keyStore, keyStorePswd, trustStore, trustStorePswd);
ws.setMessageSender(messageSender);
}
示例14: createMessageSender
import org.springframework.ws.transport.WebServiceMessageSender; //导入依赖的package包/类
/**
* Creates message sender that will be used for mocking "real" message senders.
* @return
*/
protected WebServiceMessageSender createMessageSender() {
return new WsMockControlMockWebServiceMessageSender();
}