使用spring WebServiceTemplate时,soapenv:Envelope无效

时间:2015-06-02 13:17:13

标签: java spring web-services soap webservice-client

我很难使用Spring WebServiceTemplate调用WebService,服务器响应时“处理时发生了故障。”我有Soap UI项目,我比较了外发消息和 soapenv:Envelope 的区别。

在Soap UI中我有:

  

soapenv:信封   的xmlns:SER = “http://service.server.webservices.checkpoint.tta.com”   的xmlns:soapenv = “http://schemas.xmlsoap.org/soap/envelope/”

在春天:

SOAP-ENV:Envelope xmlns:SOAP-ENV =“http://schemas.xmlsoap.org/soap/envelope/”



我的春季配置:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

	<bean id="marshaller"
		  class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
		<property name="contextPath"
				  value="com.test.checkpoint" />
	</bean>

	<bean id="webServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate">
		<property name="interceptors" ref="securityInterceptor"/>
		<property name="marshaller" ref="marshaller" />
		<property name="unmarshaller" ref="marshaller" />
		<property name="defaultUri" value="http://dev.checkpoint.test.com/app/services/CPWSSearchService"/>
	</bean>


	<bean id="securityInterceptor" class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
		<property name="securementActions" value="UsernameToken Timestamp"/>
		<property name="securementUsername" value="test"/>
		<property name="securementPassword" value="test"/>
		<property name="securementPasswordType" value="PasswordText"/>
	</bean>
	

</beans>

我的Java代码:

PerformSearch request=new ObjectFactory().createPerformSearch();
        request.setSearchUrl("Some text query");
        PerformSearchResponse response= (PerformSearchResponse) client.marshalSendAndReceive(request );

提前致谢!

0 个答案:

没有答案