tags:

views:

687

answers:

1

Hi I have axis in webapp and I can access http://localhost:8080/oop/services/test2?wsdl correctly. I wrote client:


  import org.apache.axis.client.Call;
   import org.apache.axis.client.Service;
   import javax.xml.namespace.QName;

   public class TestClient {
     public static void main(String [] args) {
       try {
         String endpoint =
             "http://localhost:8080/oop/servlet/AxisServlet/services/test2";

        Service  service = new Service();
        Call     call    = (Call) service.createCall();

        call.setTargetEndpointAddress( new java.net.URL(endpoint) );
        call.setOperationName(new QName("http://ws.oopf.com/testclient", "fce"));

        String ret = (String) call.invoke( new Object[] { "Hello!" } );

        System.out.println("Sent 'Hello!', got '" + ret + "'");
      } catch (Exception e) {
        System.err.println(e.toString());
      }
    }
  }


I receive 
AxisFault
 faultCode: {http://xml.apache.org/axis/}HTTP
 faultSubcode: 
 faultString: (404)/WEB-INF/tiles/commons/404.jsp
 faultActor: 
 faultNode: 
 faultDetail: 
    {}:return code:  404

    {http://xml.apache.org/axis/}HttpErrorCode:404

(404)/WEB-INF/tiles/commons/404.jsp
    at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:744)
    at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)
    at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
    at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
    at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
    at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
    at org.apache.axis.client.Call.invoke(Call.java:2767)
    at org.apache.axis.client.Call.invoke(Call.java:2443)
    at org.apache.axis.client.Call.invoke(Call.java:2366)
    at org.apache.axis.client.Call.invoke(Call.java:1812)
    at TestClient.main(TestClient.java:19)
(404)/WEB-INF/tiles/commons/404.jsp

What is wrong? thanks

A: 

Your endpount URL is wrong?

http://localhost:8080/oopfwsDB/services/test2 - works http://localhost:8080/oop/servlet/AxisServlet/services/test2 - not

kd304
I'm sorry, I mixed the correct url is http://localhost:8080/oop/servlet/AxisServlet/services/test2 and it doesn't work
Try invoking your service as a REST, e.g. put a request parameter into the URL http://localhost:8080/oop/servlet/AxisServlet/services/test2?param=Hello What does the 404.jsp say? The operation name might be wrong too. What is the wsdl?
kd304
http://localhost:8080/oop/servlet/AxisServlet/services/test2?param=Hello returns:test2Hi there, this is an AXIS service! Perhaps there will be a form for invoking the service here... wsdl I need to send somehow..I couldn't get it formated properly
<wsdl:definitions targetNamespace="http://ws.oop.com/testclient">-<!--WSDL created by Apache Axis version: 1.4Built on Apr 22, 2006 (06:55:48 PDT)-->-<wsdl:message name="fceResponse"><wsdl:part name="fceReturn" type="xsd:string"/></wsdl:message>-<wsdl:message name="fceRequest"><wsdl:part name="struct" type="xsd:string"/></wsdl:message>-<wsdl:portType name="Test2">-<wsdl:operation name="fce" parameterOrder="struct"><wsdl:input message="impl:fceRequest" name="fceRequest"/><wsdl:output message="impl:fceResponse" name="fceResponse"/></wsdl:operation></wsdl:portType>-
-<wsdl:binding name="test2SoapBinding" type="impl:Test2"><wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>-<wsdl:operation name="fce"><wsdlsoap:operation soapAction=""/>-<wsdl:input name="fceRequest"><wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://ws.oop.com/testclient" use="encoded"/></wsdl:input>-<wsdl:output name="fceResponse"><wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://ws.oop.com/testclient" use="encoded"/></wsdl:output></wsdl:operation>
</wsdl:binding>-<wsdl:service name="Test2Service">-<wsdl:port binding="impl:test2SoapBinding" name="test2"><wsdlsoap:address location="http://localhost:8080/oop/services/test2"/></wsdl:port></wsdl:service></wsdl:definitions>
Two things come into my mind: the namespace is ws.oop.com/testclient, without http:// or that the service address is localhost:8080/oop/services/test2, witout servlet/AxisServlet
kd304
Hey great !! you are right without servlet/AxisServlet it works. thank you very much for help