Hi, I am new in the web service world and I am developing a simple web service using Axis2, Eclipse, and the Axis2 Eclipse Plugin. I have a simple Pojo of type Employee with getters and setters, and a service class called EmployeeService that has only one method. The method has the following signature: List<Person> getEmployees(String UserPrivilege, String username, String password). Its implementation connects to a database and retrieves that the necessary data to build and return a java.util.ArrayList of Employee objects.
Using the Eclipse Plugin and following the tutorial on http://wso2.org/library/1719, I generated a web service that exposes the class EmployeeService's getEmployees(String, String, String) method. I also wrote a client class called Main.java to test the service. However, when I run the client, I get the following error: org.apache.axis2.AxisFault: The service cannot be found for the endpoint reference (EPR) http://localhost:8080/axis2/services/EmployeeService at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:434) at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:373) at org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:294) at com.myCompany.service.EmployeeServiceSOAP11PortStub.getEmployees(EmployeeServiceSOAP11PortStub.java:151) at com.myCompany.client.Main.main(Main.java:34) --------------------------------------------------------------------- Line 34 of Main.java has the following statement: EmployeeServiceSOAP11PortStub.GetEmployeesResponse getEmployeesResponse = stub.getEmployees(getEmployees); --------------------------------------------------------------------- The core client code is below. try{ stub = new EmployeeServiceSOAP11PortStub("http://localhost:8080/axis2/services/EmployeeService"); EmployeeServiceSOAP11PortStub.GetEmployees getEmployees = new EmployeeServiceSOAP11PortStub.GetEmployees(); EmployeeServiceSOAP11PortStub.GetEmployeesResponse getEmployeesResponse = stub.getEmployees(getEmployees); OMElement omelement = getEmployeesResponse.get_return(); System.out.println(omelement.toStringWithConsume()); }catch(AxisFault e){ e.printStackTrace(); }catch(RemoteException e){ e.printStackTrace(); }catch(XMLStreamException e){ e.printStackTrace(); } Thank you in advance for your comments or suggestions. I am also placing the WSDL file below. ------------------------------------ <wsdl:definitions xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:xsd="http://service.myCompany.com/xsd" xmlns:ns="http://service.myCompany.com" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://service.myCompany.com"> <wsdl:types> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://service.myCompany.com/xsd"> <xs:element name="getEmployees"> <xs:complexType> <xs:sequence> <xs:element name="userPrivilege" nillable="true" type="xs:string" /> <xs:element name="username" nillable="true" type="xs:string" /> <xs:element name="password" nillable="true" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="getEmployeesResponse"> <xs:complexType> <xs:sequence> <xs:element name="return" nillable="true" type="xs:anyType" /> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> </wsdl:types> <wsdl:message name="getEmployeesMessage"> <wsdl:part name="part1" element="xsd:getEmployees" /> </wsdl:message> <wsdl:message name="getEmployeesResponseMessage"> <wsdl:part name="part1" element="xsd:getEmployeesResponse" /> </wsdl:message> <wsdl:portType name="EmployeeServicePortType"> <wsdl:operation name="getEmployees"> <wsdl:input xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" wsaw:Action="urn:getEmployees" message="ns:getEmployeesMessage" /> <wsdl:output xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" message="ns:getEmployeesResponseMessage" wsaw:Action="urn:getEmployees" /> </wsdl:operation> </wsdl:portType> <wsdl:binding name="EmployeeServiceSOAP11Binding" type="ns:EmployeeServicePortType"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> <wsdl:operation name="getEmployees"><soap:operation soapAction="urn:getEmployees" style="document" /> <wsdl:input><soap:body use="literal" /> </wsdl:input><wsdl:output><soap:body use="literal" /></wsdl:output></wsdl:operation> </wsdl:binding><wsdl:binding name="EmployeeServiceSOAP12Binding" type="ns:EmployeeServicePortType"> <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> <wsdl:operation name="getEmployees"><soap12:operation soapAction="urn:getEmployees" style="document" /> <wsdl:input><soap12:body use="literal" /></wsdl:input> <wsdl:output><soap12:body use="literal" /></wsdl:output> </wsdl:operation> </wsdl:binding><wsdl:service name="EmployeeService"> <wsdl:port name="EmployeeServiceSOAP11port" binding="ns:EmployeeServiceSOAP11Binding"> <soap:address location="http://localhost:8080/axis2/services/EmployeeService" /> </wsdl:port><wsdl:port name="EmployeeServiceSOAP12port" binding="ns:EmployeeServiceSOAP12Binding"> <soap12:address location="http://localhost:8080/axis2/services/EmployeeService" /> </wsdl:port></wsdl:service> </wsdl:definitions> --------------------------------- Shape Yahoo! in your own image. Join our Network Research Panel today!
