wsimport使用实例

这段时间工作上遇到了webservice方面的开发


在command下输入

F:\test>wsimport -keep -p com.wsclient [url=http://webservice.webxml.com.cn/WebServic]http://webservice.webxml.com.cn/WebServic[/url]
es/MobileCodeWS.asmx?WSDL


会自动在F:\test下生成一些类,自动生成的会有报错,可以自己改下


以下是简单的java代码调用:



package test;

import java.util.List;

import com.wsclient.ArrayOfString;
import com.wsclient.MobileCodeWS;
import com.wsclient.MobileCodeWSSoap;

public class Test {
public static void main(String[] args) {
MobileCodeWS mcws = new MobileCodeWS();
MobileCodeWSSoap mcwss = mcws.getMobileCodeWSSoap();
ArrayOfString aos = mcwss.getDatabaseInfo();
List list = aos.getString();
for(String str : list){
System.out.println(str);
}
String location = mcwss.getMobileCodeInfo("1583510", "");
System.out.println(location);
}
}

你可能感兴趣的:(javaWeb)