Note that there are some explanatory texts on larger screens.

plurals
  1. POJax-WS MTOM enabling issue
    text
    copied!<p>I'm trying to write webservice using JAX-WS RI. This service contains attachment and annotated with </p> <pre><code>@MTOM </code></pre> <p>Also I wrote handler which checks ws-security usernameToken. When login/password are incorrect, handler generates fault and returns it to client. I'm trying to enable mtom on client-side:</p> <pre><code>((SOAPBinding)service).getBinding().setMTOMEnabled(true); </code></pre> <p>Finally I receive exception: </p> <pre><code>Exception in thread "main" javax.xml.ws.WebServiceException: Missing Start Boundary, or boundary does not start on a new line at com.sun.xml.ws.encoding.MimeMultipartParser.getNextPart(MimeMultipartParser.java:148) at com.sun.xml.ws.encoding.MimeMultipartParser.getRootPart(MimeMultipartParser.java:89) at com.sun.xml.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:303) at com.sun.xml.ws.encoding.MimeCodec.decode(MimeCodec.java:116) at com.sun.xml.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:253) at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:152) at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:74) at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:559) at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:518) at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:503) at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:400) at com.sun.xml.ws.client.Stub.process(Stub.java:228) at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:120) at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:226) at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:206) at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:103) at $Proxy28.putContent(Unknown Source) at example.HelloWorldClient.main(HelloWorldClient.java:54) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) </code></pre> <p>Could anyone explain how to fix this?</p> <p><strong>Update:</strong> Research shows that problem is on server-side:</p> <p>response, i get from server also has "multipart/related" type containing boundry uuid but in the message this uuid is null. Is there way to make response not multipart, or set up handler to work with it correct?</p> <p><strong>Update:</strong> Finally found the solution(this is not optimal way, but for this moment this one works): I don't know how to disable multipart in SoapHandler(javax.xml.ws.handler.soap.SOAPHandler), but SOAPMessageContext have a reference to HttpServletResponse, where you can write any data you have. Don't forget to close OutputStream, and return false in <code>handleMessage</code> method. Also you need to set up correct CotnentType. This hack works for methods which send attachemtn to server, but don't have any in response(in my case there fault in response).</p> <p>One again this is very "strange" way. But this one works. If you have better one, please answer this topic.</p> <p>Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload