package com.yc.ycportal.cqkf.service;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.yc.ycportal.BaseConfig;
public class BaseWebService {
private String ServiceURL = "";
private String sendXML = "";
private String ServiceMethodName = "";
private static final Log logger = LogFactory.getLog("BaseWebService.class");
/**此类用来进行通讯V3获取返回的XML文件,在构造函数中传入Service的名称,方法名,和需要传入的XML格式字符串*/
public BaseWebService(String ServiceName,String sendXML,String ServiceMethodName){
this.setSendXML(sendXML);
this.setServiceMethodName(ServiceMethodName);
this.setServiceURL(ServiceName);
}
public Object sendService(){
try {
/** 生成一个Service新实例*/
Service service = new Service();
/** 通过service得到一个调用类*/
Call call =(Call) service.createCall();
/** 设置webservice服务地址*/
call.setTargetEndpointAddress( new java.net.URL(this.getServiceURL()) );
/** 设置webservice提供方法*/
call.setOperationName(this.getServiceMethodName());
/** 开始调用方法传送xml字符串*/
return call.invoke( new Object[]{this.getSendXML()} );
} catch (Exception e) {
logger.error("类:WebServiceCommonClient,方法:commonSend(),错误信息:"+e.getMessage());
return null;
}
}
public String getSendXML() {
return sendXML;
}
public void setSendXML(String sendXML) {
this.sendXML = sendXML;
}
public String getServiceMethodName() {
return ServiceMethodName;
}
public void setServiceMethodName(String serviceMethodName) {
this.ServiceMethodName = serviceMethodName;
}
public String getServiceURL() {
return ServiceURL;
}
public void setServiceURL(String ServiceName) {
this.ServiceURL = BaseConfig.getValue("webserviceURL")+"/"+ServiceName;
}
}
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.yc.ycportal.BaseConfig;
public class BaseWebService {
private String ServiceURL = "";
private String sendXML = "";
private String ServiceMethodName = "";
private static final Log logger = LogFactory.getLog("BaseWebService.class");
/**此类用来进行通讯V3获取返回的XML文件,在构造函数中传入Service的名称,方法名,和需要传入的XML格式字符串*/
public BaseWebService(String ServiceName,String sendXML,String ServiceMethodName){
this.setSendXML(sendXML);
this.setServiceMethodName(ServiceMethodName);
this.setServiceURL(ServiceName);
}
public Object sendService(){
try {
/** 生成一个Service新实例*/
Service service = new Service();
/** 通过service得到一个调用类*/
Call call =(Call) service.createCall();
/** 设置webservice服务地址*/
call.setTargetEndpointAddress( new java.net.URL(this.getServiceURL()) );
/** 设置webservice提供方法*/
call.setOperationName(this.getServiceMethodName());
/** 开始调用方法传送xml字符串*/
return call.invoke( new Object[]{this.getSendXML()} );
} catch (Exception e) {
logger.error("类:WebServiceCommonClient,方法:commonSend(),错误信息:"+e.getMessage());
return null;
}
}
public String getSendXML() {
return sendXML;
}
public void setSendXML(String sendXML) {
this.sendXML = sendXML;
}
public String getServiceMethodName() {
return ServiceMethodName;
}
public void setServiceMethodName(String serviceMethodName) {
this.ServiceMethodName = serviceMethodName;
}
public String getServiceURL() {
return ServiceURL;
}
public void setServiceURL(String ServiceName) {
this.ServiceURL = BaseConfig.getValue("webserviceURL")+"/"+ServiceName;
}
}