Add SOAP header object using pure JAX-WS

So, it looks like I’ve found possible answer while combining JAX-WS & JAXB related answers from SO (I would really appreciate if somebody experienced in these technologies can check whether following is correct): The obvious thing for me is to add SOAP message handler and alter header of SOAPMessage instance in it: import javax.xml.ws.Binding; import … Read more

Changing the default XML namespace prefix generated with JAXWS

Maybe it’s late for you and I’m not sure if this may work, but you can try. First you need to implement a SoapHandler and, in the handleMessage method you can modify the SOAPMessage. I’m not sure if you can modify directly that prefix but you can try: public class MySoapHandler implements SOAPHandler<SOAPMessageContext> { @Override … Read more

Error consuming webservice, content type “application/xop+xml” does not match expected type “text/xml”

For anyone suffering from the same problem; I’ve found a solution for consuming the web service as a Service Reference (WCF). The BasicHttpBinding.MessageEncoding property needs setting to “Mtom”. Here’s a snippet of the required config setting: <configuration> <system.serviceModel> <bindings> <basicHttpBinding> <binding messageEncoding=”Mtom”> </binding> </basicHttpBinding> </bindings> </system.serviceModel> </configuration> Edit: If you are having the same issue … Read more

HttpDelete with body

Have you tried overriding HttpEntityEnclosingRequestBase as follows: import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; import java.net.URI; import org.apache.http.annotation.NotThreadSafe; @NotThreadSafe class HttpDeleteWithBody extends HttpEntityEnclosingRequestBase { public static final String METHOD_NAME = “DELETE”; public String getMethod() { return METHOD_NAME; } public HttpDeleteWithBody(final String uri) { super(); setURI(URI.create(uri)); } public HttpDeleteWithBody(final URI uri) { super(); setURI(uri); } public HttpDeleteWithBody() { super(); } } … Read more

javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake during web service communicaiton

Java 7 defaults to TLS 1.0, which can cause this error when that protocol is not accepted. I ran into this problem with a Tomcat application and a server that would not accept TLS 1.0 connections any longer. I added -Dhttps.protocols=TLSv1.1,TLSv1.2 to the Java options and that fixed it. (Tomcat was running Java 7.)