Hi everybody,
I wrote a basic web service:  
  public String test (String t) {
    return (t);
  }

when deployed, I have access to it easily throught my broser: 
  http://localhost:8080/axis2/services/Test/test?t=I love axis

But when writing a java client:
      public static void main(String[] args) throws Exception {
        ServiceClient client = new ServiceClient();
        // create option object
        Options opts = new Options();
        //setting target EPR
        opts.setTo(new
EndpointReference("http://localhost:8080/axis2/services/Test/test";));
        //Setting action ,and which can be found from the wsdl of the
service
        opts.setAction("urn:test");
        client.setOptions(opts);
        OMElement res = client.sendReceive(createPayLoad());
        System.out.println(res);

    }

    public static OMElement createPayLoad() {
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac.createOMNamespace("http://axis.org";, "ns1");
        OMElement method = fac.createOMElement("test", omNs);
        OMElement value = fac.createOMElement("t", omNs);
        value.setText("I Love Axis");
        method.addChild(value);
        return method;
    }

This is not working !!!  and I get the following error:
Exception in thread "main" org.apache.axis2.AxisFault: Exception occurred
while trying to invoke service method test
        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
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:520)
        at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:500)
        at TestClient.main(TestClient.java:20)

But if I implement a webService without any parameter (what I don't want):
  public String test () {
    return ("I love axis");
  }

This is working fine !!!!
I know I got that working before ... and have no idea what I did since last
time !! I just deleted my axis2 folder by mistake, but I added all the
library I need (and I actully don't need any here !!!) so it should work

do u have any idea ???
thx

-- 
View this message in context: 
http://www.nabble.com/problem-when-axessing-a-method-tf4611296.html#a13168731
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to