WSO2Con 2013 CFP Banner

# Hello World with Apache Axis2

Date: Mon, 29th May, 2006
Level:
 Ruchith FernandoSoftware EngineerWSO2 Inc.

We will start with a simple Java class which will be turned into a service with the necessary packaging. Next a client will be created using the code generated by the WSDL2Java code which will be used to invoke the service we created. You will have to download Apache Axis2-Nightly build Satandard Binary Distribution to try this out and the source code of both client and service are available here. Now simply follow the steps below.

## Step 1: A simple Java class

First we need a Web service and an operation in that service for a client to invoke. Lets develop a Web service with an operation which will echo a string value. The simplest way to do this is with a Java class as shown below:
/** * The service implementation class */public class SimpleService {	/**	 * The echo method which will be exposed as the 	 * echo operation of the web service	 */	public String echo(String value) {		return value;	}}---------------------------------------------------------------save as - SimpleService.java---------------------------------------------------------------

## Step 2: The service descriptor

Each Axis2 service must have a services.xml file which will inform Axis2 about the service. Following is the services.xml file contents for the SimpleService Web service.
<service>	<parameter name="ServiceClass"           locked="false">SimpleService</parameter>
<operation name="echo">		<messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>	</operation>    </service>
The "service" element encapsulates the information about a single service. Within the "service" element there should be a parameter specifying the service implementation Java class. The parameter is specified as a "parameter" element as shown below.
<parameter name="ServiceClass" locked="false">SimpleService</parameter>
The second child element of the "service" element "operation" element describes the operation and the message receiver that is to be used for that operation. For this service we set the "name" attribute of the "operation" element to the name of the method that we wish to expose as a Web service operation. Hence we set it to "echo":
<operation name="echo">
<messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>

## Step 3: Packaging the service

Axis2 expects services to be packaged according to a certain format. The package must be a .jar file with the compiled Java classes and a META-INF directory which will hold the services.xml file. The jar file can be name .aar to distinguish it as an Axis2 service archive. It's important to note that the part of the file name before ".aar" is the service name. Create a temp directory in the same location where the SimpleService.java file exists
[Linux]mkdir temp[Windows]md temp
Now compile the SimpleService.java class and move the SimpleService.class file to the temp directory.
javac SimpleService.java -d temp/
Create a META-INF directory within the "temp" directory and copy the service.xml file into the META-INF directory. Change directory to the "temp" directory and use the "jar" command as follows to create the service archive named SimpleService.aar.
jar -cvf SimpleService.aar *

## Step 4: Hosting the service

There are a number of ways to host the service that was created in the previous step. The two main methods are:
• Using the SimpleHTTPServer that is available in the Apache Axis2 distribution
• Using Axis2 with Tomcat

This tutorial will use the org.apache.axis2.transport.http.SimpleHTTPServer to host the SimpleService.aar Axis2 service archives are placed in a directory named "services" in a repository directory. The structure of an example repository directory is shown below.

Now create the my-axis2-repo directory structure and copy the SimpleService.aar file into the "services" directory. This example does not require the axis2.xml to be available in the "conf" directory. Now we have to start the SimpleHTTPserver using the above my-axis2-repo directory as the repository directory. The axis2-std-SNAPSHOT-bin distribution comes with a "bin" directory which contains a Linux shell script and a Windows batch file to start the SimpleHTTPServer: http-server.sh and http-server.bat Start the server pointing to my-axis2-repo directory:

[Linux]sh http-server.sh /path/to/my-axis2-repo[Windows]http-server.bat drive:\path\to\my-axis2-repo
The following output will be shown in the console:
[SimpleHTTPServer] Starting[SimpleHTTPServer] Using the Axis2 Repository /home/ruchith/Desktop/ibm-workshop/axis2-repo[SimpleHTTPServer] Listening on port 8080[JAM] Warning: You are running under a pre-1.5 JDK.  JSR175-style source annotations will not be available[SimpleHTTPServer] Started
Now when we point a browser to http://localhost:8080/ the SimpleHTTPServer will respond with a list of available services and the SimpleService will be listed there.

