I used your advice and I'm still getting "operation not found" . I'm not sure
about WEB-INF/axis2.xml - do I need to make changes there ? However, I'm
pretty sure my error is due to the client. Might someone be able to give my
client code a look?
public static void main(String[] args) {
try {
System.out.println("webLogin, firing...");
SWAAutoDispatchEndpointStub stub =
new SWAAutoDispatchEndpointStub(null,
"http://localhost:8080/axis2/services/SWAAutoDispatchEndpoint");
WebLoginElementDocument webLoginElementDocument
= WebLoginElementDocument.Factory.newInstance();
WebLoginElement webLoginElement =
WebLoginElement.Factory.newInstance();
webLoginElement.setUserNameElement("joe");
webLoginElement.setUserPasswordElement("sixpack");
webLoginElementDocument.setWebLoginElement(webLoginElement);
stub.webLogin(webLoginElementDocument);
} catch (AxisFault axisFault) {
axisFault.printStackTrace();
} catch (Exception ex) {
ex.printStackTrace();
}
}
The endpoint "http://localhost:8080/axis2/services/SWAAutoDispatchEndpoint" is
what shows correctly on the happy axis page.
My aar file is:
SWAAutoDispatchEndpoint.aar
My services.xml file is:
<!--Auto generated Axis Service XML-->
<service name="SWAAutoDispatchEndpoint">
<parameter name="ServiceClass"
locked="false">com.siemens.swa.plugins.webservices.types.SWAAutoDispatchEndpointSkeleton</parameter>
<!--Mounting the method webLogin-->
<operation name="webLogin">
<messageReceiver
class="com.siemens.swa.plugins.webservices.types.SWAAutoDispatchEndpointMessageReceiver"/>
</operation>
</service>
WSDL file is:
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="SWAAutoDispatchService"
targetNamespace="http://swaAutoDispatch" xmlns:tns="http://swaAutoDispatch"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:ns2="http://swaAutoDispatch/types">
<types>
<schema targetNamespace="http://swaAutoDispatch/types"
xmlns:tns="http://swaAutoDispatch/types"
xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="ReturnWebBase">
<sequence>
<element name="errorMessage" type="string"/>
<element name="successErrorCode"
type="int"/></sequence></complexType>
<complexType name="ReturnWebLogin">
<complexContent>
<extension base="tns:ReturnWebBase">
<sequence>
<element name="SOAP_Session_id" type="string"/>
<element name="web_user_name"
type="string"/></sequence></extension></complexContent></complexType>
<element name="webLoginElement">
<complexType>
<sequence>
<element ref="tns:user_nameElement"/>
<element ref="tns:user_passwordElement"/>
</sequence>
</complexType>
</element>
<element name="user_nameElement" type="xsd:string"/>
<element name="user_passwordElement" type="xsd:string"/>
<element name="ReturnWebLoginElement" type="ns2:ReturnWebLogin"/>
<element name="ReturnWebBaseElement" type="ns2:ReturnWebBase"/>
</schema></types>
<message name="SWAAutoDispatchEndpoint_webLogin">
<part name="parameters" element="ns2:webLoginElement"/>
</message>
<message name="SWAAutoDispatchEndpoint_webLoginResponse">
<part name="result" element="ns2:ReturnWebLoginElement"/>
</message>
<portType name="SWAAutoDispatchEndpoint">
<operation name="webLogin">
<input message="tns:SWAAutoDispatchEndpoint_webLogin"
name="SWAAutoDispatchEndpoint_webLogin"/>
<output message="tns:SWAAutoDispatchEndpoint_webLoginResponse"
name="SWAAutoDispatchEndpoint_webLoginResponse"/>
</operation>
</portType>
<binding name="SWAAutoDispatchEndpointBinding"
type="tns:SWAAutoDispatchEndpoint">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document"/>
<operation name="webLogin">
<soap:operation soapAction=""/>
<input name="SWAAutoDispatchEndpoint_webLogin">
<soap:body use="literal"/>
</input>
<output name="SWAAutoDispatchEndpoint_webLoginResponse">
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="SWAAutoDispatchService">
<port name="SWAAutoDispatchEndpointPort"
binding="tns:SWAAutoDispatchEndpointBinding">
<soap:address
location="http://localhost:8080/axis2/services/SWAAutoDispatchEndpoint"/></port></service></definitions>
Cheers,
iksrazal
Em Terça 29 Novembro 2005 18:30, o Dong Liu escreveu:
> Hi,
>
> I guess the endpoint reference in your case should be the one in your
> services.xml, i.e.
> http://localhost:8080/axis2/services/SWAAutoDispatchEndpoint
>
> To ensure the service works, my practice is to name the .aar package
> the same as the service name in your services.xml and test the
> endpoint without putting wsdl file in the package. Actually, I suspect
> that axis 2 works independently with the wsdl's associated to
> services.
>
> Cheers,
>
> Don
>
> On 11/29/05, iksrazal <[EMAIL PROTECTED]> wrote:
> > I've got a similar problem and what you describe doesn't match the
> > services.xml file produced by WSDL2Java .
> >
> > This is my file produced by WSDL2Java :
> >
> > <!--Auto generated Axis Service XML-->
> > <service name="SWAAutoDispatchEndpoint">
> > <parameter name="ServiceClass"
> > locked="false">com.siemens.swa.plugins.webservices.types.SWAAutoDispatchE
> >ndpointSkeleton</parameter> <!--Mounting the method webLogin-->
> > <operation name="webLogin">
> > <messageReceiver
> > class="com.siemens.swa.plugins.webservices.types.SWAAutoDispatchEndpointM
> >essageReceiver"/> </operation>
> > </service>
> >
> > Here's my the relevant wsdl section, with full wsdl below:
> >
> > <service name="SWAAutoDispatchService">
> > <port name="SWAAutoDispatchEndpointPort"
> > binding="tns:SWAAutoDispatchEndpointBinding">
> > <soap:address
> > location="http://localhost:8080/axis2/services/SWAAutoDispatchEndpoint"/>
> ></port></service>
> >
> > Should I file a jira issue? This is confusing.
> >
> > Incidently, I'm seeing this EPR on the listServices.jsp - after making
> > the change to services.xml to be: 'service name="SWAAutoDispatchService'
> >
> > "Available services
> > SWAAutoDispatchService
> > Service EPR : http://localhost:8080/axis2/services/SWAAutoDispatchService
> > Service Description : null
> > Available operations
> >
> > * webLogin "
> >
> > Yet I'm getting:
> >
> > [java] webLogin, firing...
> > [java] org.apache.axis2.AxisFault: org.apache.axis2.AxisFault:
> > Operation Not found EPR is
> > http://localhost:8080/axis2/services/SWAAutoDispatchService and WSA
> > Action =
> > [java] at
> > org.apache.axis2.engine.DispatchingChecker.invoke(DispatchingChecker.java
> >:70)
> >
> > Here's my client code - I'm kind of stuck:
> >
> > package com.siemens.swa.plugins.clients;
> >
> > import org.apache.axis2.AxisFault;
> >
> > import
> > com.siemens.swa.plugins.webservices.types.SWAAutoDispatchEndpointStub;
> > import
> > com.siemens.swa.plugins.webservices.types.databinding.swaAutoDispatch.Web
> >LoginElementDocument; import
> > com.siemens.swa.plugins.webservices.types.databinding.swaAutoDispatch.Web
> >LoginElementDocument.WebLoginElement;
> >
> > /**
> > * Login.
> > *
> > */
> > public class WiseLogin {
> >
> > public static void main(String[] args) {
> > try {
> >
> > System.out.println("webLogin, firing...");
> > SWAAutoDispatchEndpointStub stub =
> > new SWAAutoDispatchEndpointStub(null,
> > "
> > http://localhost:8080/axis2/services/SWAAutoDispatchService");
> >
> > WebLoginElementDocument webLoginElementDocument
> > = WebLoginElementDocument.Factory.newInstance();
> > WebLoginElement webLoginElement =
> > WebLoginElement.Factory.newInstance();
> > webLoginElement.setUserNameElement("joe");
> > webLoginElement.setUserPasswordElement("sixpack");
> > webLoginElementDocument.setWebLoginElement(webLoginElement);
> > stub.webLogin(webLoginElementDocument);
> > System.out.println("dispatch, completed!!!");
> >
> > } catch (AxisFault axisFault) {
> > axisFault.printStackTrace();
> > } catch (Exception ex) {
> > ex.printStackTrace();
> > }
> > }
> >
> > }
> >
> > iksrazal
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> >
> > <definitions name="SWAAutoDispatchService"
> > targetNamespace="http://swaAutoDispatch"
> > xmlns:tns="http://swaAutoDispatch"
> > xmlns="http://schemas.xmlsoap.org/wsdl/"
> > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> > xmlns:ns2="http://swaAutoDispatch/types">
> > <types>
> > <schema targetNamespace="http://swaAutoDispatch/types"
> > xmlns:tns="http://swaAutoDispatch/types"
> > xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> > xmlns="http://www.w3.org/2001/XMLSchema">
> > <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
> > <complexType name="ReturnWebBase">
> > <sequence>
> > <element name="errorMessage" type="string"/>
> > <element name="successErrorCode"
> > type="int"/></sequence></complexType>
> > <complexType name="ReturnWebLogin">
> > <complexContent>
> > <extension base="tns:ReturnWebBase">
> > <sequence>
> > <element name="SOAP_Session_id" type="string"/>
> > <element name="web_user_name"
> > type="string"/></sequence></extension></complexContent></complexType>
> > <element name="webLoginElement">
> > <complexType>
> > <sequence>
> > <element ref="tns:user_nameElement"/>
> > <element ref="tns:user_passwordElement"/>
> > </sequence>
> > </complexType>
> > </element>
> > <element name="user_nameElement" type="xsd:string"/>
> > <element name="user_passwordElement" type="xsd:string"/>
> > <element name="ReturnWebLoginElement" type="ns2:ReturnWebLogin"/>
> > <element name="ReturnWebBaseElement" type="ns2:ReturnWebBase"/>
> > </schema></types>
> > <message name="SWAAutoDispatchEndpoint_webLogin">
> > <part name="parameters" element="ns2:webLoginElement"/>
> > </message>
> > <message name="SWAAutoDispatchEndpoint_webLoginResponse">
> > <part name="result" element="ns2:ReturnWebLoginElement"/>
> > </message>
> > <portType name="SWAAutoDispatchEndpoint">
> > <operation name="webLogin">
> > <input message="tns:SWAAutoDispatchEndpoint_webLogin"
> > name="SWAAutoDispatchEndpoint_webLogin"/>
> > <output message="tns:SWAAutoDispatchEndpoint_webLoginResponse"
> > name="SWAAutoDispatchEndpoint_webLoginResponse"/>
> > </operation>
> > </portType>
> > <binding name="SWAAutoDispatchEndpointBinding"
> > type="tns:SWAAutoDispatchEndpoint">
> > <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
> > style="document"/>
> > <operation name="webLogin">
> > <soap:operation soapAction=""/>
> > <input name="SWAAutoDispatchEndpoint_webLogin">
> > <soap:body use="literal"/>
> > </input>
> > <output name="SWAAutoDispatchEndpoint_webLoginResponse">
> > <soap:body use="literal"/>
> > </output>
> > </operation>
> > </binding>
> > <service name="SWAAutoDispatchService">
> > <port name="SWAAutoDispatchEndpointPort"
> > binding="tns:SWAAutoDispatchEndpointBinding">
> > <soap:address
> > location="http://localhost:8080/axis2/services/SWAAutoDispatchEndpoint"/>
> ></port></service></definitions>
> >
> > Em Terça 29 Novembro 2005 01:57, o Deepal Jayasinghe escreveu:
> > > Hi Dong;
> > >
> > > I will tell you what actually happen inside
> > >
> > > 1. If the service archive file contains a services.xml with its root
> > > tag being <serviceGroup></serviceGroup> , then the name of the
> > > service group will be the name of the archive file name (if the archive
> > > name foo.aar then the group name will be foo).
> > >
> > > 2. If the services.xml is for a service group , then all the children
> > > service elements must have a name , simply in <service
> > > name="someName"> tag the name attribute can not be null , as well as
> > > that should be unique across the system
> > >
> > > 3. If the service archive file contains a service.xml with root
> > > element being <service> </service> then the name of the service will be
> > > the name of the archive file , even if there is a name attribute that
> > > will be ignored.
> > >
> > > 4. IF you have a WSDL file for a service then that wsdl file should
> > > contain a <service> element and then name of the service element should
> > > equal to the name of the service that refers , as an example if you
> > > have a <service name="fooService"> in services.xml then there should be
> > > service element in wsdl file as follow
> > > <wsdl:service name="fooService">
> > > <wsdl:port binding="impl:fooServiceBinding" name="fooService">
> > > <wsdlsoap:address
> > > location="http://localhost:8080/axis/services/fooService" />
> > > </wsdl:port>
> > > </wsdl:service>
> > >
> > > 5. It should note that the name of the wsdl file really does not matter
> > > if you have the right service element in the wsdl file , if your
> > > archive file is for a service group you can put any number of wsdl
> > > files in META-INF directory with right references.
> > >
> > >
> > >
> > > Thanks,
> > > Deepal
> > > ................................................................
> > > ~Future is Open~
> > >
> > > ----- Original Message -----
> > > From: "Dong Liu" <[EMAIL PROTECTED]>
> > > To: <[email protected]>
> > > Sent: Tuesday, November 29, 2005 6:17 AM
> > > Subject: [axis2]Questions on service name
> > >
> > >
> > > Hi, developers,
> > >
> > > On axis 2, three files are related to a service: the services.xml, the
> > > .wsdl file, and the deployment package .aar file. I found there would
> > > be multiple services appearing on the listServices page if the name of
> > > the .aar package, the service name in wsdl file and that in
> > > services.xml are different. And there would be conflicting endpoint
> > > references for the same service. Is naming the service names in the
> > > three places the only way to avoid such conflict?
> > >
> > > Cheers,
> > >
> > > Don