spring-ws

Spring-WS : specifying the Content-Type

瘦欲@ 提交于 2019-12-04 05:06:57
问题 I have a Spring Webservice based on AbstractJDomPayloadEndpoint . This service works fine, except that my client needs the HTTP header Content-Type to be set to the right charset (utf-8 in my case). I cant find where I can configure that. I tried writing a simple servlet Filter : chain.doFilter(request, response); HttpServletResponse httpResponse = (HttpServletResponse) response; httpResponse.setHeader("Content-Type", "text/xml; charset=utf-8"); But this doesnt change the headers at all. I

Setting a custom HTTP header dynamically with Spring-WS client

笑着哭i 提交于 2019-12-03 18:45:56
问题 How do you set a custom HTTP header (not SOAP header) dynamically on the client side when using Spring-WS? 回答1: public class AddHttpHeaderInterceptor implements ClientInterceptor { public boolean handleFault(MessageContext messageContext) throws WebServiceClientException { return true; } public boolean handleRequest(MessageContext messageContext) throws WebServiceClientException { TransportContext context = TransportContextHolder.getTransportContext(); HttpComponentsConnection connection =

Spring Web Service Template: Add username token

大兔子大兔子 提交于 2019-12-03 17:12:35
I have a web app that acts as a client to a Jax-WS web service implemented using Spring WS. The Spring WS is configured to require a username token in the SOAP header. In the web app I plan to use the Spring web service template but I can't seem to find any examples which show how to add a UsernameToken to the outgoing request. Can someone point me in the right direction? Thanks. jddsantaella You have to use Interceptors . See Chapter 7. Securing your Web services with Spring-WS . The configuration would be something like this <bean id="webServiceTemplate" class="org.springframework.ws.client

How can a Spring Soap interceptor modify the contents of a message?

吃可爱长大的小学妹 提交于 2019-12-03 16:56:53
I'm trying to write an interceptor for a web service that will modify the contents of the Soap message before is sent on to the endpoint. If a client sent a message where the value of some element is 1, I want to be able to alter that element to a 2 so that, when the message arrives at the endpoint, it looks as if the client submitted a 2 instead of a 1. I'm not sure if this is a difficult task which is elluding me, or an easy task which I am making harder than it needs to be. I have stepped through some of the Spring interceptors; but the validation and logging interceptors don't every alter

How to configure Spring-WS to use JAXB Marshaller?

淺唱寂寞╮ 提交于 2019-12-03 14:04:13
Thankyou for help on this so far, i am updating question as i did not show all i needed to, with changes recomended shown. the soap output is still not what i wanted. servlet.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p" xmlns:sws="http://www.springframework.org/schema/web-services" xmlns:oxm="http://www.springframework.org/schema/oxm" xsi:schemaLocation="http://www

How to use direct streaming for SOAP with Spring-WS?

£可爱£侵袭症+ 提交于 2019-12-03 11:29:40
问题 We want to enable direct streaming of our payload in webservice endpoints. We have to process a large amount of data and want to stream the data while processing. We use spring-ws-core, in version 2.0.0 and use the PayloadRootQNameEndpointMapping as endpoint mapper. As message factory we are using the AxiomSoapMessageFactory . We implement the StreamingPayload and the corresponding writeTo(XMLStreamWriter writer) method, which we use to write our payload (According to the spring-ws JIRA

java.lang.NoClassDefFoundError : javax/xml/soap/SOAPException

懵懂的女人 提交于 2019-12-03 10:36:41
I have created a Web Service using Spring. It works fine when running it on my embedded tomcat server. However when I package it as a JAR file and run it with java -jar command, I am receiving this exception. My service sends a simple soap request and the server response is: "exception": "java.lang.NoClassDefFoundError", "message": "javax/xml/soap/SOAPException", That's the response I get in Postman. Any ideas where I can look for the problem. JavaSE 8 includes package java.xml.soap . JavaSE 9 moved package javax.xml.soap to the module java.xml.ws . Modules shared with JEE (like java.xml.ws )

How to configure two way SSL connection in Spring WS without using Spring boot and using separate Apache tomcat server?

余生颓废 提交于 2019-12-03 07:07:15
I need to send a soap request messages in a two way SSL connection security mechanism to a server and also process the Soap response from the server.. I am using Spring MVC along with Spring ws which is configured entirely using annotations and requires to be configured in two way SSL connection for sending soap requests to the Server.How can I have two way SSL connection in my Spring MVC web service application in order to send my soap messages to the sever over SSL?. pedrofb I can guide you about all the required steps, but there are gaps. Please review my answer so I could provide you the

Convert StreamResult to string or xml

血红的双手。 提交于 2019-12-03 06:44:07
问题 Using spring ws to get the StreamResult as below StreamSource source = new StreamSource(new StringReader(MESSAGE)); StreamResult result = new StreamResult(System.out); webServiceTemplate.sendSourceAndReceiveToResult("http://someUri", source, new SoapActionCallback("someCallBack"), result); return result; I get the result, But I want to extract it to some sort of xml or even as a string (Just want to see the contents in order to generate the response). How can I do this? 回答1: Try this one: try

Spring WS - step by step in STS (from WSDL) [closed]

霸气de小男生 提交于 2019-12-03 06:11:58
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . I am trying to create a new Spring webservice project in Spring Tool Suite (STS). I checked this link http://static.springsource.org