## Step 5: Accessing the service with a generated client

Now lets use the WSDL2Java tool generate the client side stubs to interact with the service.
[Linux]$sh WSDL2Java.sh -uri http://localhost:8080/axis2/services/SimpleService?wsdl -o /path/to/my/client/code/[Windows]WSDL2Java.bat -uri http://localhost:8080/axis2/services/SimpleService?wsdl -o /path/to/my/client/code/ This generates two .java files and we will be using the org.apache.axis2.SimpleServiceStub to invoke the "echo" operation of the service. Now lets create a new Client.java class which uses the org.apache.axis2.SimpleServiceStub. For simplicity lets create the Client.java file in the same package as the generated code (i.e.org.apache.axis) and save it along with the other generated code. package org.apache.axis2; import org.apache.axis2.SimpleServiceStub.EchoResponse; public class Client { public static void main(String[] args) throws Exception { SimpleServiceStub stub = new SimpleServiceStub(); //Create the request SimpleServiceStub.Echo request = new SimpleServiceStub.Echo(); request.setParam0("Hello world"); //Invoke the service EchoResponse response = stub.echo(request); System.out.println("Response : " + response.get_return()); } }----------------------------------------------------------------save as - Client.java---------------------------------------------------------------- Now to we can compile and run the client code. Its is important to note that the classpath must have all the jars in the "lib" directory of the axis2-std-1.0-RC1-bin distribution when compiling and running the client. The following command will compile the client's source to a "temp" directory $ javac -extdirs /path/to/axis2-RC1-std-bin/lib/ org/apache/axis2/*.java  -d temp/

We can run the client program as shown below from the "temp" directory:

### Thanks

Great! Thanks for the great informative post and your effort. I think the above article is valuable for all concerned people. For me the Informations are really really useful. I've Bookmarked this page for future reference. Thank you Robin Jokes

### Javac cannot find source files

Hey guys. I can't seem to compile things with: javac -extdirs /path/to/axis2-RC1-std-bin/lib/ org/apache/axis2/*.java -d temp/ i'm getting a "javac: cannot find source files" error. Any ideas? I'm pretty sure the paths are correct...

### HelloWorld with Axis

Hi, I got stucked at 4th point itself. When I execute the axis2server.bat file, It is saying that, the JAVA_HOME environment variable is not set properly. But I have set the enviormant variables properly. I've set the Jar files directory in CLASS_PATH as well. Meanwhile, I have a doubt that, You've mentioned http-server.bat. But I couldn't found the file in the nightly build repository. Instead I've Axis2.bat and axis2server.bat. Please help me out in this.

### problem with client code

Hi,   I did pretty much the same thing as suggested on this website, except I am using the SimpleHTTPServer. At least, viewing my service on a browser works! What I have a problem with is creating my own client code that successfully connects and retrieves data from this server.   here is my server:   public class EmbeddedAxis2Server { public static void main(String[] args) throws Exception { ConfigurationContext context = ConfigurationContextFactory. createConfigurationContextFromFileSystem(null, null); AxisService service = AxisService.createService(caps.integration.rhos.dk.schema.astraiaservice._2008._04._15.PersonInfo.class.getName(), context.getAxisConfiguration()); context.getAxisConfiguration().addService(service); SimpleHTTPServer server = new SimpleHTTPServer(context, 8888); server.start(); }}   It seems to work fine.... The only thing that points out to me as being MAYBE not fine, is the fact that when I put in the URL that is specified in my wsdl: http://localhost:8888/services/PersonInfo it is automatically redirected to http://localhost:8888/axis2/services/ But it does seem to show me the correct information on the web page that appears: Deployed services PersonInfo Available operations getPersonInfo   HOWEVER!! :( When I attempt to connect to it using a coded client (using generated code created via wsdk2java tool) I get the following exception: org.apache.axis2.AxisFault: The service cannot be found for the endpoint reference (EPR) 127.0.0.1/services/PersonInfo  at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:486) at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:343) at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:389) at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163) at caps.integration.rhos.dk.schema.astraiaservice._2008._04._15.PersonInfoStub.getPersonInfo(PersonInfoStub.java:142) at com.astraia.axisclient.Client.getPersonInfo(Client.java:44) at com.astraia.axisclient.Client.main(Client.java:23) The client code is short and simple: public static void getPersonInfo(){ try { ConfigurationContext context = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null); PersonInfoStub stub =new PersonInfoStub(context);  GetPersonInfoIn req =new GetPersonInfoIn(); req.setCivilRegistrationIdentifier("CIV123"); req.setHospitalCode("HOS123"); req.setRequestId("123"); req.setUserName("sean"); GetPersonInfoOut res = stub.getPersonInfo(req); System.out.println(res.toString());  } catch(Exception e){ e.printStackTrace(); System.out.println("\n\n\n"); } }     Anyone got any idea what I am doing wrong? Does anything stick out as a possible cause? I am kinda stumped! :(

