java技术调用xfire webService服务客户端代码
import类:
import java.net.MalformedURLException;
import java.net.URL;
import org.codehaus.xfire.client.Client;
public String xfireInvokenClient(String wsdURl, String methodName,
Object[] paramsValue) {
Client client;
try {
client = new Client(new URL(wsdURl));
if (client != null) {
client.setTimeout(0);
Object[] reponseDoc = client.invoke(methodName, paramsValue);
if (reponseDoc != null) {
String message = reponseDoc[0].toString();
System.out.println("返回的结果是:+\n" + message);
}
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return "";
}
axisClient.xfireInvokenClient("http://localhost:8086/mims/services/sourceWs?wsdl",
"get_Province", new String[] {"test", "test" });