81,092
社区成员
发帖
与我相关
我的任务
分享
public class WetherReport {
public static void main(String[] args) {
Service service = new Service();
try {
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new URL("http://www.ayandy.com/Service.asmx?WSDL"));
call.setUseSOAPAction(true);
call.setSOAPActionURI("http://tempuri.org/getSupportProvince");
String [] weatherReport2 = (String[])call.invoke("getSupportProvince", new String[]{"all"});
System.out.println(weatherReport2);
} catch (ServiceException e) {
e.printStackTrace();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (AxisFault e) {
e.printStackTrace();
}
}
}
//Persion为回复帖子人
//count 为自己的回帖数目
int count = 0;
//其他人的回帖数目
int otherCount = 0;
//allReplys 里是全部回贴的人
List<Person> allReplys = new ArrayList<Person>();
for(int i=0;i<allReplys.size();i++) {
if(allReplys.get(i).getName().equals("我自己")) {
count ++;
}
}
if(allReplys.size()-count< 1) {
System.out.println("没人回我就自己顶!");
}else {
for(int i=0;i<allReplys.size();i++) {
if(!allReplys.get(i).getName().equals("我自己") ) {
System.out.println("谢谢啦!");
otherCount ++;
}
}
}
if(otherCount < 5) {
System.out.println("兄弟伙些!顶起啊! 都没大有人回!");
}
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import javax.xml.ws.soap.SOAPBinding;
public class WebServiceTest {
private static final QName SERVICE_NAME = new QName("http://tempuri.org/", "ServiceSoap");
private static final QName PORT_NAME = new QName("http://tempuri.org/", "ServiceSoapPort");
public static void main(String[] args) {
Service service = Service.create(SERVICE_NAME);
String endpointAddress = "http://www.ayandy.com/Service.asmx";
service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING, endpointAddress);
ServiceSoap hw = service.getPort(ServiceSoap.class);
ArrayOfString as = hw.getWeatherbyCityName("上海", TheDayFlagEnum.TODAY);
for(String str : as.getString()) {
System.out.println(str);
}
}
}