### Using the tutorial with Tomcat5.5

I saw one post indicating doing the tutorial with Tomcat and not Apache. Can you please send me the steps to do it, thanks in advance

### POJO File Access

Hi,     I'm having difficulties reading from my configuration file  "properties\System.properties"... I placed the "properties" directory in CATALINA_HOME and my web service is unable to read it; although it works for plain JSP.   Am i missing something here? should i place my "properties" directory somewhere else? regards, ayessa

### Solution to Problems Using Tomcat

Hi, I am using Tomcat 5.5 to deploy the web service. I was unable to do so with the existing services.xml so i had to add "HelloWorld" before parameter name = service class, then it works. Thanks Anil

### did you manage to do it

I saw your post and interested to see if you got it working Tomcat and not Apache. Can you please send me the steps to do it, thanks in advance

### Anonymous internal server error inside Axis2

Axis2 1.1.1 is failing to answer a request due to an internal server error. Even trace level logging only shows this:6038 [HttpConnection-8080-1] DEBUG org.apache.axis2.handlers.addressing.AddressingHandler - Addressing is disabled .....6038 [HttpConnection-8080-1] DEBUG org.apache.axis2.engine.Phase - Checking post-conditions for phase "MessageOut"6050 [HttpConnection-8080-1] DEBUG org.apache.axiom.om.util.StAXUtils - XMLStreamWriter is com.ctc.wstx.sw.SimpleNsStreamWriter6055 [HttpConnection-8080-1] DEBUG org.apache.axis2.transport.http.server.wire - << HTTP/1.1 500 Internal server error6055 [HttpConnection-8080-1] DEBUG org.apache.axis2.transport.http.server.wire - << Date: Fri, 02 Mar 2007 15:29:44 GMT6055 [HttpConnection-8080-1] DEBUG org.apache.axis2.transport.http.server.wire - << Server: Simple-Server/1.16055 [HttpConnection-8080-1] DEBUG org.apache.axis2.transport.http.server.wire - << Content-Length: 2926055 [HttpConnection-8080-1] DEBUG org.apache.axis2.transport.http.server.wire - << Content-Type: text/xml; charset=UTF-86055 [HttpConnection-8080-1] DEBUG org.apache.axis2.transport.http.server.wire - << Connection: Close6056 [HttpConnection-8080-1] DEBUG org.apache.axis2.transport.http.server.DefaultHttpServiceProcessor - Response sent6056 [HttpConnection-8080-1] DEBUG org.apache.axis2.transport.http.server.DefaultHttpConnectionManager - org.apache.axis2.transport.http.server.DefaultHttpServiceProcessor@d1b44b terminated I can get the WSDL for this service (a duplicate of the echo service) and the autogenerated stubs seem to work fine. Something bad is happening in the server, but I don't have any details :(

### Unable to run the Code from the command Line

