<bean id="webServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate">
<constructor-arg ref="messageFactory"/>
<property name="messageSender">
<bean class="org.springframework.ws.transport.http.CommonsHttpMessageSender"/>
</property>
<property name="defaultUri" value="http://...">
</bean>
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import org.apache.log4j.Logger;
import org.springframework.ws.WebServiceMessage;
import org.springframework.ws.client.core.WebServiceMessageCallback;
import org.springframework.ws.client.core.WebServiceTemplate;
import org.springframework.ws.soap.SoapMessage;
/**
*
*
***********************************************
* @author Sandeep - 13 Apr 2012
*/
public class WebServiceHelperImpl implements WebServiceHelper {
private WebServiceTemplate webServiceTemplate;
private static final Logger log = Logger.getLogger(WebServiceHelperImpl.class);
private String soapActionUrl = "http://..";
@Override
public boolean sendSourceAndReceiveToResult(String uri, Source requestPayload, Result responseResult) {
this.webServiceTemplate.setDefaultUri(uri);
return webServiceTemplate.sendSourceAndReceiveToResult(requestPayload,new WebServiceMessageCallback() {
public void doWithMessage(WebServiceMessage message) {
((SoapMessage)message).setSoapAction(soapActionUrl);
}
}, responseResult);
}
public WebServiceTemplate getWebServiceTemplate() {
return webServiceTemplate;
}
public void setWebServiceTemplate(WebServiceTemplate webServiceTemplate) {
this.webServiceTemplate = webServiceTemplate;
}
}
Muchisimas gracias, he llegado al enlace a través de Google y me ha venido genial.
ReplyDeleteGracias de nuevo ;)