How to create spring-based executable jar with maven?

You can add the following configuration so that the contents of the .schema files from all the jars get appended together. <configuration> <transformers> <transformer implementation=”org.apache.maven.plugins.shade.resource.AppendingTransformer”> <resource>META-INF/spring.handlers</resource> </transformer> <transformer implementation=”org.apache.maven.plugins.shade.resource.AppendingTransformer”> <resource>META-INF/spring.schemas</resource> </transformer> </transformers> </configuration>

No adapter for endpoint; Is your endpoint annotated with @Endpoint, or does it implement a supported interface like MessageHandler or PayloadEndpoint?

I had a similar error message. My problem was in request and response class that I generated from XSD. It missed @XMLRootElement annotation. This caused that description of operation (in WSDL) and description of implemented method (in Endpoint) did not match. Adding JAXBElement to my endpoint method solved my problem. import javax.xml.bind.JAXBElement; @PayloadRoot(namespace = “http://foo.bar/books”, … Read more

Convert StreamResult to string or xml

Try this one: try { StreamSource source = new StreamSource(new StringReader(“<xml>blabla</xml>”)); StringWriter writer = new StringWriter(); StreamResult result = new StreamResult(writer); TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer(); transformer.transform(source,result); String strResult = writer.toString(); } catch (Exception e) { e.printStackTrace(); }

Setting a custom HTTP header dynamically with Spring-WS client

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 =(HttpComponentsConnection) context.getConnection(); connection.addRequestHeader(“name”, “suman”); return true; } public boolean handleResponse(MessageContext messageContext) throws WebServiceClientException { return true; } } config: <bean id=”webServiceTemplate” class=”org.springframework.ws.client.core.WebServiceTemplate”> … <property name=”interceptors”> <list> … Read more

How to set timeout in Spring WebServiceTemplate

If you are using Spring Webservices 2.1.0 version, You can set timeout using HttpComponentsMessageSender. CommonsHttpMessageSender are deprecated and not recommended by Spring anymore. The way I have it implemented, I define my WebServiceTemplate to use HttpComponentsMessageSender. Values are in Milliseconds <bean id=”webServiceTemplate” class=”org.springframework.ws.client.core.WebServiceTemplate”> <property name=”defaultUri” value=”${endpoint.url}” /> <property name=”marshaller” ref=”marshaller” /> <property name=”unmarshaller” ref=”unmarshaller” /> … Read more

JAXB :Need Namespace Prefix to all the elements

Solved by adding @XmlSchema( namespace = “http://www.example.com/a”, elementFormDefault = XmlNsForm.QUALIFIED, xmlns = { @XmlNs(prefix=”ns1″, namespaceURI=”http://www.example.com/a”) } ) package authenticator.beans.login; import javax.xml.bind.annotation.*; in package-info.java Took help of jaxb-namespaces-missing : Answer provided by Blaise Doughan

Which framework is better CXF or Spring-WS? [closed]

About Apache CXF: CXF supports several standards including SOAP, the WSI Basic Profile, WSDL, WS-Addressing, WS-Policy, WS-ReliableMessaging, WS-Security, WS-SecurityPolicy, and WS-SecureConversation. Apache CXF offers both contract-last (starting with Java) and Contract-first (starting with the WSDL) approaches. Apache CXF implements JAX-WS and JAX-RS. About Spring WS: Spring WS offers “only” contract-first, starting from an XSD Schema. … Read more