Hi ... Me a newBie to web service ... i got the SimpleService code downlaoded along with the Client,Created sepearte java files related to the SimpleService using the wsdl and the url path ,deployed teh service sucessfuly as service in the Tomcat and gave run the clinet from the Eclipse after loading all teh relavent jar files in the Build path . Now the problem here is when i run from the Eclipse i get the Hello Worl problem,but the when i trying to run it from the command line by going to the bin folder of axis and then using the tool axis2 and the <Client> as the java program iam getting different errors from stub .... to classnot found exception . How can i include so many jar files in my classpath to execute the program.Any immediate help appreciated ...

### Using nightly build - SimpleServiceStub issues

I am using the following build Apache Axis2 SNAPSHOT build (September 13, 2006) When I generate the client code using WSDL2Java.bat -uri http://localhost:8080/axis2/services/SimpleService?wsdl -o c:\working\simpleWs\client\code The stub does not have the inner Echo class resulting in compile errors as described below: org/apache/ws/axis2/Client.java:3: cannot find symbol symbol : class EchoResponse location: class org.apache.ws.axis2.SimpleServiceStub import org.apache.ws.axis2.SimpleServiceStub.EchoResponse; Has this issue been resolved ? Is there something I ma missing here ? thanks, Robbie

### Echo Static Class not generated

Hi all. As some had already pointed out, Axis2 does not generate the static class (for the stub) from the WSDL. I'm experiencing that problem with both Axis2 1.0 and the latest (nightly)version... but I can't figure out when it does work and when it doesn't. Any clues? I've deployed two WS (the one from you tut and one made by a coworker) that are basically the same... but only one works (and it does so seamlessly..!) Any advice would be greatly appreciated. tom

### .

Just to say that by using the latest nightly build I got the example running, but having to change setParam0 to setMessage. hth, tom

### setMessage still doesn't do it.

Hi tom, I changed setParam0 to setMessage, but it still doesn't quite work for me. I'm using axis2 1.5.1. Any idea? Thanks. Paul

### setParam0 should be changed to setArgs0

with this change, Client.java compiles. I'm using axis2 1.5.1.

### wsdl problems

After building the .aar file and moving it under the axis2/WEB-INF/services directory, the service seems to deploy correctly as i can view the services via IE Browser. However when you try to view the WSDL I get the error - Unable to generate WSDL for this service Either user has not dropped the wsdl into META-INF or operations use message receivers other than RPC. Since i followed the example, I have no deployed wsdl file but the services.xml file uses the messageReceiver class="org.apache.axis2.rpc.receivers.RPCInOutAsyncMessageReceiver" I tried one of the sample services MyService and got the exact Error. Something i discovered is that with the 1.0 war file the wsdl gets displayed when i click on the service name from the services displayed in a browser. With the nightly distribution war file 23 july the above error occurs. When i then try to generated the stub code via wsdl2java, the request/response inner classes dont generate which i believe is a known problem. Question is how can i get things to work where i can get the wsdl is automatically generated and the proper stub classes are also generated? Thoughts?

### Re: wsdl problems

Hi, Do you still have this problem of not being about to generate the WSDL in the case of the nightly build? If so please file a JIRA bug : https://issues.apache.org/jira/browse/AXIS2 Thanks, Ruchith

### Need REST client example code

