网上看了很多不能用,发送别人接收不到参数,这个就可以,不多说,直接看代码 String url = "http://access.xx95.net:8886/Connect_Service.asmx"; try { Service service = new Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress(new java.net.URL(url)); call.setUseSOAPAction(true); call.setSOAPActionURI("http://access.xx95.net:8886/SendSms");//namespace+method call.setOperationName(new QName("http://access.xx95.net:8886/", "SendSms")); call.addParameter(new QName("http://access.xx95.net:8886/","epid"), XMLType.XSD_STRING, ParameterMode.IN);//参数名,参数类型 call.addParameter(new QName("http://access.xx95.net:8886/","User_Name"), XMLType.XSD_STRING, ParameterMode.IN);//参数名,参数类型 call.addParameter(new QName("http://access.xx95.net:8886/","password"), XMLType.XSD_STRING, ParameterMode.IN);//参数名,参数类型 call.addParameter(new QName("http://access.xx95.net:8886/","phone"), XMLType.XSD_STRING, ParameterMode.IN);//参数名,参数类型 call.addParameter(new QName("http://access.xx95.net:8886/","content"), XMLType.XSD_STRING, ParameterMode.IN);//参数名,参数类型 call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING); // 设置传入的参数的值 String m = (String)call.invoke(new Object[]{"AHHF1311318","admin","9272ad55c8dc27b6","18856055164","1"}); System.out.println(m); } catch (Exception e) { e.printStackTrace(); }
axis调用webservice
最新推荐文章于 2022-12-08 17:15:41 发布