It little more complicated than that. You could think like, user gives me class file(The class can have any kind of methods.). I am just using a POJO deployment feature in the Axis 2.
As of now I dont check the class files for these kinds of method. If I were to do what you suggested, it would be more complex. 1) I need to inspect the class file passed to me to find such kind of methods. 2) Somehow I need to generate a new class file by modifying the method signature and instructions. 3) Use this new file for axis service. And when the value is returned, I again need to make sure whether to return it or not. Moreover, I think this might be a bug in Axis 2. Thanks, Paul On Tue, Oct 12, 2010 at 11:41 AM, Martin Makundi < martin.maku...@koodaripalvelut.com> wrote: > Is it a problem that it returns a value if you simply don't pass it > onwards? > > 2010/10/12 paul nibin <nibin....@gmail.com>: > > Thank you so much for the reply.. > > > > Actually, I am trying to integrate Axis 2 to an existing framework. User > can > > write web service in all kind of ways. And we need to support all. > > > > On Tue, Oct 12, 2010 at 11:35 AM, Martin Makundi > > <martin.maku...@koodaripalvelut.com> wrote: > >> > >> Ah, so your problem is only the void ? Ok. Then I don't know what's > >> wrong. Is it a blocker or you'd just rather have it void than return > >> dummy value? > >> > >> ** > >> Martin > >> > >> 2010/10/12 paul nibin <nibin....@gmail.com>: > >> > Sorry. I did not exactly understand what you meant.. > >> > > >> > I tried the following web service > >> > > >> > public class SimpleTestVoid > >> > { > >> > public String echo( String message ) throws Exception > >> > { > >> > return message; > >> > } > >> > } > >> > > >> > Even though the method is throws exception, the client is successfully > >> > able > >> > to invoke the web method and everything is working great. > >> > > >> > Thanks, > >> > Paul > >> > > >> > On Tue, Oct 12, 2010 at 11:13 AM, Martin Makundi > >> > <martin.maku...@koodaripalvelut.com> wrote: > >> >> > >> >> If you want to throw exceptions they must be wrapped into web > service > >> >> exceptions. > >> >> > >> >> ** > >> >> Martin > >> >> > >> >> 2010/10/12 paul nibin <nibin....@gmail.com>: > >> >> > Hi, > >> >> > > >> >> > Thank you so much for the response. > >> >> > > >> >> > I know that it will work if the "throws Exception" clause is > removed. > >> >> > > >> >> > But I need to support this feature. Is there any way to support > >> >> > invoking > >> >> > a > >> >> > method which does not take any input arguments, returns void and > >> >> > throws > >> >> > an > >> >> > exception? > >> >> > > >> >> > Paul > >> >> > > >> >> > On Tue, Oct 12, 2010 at 11:01 AM, Martin Makundi > >> >> > <martin.maku...@koodaripalvelut.com> wrote: > >> >> >> > >> >> >> Hi! > >> >> >> > >> >> >> Try removing your unnecessary "throws Exception" clause. > >> >> >> > >> >> >> ** > >> >> >> Martin > >> >> >> > >> >> >> 2010/10/12 paul nibin <nibin....@gmail.com>: > >> >> >> > Hi all, > >> >> >> > > >> >> >> > I am trying to invoke a simple web service. > >> >> >> > > >> >> >> > public class SimpleTestVoid > >> >> >> > { > >> >> >> > public void printMessage() throws Exception > >> >> >> > { > >> >> >> > System.out.println( "Hello world" ); > >> >> >> > } > >> >> >> > } > >> >> >> > > >> >> >> > > >> >> >> > The WSDL is generated fine. Generated the client. But when > >> >> >> > invoking > >> >> >> > the > >> >> >> > service, I am getting an exception. > >> >> >> > > >> >> >> > java.lang.UnsupportedOperationException: An access occurred that > >> >> >> > is > >> >> >> > not > >> >> >> > valid. > >> >> >> > at > >> >> >> > > >> >> >> > > >> >> >> > > >> >> >> > > org.apache.axis2.description.InOnlyAxisOperation.getMessage(InOnlyAxisOperation.java:117) > >> >> >> > at > >> >> >> > > >> >> >> > > >> >> >> > > >> >> >> > > org.apache.axis2.util.MessageContextBuilder.createOutMessageContext(MessageContextBuilder.java:183) > >> >> >> > at > >> >> >> > > >> >> >> > > >> >> >> > > >> >> >> > > org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:37) > >> >> >> > at > >> >> >> > > >> >> >> > > >> >> >> > > >> >> >> > > org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:114) > >> >> >> > at > >> >> >> > org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:173) > >> >> >> > at > >> >> >> > > >> >> >> > > >> >> >> > > >> >> >> > > org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:167) > >> >> >> > at > >> >> >> > > >> >> >> > > >> >> >> > > org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:142) > >> >> >> > > >> >> >> > I debugged some part of the code. > >> >> >> > > >> >> >> > When the service is deployed, according to the signature of the > >> >> >> > method, > >> >> >> > it > >> >> >> > is creating a InOnlyAxisOperation with "robust-in-only" as the > >> >> >> > message > >> >> >> > exchange pattern( it is not taking any input params and throwing > >> >> >> > an > >> >> >> > exception). > >> >> >> > > >> >> >> > > >> >> >> > > org.apache.axis2.deployment.util.UtilsgetAxisOperationForJmethod() > >> >> >> > > >> >> >> > if ("void".equals(method.getReturnType().getName())) { > >> >> >> > if (method.getExceptionTypes().length > 0) { > >> >> >> > operation = AxisOperationFactory > >> >> >> > > >> >> >> > .getAxisOperation(WSDLConstants.MEP_CONSTANT_ROBUST_IN_ONLY); > >> >> >> > } else { > >> >> >> > operation = AxisOperationFactory > >> >> >> > > >> >> >> > .getAxisOperation(WSDLConstants.MEP_CONSTANT_IN_ONLY); > >> >> >> > } > >> >> >> > > >> >> >> > If MEP_CONSTANT_IN_ONLY message exchange pattern is used, then > all > >> >> >> > works > >> >> >> > fine. But if there a method which does not take any input > >> >> >> > parameters > >> >> >> > and > >> >> >> > throws some exception, then this issue comes. > >> >> >> > > >> >> >> > > >> >> >> > > >> >> >> > > org.apache.axis2.description.AxisOperationFactory.getAxisOperation(int > >> >> >> > mepURI) > >> >> >> > > >> >> >> > case WSDLConstants.MEP_CONSTANT_ROBUST_IN_ONLY : { > >> >> >> > abOpdesc = new InOnlyAxisOperation(); > >> >> >> > > >> >> >> > > >> >> >> > > >> >> >> > > >> >> >> > > abOpdesc.setMessageExchangePattern(WSDL2Constants.MEP_URI_ROBUST_IN_ONLY); > >> >> >> > break; > >> >> >> > > >> >> >> > So when the invoking the method using a client, in > >> >> >> > > >> >> >> > > >> >> >> > > >> >> >> > > org.apache.axis2.util.MessageContextBuilder.createOutMessageContext(MessageContext > >> >> >> > inMessageContext) > >> >> >> > > >> >> >> > if (ao != null){ > >> >> >> > > >> >> >> > > >> >> >> > > >> >> >> > > >> >> >> > > newmsgCtx.setAxisMessage(ao.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE)); > >> >> >> > } > >> >> >> > > >> >> >> > Since a0 is a org.apache.axis2.description.InOnlyAxisOperation, > >> >> >> > the > >> >> >> > following getMessage is invoked, so it is throwing this > >> >> >> > UnsupportedOperationException. > >> >> >> > > >> >> >> > public AxisMessage getMessage(String label) { > >> >> >> > if (WSDLConstants.MESSAGE_LABEL_IN_VALUE.equals(label)) > { > >> >> >> > return (AxisMessage) getChild("inMessage"); > >> >> >> > } else { > >> >> >> > throw new > >> >> >> > > >> >> >> > > UnsupportedOperationException(Messages.getMessage("invalidacess")); > >> >> >> > } > >> >> >> > } > >> >> >> > > >> >> >> > If any more info is required please let me know. Hoping for a > >> >> >> > response.. > >> >> >> > > >> >> >> > Please.. I need help with this one... > >> >> >> > > >> >> >> > Thanks, > >> >> >> > Paul > >> >> >> > > >> >> >> > >> >> >> > >> >> >> > --------------------------------------------------------------------- > >> >> >> To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org > >> >> >> For additional commands, e-mail: java-user-h...@axis.apache.org > >> >> >> > >> >> > > >> >> > > >> >> > >> >> --------------------------------------------------------------------- > >> >> To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org > >> >> For additional commands, e-mail: java-user-h...@axis.apache.org > >> >> > >> > > >> > > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org > >> For additional commands, e-mail: java-user-h...@axis.apache.org > >> > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org > For additional commands, e-mail: java-user-h...@axis.apache.org > >