Hi there, Thank you for your good article. However, I would like to ask you help to provide the example code of REST client. I myself have tried to use the example from apache axis2 website, but always got the error message after running the REST client. Thank you for any response in advance. ---------------------------------------------------------------------- public class RESTClient { private static String toEpr = "http://localhost:8122/AxisWeb/rest/SimpleService/echo"; public static void main(String[] args) throws AxisFault { Options options = new Options(); options.setTo(new EndpointReference(toEpr)); options.setTransportInProtocol(Constants.TRANSPORT_HTTP); //options.setProperty(Constants.Configuration.ENABLE_REST,Constants.VALUE_TRUE); options.setProperty(Constants.Configuration.HTTP_METHOD, Constants.Configuration.HTTP_METHOD_GET); ServiceClient client = new ServiceClient(); client.setOptions(options); OMFactory fac = OMAbstractFactory.getOMFactory(); OMNamespace omNs = fac.createOMNamespace("http:///xsd", "http:///xsd"); OMElement method = fac.createOMElement("echo", omNs); OMElement value = fac.createOMElement("Text", omNs); value.addChild(fac.createOMText(value, "Axis2 Echo String ")); method.addChild(value); OMElement result= client.sendReceive(method); try { XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out); result.serialize(writer); writer.flush(); } catch (XMLStreamException e) { e.printStackTrace(); } catch (FactoryConfigurationError e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } }

### error while running the client program

When I run the client program Client.java I am getting below error on the client side? Any thoughts? Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: Unexpected subelement return at org.apache.ws.axis2.SimpleServiceStub.fromOM(SimpleServiceStub.java:826) at org.apache.ws.axis2.SimpleServiceStub.echo(SimpleServiceStub.java:146) at org.apache.ws.axis2.Client.main(Client.java:16) Caused by: java.lang.RuntimeException: Unexpected subelement return at org.apache.ws.axis2.SimpleServiceStub$EchoResponse$Factory.parse(SimpleServiceStub.java:758) at org.apache.ws.axis2.SimpleServiceStub.fromOM(SimpleServiceStub.java:818) ... 2 more

### Problem in Client.java

hi, I had troubles in step 5 so instead, i used eclipse to generate the codes. Eclipse was able to generate SimpleServiceStub. My problem is within the lines: SimpleServiceStub.Echo request = new SimpleServiceStub.Echo(); -- in Client.java. is Echo supposed to be a class? where do i get it? i already ran into several tutorials for web services. Axis1 was easy, but its been 2 weeks and i still cant run a complete client-server in axis2. I'm still a long way from implementing ws-policy... i would very much appriciate if someone points me to the right path. thanks, Ayessa

### Re: Problem in Client.java

Hi, Echo is an inner class of SimpleServiceStub class. Are you using Axis2-1.0 or the latest nightly build? With Axis2 1.0 there's a known issue where these inner classes are not generated since the generated wsdl at the service is wrong. Can you please try with the latest nightly build available here : http://people.apache.org/dist/axis2/nightly/axis2-std-SNAPSHOT-bin.zip Thanks, Ruchith

### Auto Generated SimpleServiceStub.java Missing EchoResponse Class

Dear Ruchith, I have been playing with the July 23rd Nightly Build of Axis2 and noticed that the automatically generated SimpleServiceStub.java does not contain an EchoResponse (static) class - as does the one provided in the hw-axis2/SimpleClient directory tree - thereby resulting in errors while compiling Client.java. Please let me know how I may be of assistance. Regards, Michael Larkin email: mlarkin@e2e.us

### Problem Persists in Nightly Build

Hi, Ruchith! Please be aware that the nightly build (located at http://people.apache.org/dist/axis2/nightly/axis2-std-SNAPSHOT-bin.zip) may still have a problem. WSDL2Java continues to complain: Client.java:3: cannot find symbol symbol : class EchoResponse location: class org.apache.axis2.SimpleServiceStub import org.apache.axis2.SimpleServiceStub.EchoResponse; ^ Client.java:12: cannot find symbol symbol : class Echo location: class org.apache.axis2.SimpleServiceStub SimpleServiceStub.Echo request = new SimpleServiceStub.Echo(); ^ Client.java:12: cannot find symbol symbol : class Echo location: class org.apache.axis2.SimpleServiceStub SimpleServiceStub.Echo request = new SimpleServiceStub.Echo(); ^ Client.java:16: cannot find symbol symbol : class EchoResponse location: class org.apache.axis2.Client EchoResponse response = stub.echo(request); ^ Note: SimpleServiceStub.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 4 errors The WSDL2Java command I issued was: sh WSDL2Java.sh -uri http://localhost:8080/axis2/services/SimpleService?wsdl -o /home/michael/us/e2e/SimpleService/release/ The procedure I used to "install" the Axis2 nightly build was to copy the new directories and files over the old ones. Perhaps I have made an error? Please advise. Thanks! (By the way, your example is excellent!!!) Regards, Michael Larkin

### same problem

hey, I am facing exactly the same problem since 2days and still haven't quite figured out how to write a client to access the services runnning. Can you pls let me know if you have figured out the solution? Thanks, Deepak

### Problem in running the client

Hi! I downlaoded the axis2-1.1-SNAPSHOT.zip for running the client but continue to face compilation problem. The inner class EchoResponse is not generated in Stub class. I have included all the jars in the classpath but the problem persists. Please help. Thanks, Pallavi

### Re: Problem in Client.java

hi Ruchith, thank you for your response. I'll do as advised. thanks again! -ayessa

### How to get call service through web browser

hi Ruchith, I followed your advise to use the nightly build and was able to make the sample run after a few classpath adjustments. I was successfully able to call the service through the client and made another service of my own (congratulations to me =D ). The eclipse plug-in kept me stuck for 2 weeks. It seemed to generate a faulty aar. I ditched the plugin and followed your example instead. I was wondering if you happen to know how to call the service through a web browser. I was able to do that through axis 1, hoping i can do the same with axis 2. thanks, ayessa

### Re: How to get call service through web browser

This is actually possible in WSO2 Tungsten 1.0 and there are a set of public instances hosted here. You can read this guide to understand how to use the hosted instances and to invoke a service using the browser.

### hi,

hi, what i mean is, in axis 1, i can simply call my webservice via browser by posting http://localhost:8080/axis/services/MyService?method=someMethod and it will return a soap response. How do i do this in axis 2? I tried replacing axis with axis2 in the url... unfortunately, it didnt work hope you can help me out thanks, Ayessa

### axis 2 error: incoming message does not contain security header

Hi ruchith, I have created a web-service system in netbeans which retrieves financial information from a database and then displays it when invoked by a client a application which i have created in microsoft visual studio 2008. The client application is a very simple button layout, so each button corresponds to a different method. However when i compile and try to run it i get the error message: Client found response content type of 'multipart/related; boundary=MIMEBoundaryurn_uuid_6A4D9BBB53FB213A311240595896815; type="application/xop+xml"; start="0.urn:uuid:6A4D9BBB53FB213A311240595896816@apache.org"; start-info="text/xml"', but expected 'text/xml'. The request failed with the error message: -- --MIMEBoundaryurn_uuid_6A4D9BBB53FB213A311240595896815 Content-Type: application/xop+xml; charset=utf-8; type="text/xml" Content-Transfer-Encoding: binary Content-ID: <0.urn:uuid:6A4D9BBB53FB213A311240595896816@apache.org> <?xml version='1.0' encoding='utf-8'?>soapenv:ServerWSDoAllReceiver: Incoming message does not contain required Security header any ideas on how can i resolve this? thanks very much Ian

### Service with Parameter

Hi, i know this is already beyond the hello world sample but may i ask how to implement a service which asks for a parameter then returns a value. Lets say i have a function public String getAlias(String firstName)... how do i go about in services.xml?... how do i call it through rest? any response would be appreciated =) thanks - ayessa

### wsdl parser error

Hello, I am using the tomcat axis server. I am stuck on step 5. After executing WSDL2Java.bat script, I have this specific error :"The entity "nbsp" was referenced, but not declared". Details stack trace is below. Thanks in advance for help. Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException : Error parsing WSDL at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerat ionEngine.java:125) at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:32) at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:21) Caused by: WSDLException: faultCode=PARSER_ERROR: Parser SAX Error: Fatal Error: URI=http://localhost.urssaf.fr:8080/axis2/services/ Line=32: The entity "nbsp" was referenced, but not declared.: org.xml.sax.SAXException: Fatal Error: URI=ht tp://localhost.urssaf.fr:8080/axis2/services/ Line=32: The entity "nbsp" was ref erenced, but not declared. at org.apache.axis2.util.XMLUtils$ParserErrorHandler.fatalError(XMLUtils .java:361) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalErro r(ErrorHandlerWrapper.java:218) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError( XMLErrorReporter.java:386) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError( XMLErrorReporter.java:316) at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(X MLScanner.java:1438) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp l.scanEntityReference(XMLDocumentFragmentScannerImpl.java:1332) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp l$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1756) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp l.scanDocument(XMLDocumentFragmentScannerImpl.java:368) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(X ML11Configuration.java:834) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(X ML11Configuration.java:764) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser. java:148) at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser. java:250) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Doc umentBuilderImpl.java:292) at org.apache.axis2.util.XMLUtils.newDocument(XMLUtils.java:178) at org.apache.axis2.util.XMLUtils.newDocument(XMLUtils.java:223) at org.apache.axis2.util.XMLUtils.newDocument(XMLUtils.java:206) at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.readInTheWSDLFile( CodeGenerationEngine.java:274) at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerat ionEngine.java:108) at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:32) at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:21) at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.readInTheWSDLFile( CodeGenerationEngine.java:280) at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerat ionEngine.java:108) ... 2 more

