Eran, Before you pursue this issue any further, I would like to mention what I'm really trying to achieve. I want to make a call in rest style from a browser. Ex: http://xyy.nb.com/user?param0=23 with output in XML format.
Ex: <user> <firstName>Punya</firstName> <lastName>A. K.</lastName> <specialty> <subSpecialty>test</subSpecialty> </specialty> </user> To achieve this, I think I can define the XML schema in WSDL and then generate the web service from that. Not sure if Axis2 supports complex types. Really appreciate any help on this. I'm attaching the wsdl for SampleService for your reference. Thanks much, Punya -----Original Message----- From: AmburK, Punya [mailto:[EMAIL PROTECTED] Sent: Monday, August 07, 2006 11:11 AM To: [email protected]; [EMAIL PROTECTED] Subject: RE: Contract First approach - Axis2 and REST Eran, I tried this with latest nightly build war (axis2.war). Still the same problem. -Punya -----Original Message----- From: Eran Chinthaka [mailto:[EMAIL PROTECTED] Sent: Friday, August 04, 2006 6:48 PM To: [email protected] Subject: Re: Contract First approach - Axis2 and REST Can you test this against the latest nightly build of Axis2? -- Chinthaka AmburK, Punya wrote: > > Hi, > > I'm trying to write web service using Axis2 in REST style. > I created the following service as specified in one of the articles on > the net and deployed it to Axis2 and everything seems to work fine (code > first approach). > -------------------------------------------------------------------------------- > > > /** > * The service implementation class > */ > > import java.util.HashMap; > > public class SimpleService { > > /** > * The echo method which will be exposed as the > * echo operation of the web service > */ > public String echo() { > System.out.println("Echo test"); > return "Echo Successful"; > } > > public String echoString(String value) { > System.out.println("value=" + value); > StringBuffer sb = new StringBuffer(""); > sb.append("<USER>" + "\n" + "</USER>"); > return sb.toString(); > } > } > > > -------------------------------------------------------------------------------- > > > The service works fine when i hit the following urls: > http://localhost:8080/axis2/rest/SimpleService /echo > <http://localhost:8080/axis2/rest/SimpleService/echo> > http://localhost:8080/axis2/rest/SimpleService /echoString?param0=test > <http://localhost:8080/axis2/rest/SimpleService/echoString?param0=test> > > Then I tried "Contract first approach" by taking the wsdl that was > generated for the above code and ran WSDL2Java utility to generate the > service. I modified the skeleton service generated as shown below: > -------------------------------------------------------------------------------- > /** > * SimpleServiceSkeleton.java > * > * This file was auto-generated from WSDL > * by the Apache Axis2 version: SNAPSHOT Aug 03, 2006 (07:21:24 > GMT+00:00) > */ > package com.epocrates.webService; > /** > * SimpleServiceSkeleton java skeleton for the axisService > */ > public class SimpleServiceSkeleton{ > > > /** > * Auto generated method signature > > > */ > public org.apache.ws.axis2.xsd.EchoResponse echo > ( > > ) > > { > org.apache.ws.axis2.xsd.EchoResponse responseSt = new > org.apache.ws.axis2.xsd.EchoResponse(); > //Todo fill this with the necessary business logic > //throw new java.lang.UnsupportedOperationException(); > responseSt.set_return("echo test successfull"); > return responseSt; > > > } > > > /** > * Auto generated method signature > > * @param param2 > > */ > public org.apache.ws.axis2.xsd.EchoStringResponse echoString > ( > org.apache.ws.axis2.xsd.EchoString param2 > ) > > { > org.apache.ws.axis2.xsd.EchoStringResponse re = new > org.apache.ws.axis2.xsd.EchoStringResponse(); > //Todo fill this with the necessary business logic > //throw new java.lang.UnsupportedOperationException(); > re.set_return("param0" + param2); > return re; > } > > } > > > -------------------------------------------------------------------------------- > > > Now accessing the URL > http://localhost:8080/axis2/rest/SimpleService/echo > <http://localhost:8080/axis2/rest/SimpleService/echo> , throws the > following exception: > > java.lang.NoSuchMethodError: > > com.epocrates.webService.SimpleServiceSkeleton.echo()Lorg/apache/ws/axis2/xsd/EchoResponse; > > com.epocrates.webService.SimpleServiceMessageReceiverInOut.invokeBusinessLogic(SimpleServiceMessageReceiverInOut.java:50) > > org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(AbstractInOutSyncMessageReceiver.java:39) > org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:492) > > org.apache.axis2.transport.http.util.RESTUtil.invokeAxisEngine(RESTUtil.java:149) > > org.apache.axis2.transport.http.util.RESTUtil.processGetRequest(RESTUtil.java:139) > > ................................. > > and accessing > http://localhost:8080/axis2/rest/SimpleService/echoString?param0=test > <http://localhost:8080/axis2/rest/SimpleService/echoString?param0=test> > , throws the following exception: > > org.apache.axis2.AxisFault: java.lang.UnsupportedOperationException: > This element was not created in a manner to be switched; nested > exception is: > java.lang.RuntimeException: java.lang.UnsupportedOperationException: > This element was not created in a manner to be switched; nested > exception is: > org.apache.axis2.AxisFault: java.lang.UnsupportedOperationException: > This element was not created in a manner to be switched; nested > exception is: > java.lang.RuntimeException: java.lang.UnsupportedOperationException: > This element was not created in a manner to be switched > > org.apache.axis2.transport.http.util.RESTUtil.processGetRequest(RESTUtil.java:142) > > org.apache.axis2.transport.http.AxisRESTServlet.doGet(AxisRESTServlet.java:36) > ........................ > > Am I missing anything? Please help!! > > Thanks, > Punya > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
TestService.wsdl
Description: TestService.wsdl
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
