JAVA呼叫C#WebService菠菜網站搭建介面
1、ServiceImpl類中的菠菜網站搭建《企娥21717 93408》方法呼叫callService方法
@Value("${bu.check.method}")
private String methodName;
@Value("${bu.check.url}")
private String buCheckUrl;
public boolean getBuUserCheck(String userName) {
boolean status=false;
String[] paramate = {"account"};
Object[] args = {userName};
String result = CommonUtil.callService(methodName,buCheckUrl, paramate, args);
if(!StringUtils.isBlank(result)) {
JSONObject json = JSONObject.fromObject(result);
int flag = Integer.parseInt(json.getString("isActive"));
status = flag==1?true:false;
}
return status;
}
2、CommonUtil.類中封裝的callService方法
類中匯入的包
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import javax.xml.rpc.ServiceException;
import javax.xml.rpc.encoding.XMLType;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;