### that's prolly happening cos

that's prolly happening cos you're not poting to the WS url. I'd say that you're pointing to it's parent folder. Perhaps a whitespace that shouldn't be there... hth. wbr, tom

### now getting a ClassNotFoundException

Now I get a ClassNotFoundException on step 5: C:\axis2\bin>WSDL2Java.bat -uri http://localhost:8080/axis2/services/SimpleServi ce?wsdl -o C:\WebServices\tutorial\ClientCode Using AXIS2_HOME: C:\axis2 Using JAVA_HOME: C:\bea\jdk141_05 Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException : java.lang.RuntimeException: java.lang.ClassNotFoundException: org.apache.axis2 .schema.ExtensionUtility at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGener ationEngine.java:235) at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:32) at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:21) Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.apa che.axis2.schema.ExtensionUtility at org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension.engage(Simp leDBExtension.java:52) at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGener ationEngine.java:188) ... 2 more Caused by: java.lang.ClassNotFoundException: org.apache.axis2.schema.ExtensionUt ility at java.net.URLClassLoader$1.run(URLClassLoader.java:198) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:186) at java.lang.ClassLoader.loadClass(ClassLoader.java:299) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:272) at java.lang.ClassLoader.loadClass(ClassLoader.java:255) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:140) at org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension.engage(Simp leDBExtension.java:44) ... 3 more C:\axis2\bin>

