Hi Dmitry
Having a service method with a void return type should result in an
empty response body. Would you raise a JIRA for this please?
In the meantime, it looks like a simpler workaround would be to
explicitly specify the binding for the request payload. See
http://jibx.sourceforge.net/jibxws/service-def.html#jibx-in-binding for
details. Something like:
<jibx-in-binding binding-name="test1_binding"
package-name="org.jibx.ws.soap.testdata.basic" />
(This will cause it to skip over the code block starting at line 166 of
org.jibx.ws.server.Service, where it is unnecessarily setting the
m_outBodyBindingFactory).
HTH,
Nigel
On 16/06/11 21:38, Dmitry Ulanov wrote:
Olala, I can do it, but may be exists more correct way? If you would
like to respond with empty or 'xsd:simpleElement' SOAP body in your
service impl.:
import java.io.IOException;
import org.jibx.ws.context.InContext;
import org.jibx.ws.context.OutContext;
import org.jibx.ws.io.PayloadWriter;
import org.jibx.runtime.IXMLWriter;
import org.jibx.ws.WsException;
public final class Service {
private final Logger logger = LoggerFactory.getLogger(Service.class);
public void subscription(final Payload payload, InContext in,
OutContext out) {
...do something...
out.setBodyWriter(new PayloadWriter() {
public void invoke(IXMLWriter xmlWriter, Object payload)
throws IOException, WsException {
((org.jibx.runtime.impl.UTF8StreamWriter)
xmlWriter).writeTextContent("");
}
public void reset() {
}
});
}
}
On Wed, Jun 15, 2011 at 3:41 PM, Dmitry Ulanov <dula...@gmail.com
<mailto:dula...@gmail.com>> wrote:
Hello, I try to implement a simple SOAP service via JiBX WS and
would like to respond with the empty body:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="urn:headerblock">
<soapenv:Header>...something...</soapenv:Header>
<soapenv:Body></soapenv:Body>
</soapenv:Envelope>
In my service impl. I try to use a method with 'void' return type,
but got the error:
413 [qtp19278836-15] DEBUG o.j.ws.io.MarshallingPayloadWriter -
Attempting to marshall payload 'null'
414 [qtp19278836-15] DEBUG org.jibx.ws.soap.SoapProcessor -
Aborting send Hope that h
414 [qtp19278836-15] DEBUG o.j.w.h.servlet.WsServletDelegate -
Closing output connection
414 [qtp19278836-15] DEBUG o.j.w.h.servlet.WsServletDelegate -
Closing writer
431 [qtp19278836-15] ERROR org.jibx.ws.server.Service - Aborted
response due to error after commit
org.jibx.ws.WsException: Payload object must have a defined mapping
at
org.jibx.ws.io.MarshallingPayloadWriter.invoke(MarshallingPayloadWriter.java:111)
~[jibx-ws-0.9.1.jar:na]
at
org.jibx.ws.context.OutContext.invokeBodyWriter(OutContext.java:65)
~[jibx-ws-0.9.1.jar:na]
at
org.jibx.ws.soap.SoapProcessor.sendMessage(SoapProcessor.java:145)
~[jibx-ws-0.9.1.jar:na]
at
org.jibx.ws.server.Service.processRequest(Service.java:266)
~[jibx-ws-0.9.1.jar:na]
at
org.jibx.ws.http.servlet.WsServletDelegate.doPost(WsServletDelegate.java:148)
[jibx-ws-0.9.1.jar:na]
at
org.jibx.ws.http.servlet.WsServlet.doPost(WsServlet.java:76)
[jibx-ws-0.9.1.jar:na]
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
[servlet-api-2.5.jar:2.5]
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
[servlet-api-2.5.jar:2.5]
at
org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:538)
[jetty-servlet-7.4.2.v20110526.jar:7.4.2.v20110526]
at
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:478)
[jetty-servlet-7.4.2.v20110526.jar:7.4.2.v20110526]
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
[jetty-server-7.4.2.v20110526.jar:7.4.2.v20110526]
at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:517)
[jetty-security-7.4.2.v20110526.jar:7.4.2.v20110526]
at
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:225)
[jetty-server-7.4.2.v20110526.jar:7.4.2.v20110526]
at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:937)
[jetty-server-7.4.2.v20110526.jar:7.4.2.v20110526]
at
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)
[jetty-servlet-7.4.2.v20110526.jar:7.4.2.v20110526]
at
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)
[jetty-server-7.4.2.v20110526.jar:7.4.2.v20110526]
at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:871)
[jetty-server-7.4.2.v20110526.jar:7.4.2.v20110526]
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
[jetty-server-7.4.2.v20110526.jar:7.4.2.v20110526]
at
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:247)
[jetty-server-7.4.2.v20110526.jar:7.4.2.v20110526]
at
org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
[jetty-server-7.4.2.v20110526.jar:7.4.2.v20110526]
at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)
[jetty-server-7.4.2.v20110526.jar:7.4.2.v20110526]
at org.eclipse.jetty.server.Server.handle(Server.java:346)
[jetty-server-7.4.2.v20110526.jar:7.4.2.v20110526]
at
org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:589)
[jetty-server-7.4.2.v20110526.jar:7.4.2.v20110526]
at
org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:1065)
[jetty-server-7.4.2.v20110526.jar:7.4.2.v20110526]
at
org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:823)
[jetty-http-7.4.2.v20110526.jar:7.4.2.v20110526]
at
org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:220)
[jetty-http-7.4.2.v20110526.jar:7.4.2.v20110526]
at
org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:411)
[jetty-server-7.4.2.v20110526.jar:7.4.2.v20110526]
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:535)
[jetty-io-7.4.2.v20110526.jar:7.4.2.v20110526]
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
[jetty-io-7.4.2.v20110526.jar:7.4.2.v20110526]
at
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:529)
[jetty-util-7.4.2.v20110526.jar:7.4.2.v20110526]
at java.lang.Thread.run(Thread.java:662) [na:1.6.0_26]
After that was an attempt to return 'java.lang.String', but with
the same result. Is it possible to return a null or a simple java
type from JiBX WS service?
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users