You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Armaz Mellati <ar...@uninett.no> on 2007/07/18 10:58:48 UTC

Calling the sample webservices from AXIS block

Hello everybody

I am investigating how to use cocoon as a webservice-server. But I can't 
find out how to use(call) the webservices in Axis block samples. There 
is only one example there and that is using Perl !!!
Can someone PLEASE post a simple Axis client code that works with those 
examples services ? The problem is how to spesify the servicename. This 
is what I have, but doesn't work. It gives me : "The AXIS engine could 
not find a target service to invoke!  targetService is null"


   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:8888/samples/blocks/axis/rpcrouter/Version";
             
        Service  service = new Service();
        Call     call    = (Call) service.createCall();
 
        call.setTargetEndpointAddress( new java.net.URL(endpoint) );
        call.setOperationName("getVersion");
 
        String ret = (String) call.invoke( new Object[] { "Hello!" } );
 
        System.out.println( ret );
      } catch (Exception e) {
        System.err.println(e.toString());
      }
    }
  }



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Calling the sample webservices from AXIS block [SOLVED]

Posted by Armaz Mellati <ar...@uninett.no>.
The answer was to use QName in calling the OperationName like this :
    call.setOperationName(new QName("Version","getVersion"));
The endpoint will then be just :
    http://localhost:8888/samples/blocks/axis/rpcrouter

I am not sure how standard that is, or how a WSDL based client will 
react to that. That I am going to find out.

I have also found this, another way of setting up webservices in cocoon 
which is brilliant. But it seems too easy ?!!!
http://wiki.apache.org/cocoon/WebServiceServer

Regards,
Armaz

Armaz Mellati wrote:
> Hello everybody
>
> I am investigating how to use cocoon as a webservice-server. But I 
> can't find out how to use(call) the webservices in Axis block samples. 
> There is only one example there and that is using Perl !!!
> Can someone PLEASE post a simple Axis client code that works with 
> those examples services ? The problem is how to spesify the 
> servicename. This is what I have, but doesn't work. It gives me : "The 
> AXIS engine could not find a target service to invoke!  targetService 
> is null"
>
>
>   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:8888/samples/blocks/axis/rpcrouter/Version";
>                    Service  service = new Service();
>        Call     call    = (Call) service.createCall();
>
>        call.setTargetEndpointAddress( new java.net.URL(endpoint) );
>        call.setOperationName("getVersion");
>
>        String ret = (String) call.invoke( new Object[] { "Hello!" } );
>
>        System.out.println( ret );
>      } catch (Exception e) {
>        System.err.println(e.toString());
>      }
>    }
>  }
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org