### probably a classpath error!

This seems to be a classpath problem. Do you have the adb-codegen module (compiled version would be adb-codegen-xxxx.jar) in the classpath ? If not please do a source build and make sure that the adb-codegen jar is in the classpath.

### ClassNotFoundException : ExtensionUtility

I have the same problem. The inner class org.apache.axis2.SimpleServiceStub.EchoResponse does not get generated. Then I downloaded the latest nightly build, But still it complains of this missing class. When I tried building from the source as instructed, build failed giving following errors. Attempting to download axis2-common-SNAPSHOT.jar. Error retrieving artifact from [http://cvs.apache.org/repository/axis2/jars/axis 2-common-SNAPSHOT.jar]: java.io.IOException: Unknown error downloading; status code was: 302 Error retrieving artifact from [http://www.openejb.org/maven/axis2/jars/axis2-co re-SNAPSHOT.jar]: java.io.IOException: Unknown error downloading; status code was: 302

### getting a 'DeploymentException'

I'm getting a 'DeploymentException' on Step 4, using WLS8.1: Jun 19, 2006 2:01:21 PM org.apache.axis2.deployment.DeploymentEngine doDeploy SEVERE: Invalid service SimpleService.aar due to services.xml not found for service 'c:\my-axis2-repo\services\SimpleService.aar'; nested exception is: org.apache.axis2.deployment.DeploymentException: services.xml not found

### Re: getting a 'DeploymentException'

Please make sure you include the services.xml file in the META-INF directory in your SimpleService.aar file