mian方法
启动main方法报错的话就需要修改一下下面的配置文件,因为里面定义了返回的类型document,其实服务端返回的是String
在WEB-INF下有一个server-config.wsdd文件,找到相应的服务,把style="document"删掉package example; import org.apache.axis.client.Call; import org.apache.axis.client.Service; import org.apache.axis.encoding.XMLType; import javax.xml.namespace.QName; public class HelloWorldClient { public static void main(String[] argv) { Service service = new Service(); String url = "http://localhost:8080/fight/services/HelloWorld?wsdl"; try { Call call = (Call)service.createCall(); call.setTargetEndpointAddress(new java.net.URL(url)); call.setOperationName(new QName("http://example","sayHelloWorldFrom")); call.addParameter(new QName("from"),org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN); call.setUseSOAPAction(true); //call.setReturnType(XMLType.SOAP_DOCUMENT); String result = (String)call.invoke(new Object[]{"Tom"}); System.out.println(result); } catch (Exception e) { e.printStackTrace(); } } }