WebService java客户端调用

xiaoxiao2026-09-02  8

客户端调用 需要axis的jar包 package db; import javax.xml.rpc.ServiceException; import org.apache.axis.client.Call; import org.apache.axis.client.Service; public class TestWebService { public static void main(String[] args) throws Exception { String msg = "" ; try{ String endpoint = "你设置的Service服务端地址"; Service service = new Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress(new java.net.URL(endpoint)); //设置远程方法 call.setOperationName("login"); //如果远程方法需要接受参数.则上面的写法为:(String)call.invoke(new Object[]{参数1,参数2,..}); //如果远程方法不需要接受参数,则写为:(String)call.invoke(new Object[]{}); } catch(Exception ex) { ex.printStackTrace(); } } } 相关资源:Java客户端调用.NET的WebService实例
转载请注明原文地址: https://www.6miu.com/read-5052316.html

最新回复(0)