package com.smtic.travel.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import javax.xml.rpc.encoding.XMLType;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class PassengerFlowClient implements IWebServiceClient {
private Log log = LogFactory.getLog(this.getClass());
private String url = "http://localhost/rt/Service.asmx";
private String user = "fwpt";
private String password = "fwpt";
private String strResult = "世博入口客流";
public String getData() {
String result = "<?xml version=\"1.0\" encoding=\"gbk\"?>";
Service service = new Service();
Call call = null;
try {
String ns = "http://tempuri.org/";
call = (Call) service.createCall();
call.setTargetEndpointAddress(new URL(url));
call.setOperationName(new QName(ns, "GetTrafficData"));
call.addParameter(new QName(ns, "strCustomID"), XMLType.XSD_STRING,
ParameterMode.IN);
call.addParameter(new QName(ns, "strPassword"), XMLType.XSD_STRING,
ParameterMode.IN);
call.addParameter(new QName(ns, "strResult"), XMLType.XSD_STRING,
ParameterMode.IN);
call.setUseSOAPAction(true);
call.setReturnType(XMLType.XSD_STRING);
call.setSOAPActionURI("http://tempuri.org/GetTrafficData");
result += (String) call.invoke(new Object[] { user, password,
strResult });
} catch (Exception e) {
log.error(e.getMessage());
e.printStackTrace();
}
return result;
}
}