百度一下,简单的例子多的是.

解决方案 »

  1.   

    public static String webService(String url , String ser_name , String param)
    {
    String rtn = "";
    try
    {
            String endpoint = url;//指明服务所在位置
    Service service = new Service(); //创建一个Service实例,注意是必须的!
    Call call = (Call) service.createCall();//创建Call实例,也是必须的!
    call.setTargetEndpointAddress( new java.net.URL(endpoint) );//为Call设置服务的位置
    call.setOperationName( ser_name );//注意方法名与HelloWorld.java中一样!!
    rtn = (String) call.invoke( new Object[] {param} );//返回String,没有传入参数
    }
    catch(Exception e)
    {
    throw new Exception(e);
    }
    return rtn;
    }
    通过main函数调用是可以正常运行的,但是通过struts调用,在new Service()的时候报  can't declare any more prefixes in this context  高手请指点