package com.sxl.util;
import java.io.*;
import java.net.*;
import java.security.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Client {
/*
* webservice服务器定义
*/
//调用注册方法可能不成功。
//java.io.IOException: Server returned HTTP response code: 400 for URL: http://sdk2.zucp.net:8060/webservice.asmx。
//如果出现上述400错误,请参考第102行。
//如果您的系统是utf-8,收到的短信可能是乱码,请参考第102,295行
//可以根据您的需要自行解析下面的地址
//http://sdk2.zucp.net:8060/webservice.asmx?wsdl
private String serviceURL = "http://sdk2.zucp.net:8060/webservice.asmx";
private String sn = "";// 序列号
private String password = "";
private String pwd = "";// 密码
/*
* 构造函数
*/
public Client(String sn, String password)
throws UnsupportedEncodingException {
this.sn = sn;
this.password = password;
this.pwd = this.getMD5(sn + password);
}
/*
* 方法名称:getMD5
* 功 能:字符串MD5加密
* 参 数:待转换字符串
* 返 回 值:加密之后字符串
*/
public String getMD5(String sourceStr) throws UnsupportedEncodingException {
String resultStr = "";
try {
byte[] temp = sourceStr.getBytes();
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(temp);
// resultStr = new String(md5.digest());
byte[] b = md5.digest();
for (int i = 0; i < b.length; i++) {
char[] digit = { '0', '1', '2', '3', '4', '5', '6', '7', '8',
'9', 'A', 'B', 'C', 'D', 'E', 'F' };
char[] ob = new char[2];
ob[0] = digit[(b[i] >>> 4) & 0X0F];
ob[1] = digit[b[i] & 0X0F];
resultStr += new String(ob);
}
return resultStr;
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
return null;
}
}
/*
* 方法名称:register
* 功 能:注册
* 参 数:对应参数 省份,城市,行业,企业名称,联系人,电话,手机,电子邮箱,传真,地址,邮编
* 返 回 值:注册结果(String)
*/
public String register(String province, String city, String trade,
String entname, String linkman, String phone, String mobile,
String email, String fax, String address, String postcode) {
String result = "";
String soapAction = "http://tempuri.org/Register";
String xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
xml += "<soap12:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\">";
xml += "<soap12:Body>";
xml += "<Register xmlns=\"http://tempuri.org/\">";
xml += "<sn>" + sn + "</sn>";
xml += "<pwd>" + password + "</pwd>";
xml += "<province>" + province + "</province>";
xml += "<city>" + city + "</city>";
xml += "<trade>" + trade + "</trade>";
xml += "<entname>" + entname + "</entname>";
xml += "<linkman>" + linkman + "</linkman>";
xml += "<phone>" + phone + "</phone>";
xml += "<mobile>" + mobile + "</mobile>";
xml += "<email>" + email + "</email>";
xml += "<fax>" + fax + "</fax>";
xml += "<address>" + address + "</address>";
xml += "<postcode>" + postcode + "</postcode>";
xml += "<sign></sign>";
xml += "</Register>";
xml += "</soap12:Body>";
xml += "</soap12:Envelope>";
URL url;
try {
url = new URL(serviceURL);
URLConnection connection = url.openConnection();
HttpURLConnection httpconn = (HttpURLConnection) connection;
ByteArrayOutputStream bout = new ByteArrayOutputStream();
bout.write(xml.getBytes());
//bout.write(xml.getBytes("GBK"));
byte[] b = bout.toByteArray();
httpconn.setRequestProperty("Content-Length", String
.valueOf(b.length));
httpconn.setRequestProperty("Content-Type",
"text/xml; charset=gb2312");
httpconn.setRequestProperty("SOAPAction", soapAction);
httpconn.setRequestMethod("POST");
httpconn.setDoInput(true);
httpconn.setDoOutput(true);
OutputStream out = httpconn.getOutputStream();
out.write(b);
out.close();
InputStreamReader isr = new InputStreamReader(httpconn
.getInputStream());
BufferedReader in = new BufferedReader(isr);
String inputLine;
while (null != (inputLine = in.readLine())) {
Pattern pattern = Pattern
.compile("<RegisterResult>(.*)</RegisterResult>");
Matcher matcher = pattern.matcher(inputLine);
while (matcher.find()) {
result = matcher.group(1);
}
}
in.close();
return new String(result.getBytes(), "utf-8");
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
/*
* 方法名称:chargeFee
* 功 能:充值
* 参 数:充值卡号,充值密码
* 返 回 值:操作结果(String)
*/
public String chargeFee(String cardno, String cardpwd) {
String result = "";
String soapAction = "http://tempuri.org/ChargUp";
String xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
xml += "<soap12:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\">";
xml += "<soap12:Body>";
xml += "<ChargUp xmlns=\"http://tempuri.org/\">";
xml += "<sn>" + sn + "</sn>";
xml += "<pwd>" + password + "</pwd>";
xml += "<cardno>" + cardno + "</cardno>";
xml += "<cardpwd>" + cardpwd + "</cardpwd>";
xml += "</ChargUp>";
xml += "</soap12:Body>";
xml += "</soap12:Envelope>";
URL url;
try {
url = new URL(serviceURL);
URLConnection connection = url.openConnection();
HttpURLConnection httpconn = (HttpURLConnection) connection;
ByteArrayOutputStream bout = new ByteArrayOutputStream();
bout.write(xml.getBytes());
byte[] b = bout.toByteArray();
httpconn.setRequestProperty("Content-Length", String
.valueOf(b.length));
httpconn.setRequestProperty("Content-Type",
"text/xml; charset=gb2312");
httpconn.setRequestProperty("SOAPAction", soapAction);
httpconn.setRequestMethod("POST");
httpconn.setDoInput(true);
httpconn.setDoOutput(true);
OutputStream out = httpconn.getOutputStream();
out.write(b);
out.close();
InputStreamReader isr = new InputStreamReader(httpconn
.getInputStream());
BufferedReader in = new BufferedReader(isr);
String inputLine;
while (null != (inputLine = in.readLine())) {
Pattern pattern = Pattern
.compile("<ChargUpResult>(.*)</ChargUpResult>");
Matcher matcher = pattern.matcher(inputLine);
while (matcher.find()) {
result = matcher.group(1);
}
}
in.close();
// return result;
return new String(result.getBytes(), "utf-8");
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
/*
* 方法名称:getBalance
* 功 能:获取余额
* 参 数:无
* 返 回 值:余额(String)
*/
public String getBalance() {
String result = "";
String soapAction = "http://tempuri.org/balance";
String xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
xml += "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">";
xml += "<soap:Body>";
xml += "<balance xmlns=\"http://tempuri.org/\">";
xml += "<sn>" + sn + "</sn>";
xml += "<pwd>" + pwd + "</pwd>";
xml += "</balance>";
xml += "</soap:Body>";
xml += "</soap:Envelope>";
URL url;
try {
url = new URL(serviceURL);
URLConnection connection = url.openConnection();
HttpURLConnection httpconn = (HttpURLConnection) connection;
ByteArrayOutputStream bout = new ByteArrayOutputStream();
bout.write(xml.getBytes());
byte[] b = bout.toByteArray();
没有合适的资源?快使用搜索试试~ 我知道了~
SpringMyBatis前后端分离影视推荐系统
共1574个文件
gif:325个
js:279个
png:249个
需积分: 1 0 下载量 180 浏览量
2024-03-12
10:43:24
上传
评论
收藏 36.11MB RAR 举报
温馨提示
SpringMyBatis可以与多种前端框架配合使用。。 前后端分离是一种开发模式,它允许前端和后端作为独立的部分进行开发、测试和部署。在这种模式下,前端负责用户界面和用户体验,而后端则处理业务逻辑和数据存储。这种模式的好处包括提高开发效率、便于迭代和维护、以及更好的安全性和可扩展性。 在技术实现上,Vue.js 是一个非常流行的前端框架,它可以与 Spring Boot 和 MyBatis 后端框架很好地集成。
资源推荐
资源详情
资源评论
收起资源包目录
SpringMyBatis前后端分离影视推荐系统 (1574个子文件)
Client.class 16KB
FrontController.class 16KB
FileController.class 12KB
DBHelper.class 11KB
Uploader.class 10KB
HssfHelper.class 10KB
Aprioti.class 7KB
WeatherUtil.class 6KB
BaseController.class 6KB
FlightUtil.class 6KB
AdminCustomerController.class 6KB
MyController.class 5KB
MoviceController.class 5KB
PinglunController.class 5KB
FtpUtil.class 5KB
CustomerLoginController.class 5KB
DateUtil.class 5KB
CustomerController.class 5KB
LtsmController.class 5KB
TypesController.class 4KB
LbtController.class 4KB
LngLat.class 4KB
RandomValidateCode.class 4KB
PageTool.class 4KB
Sign.class 4KB
FileUtil.class 4KB
OperateImage.class 4KB
ProtalSessionHandlerInterceptor.class 3KB
UrlUtil.class 3KB
AdminLoginController.class 3KB
ValidatorUtil.class 3KB
StringHelper.class 3KB
UTF8StringHttpMessageConverter.class 3KB
AdminController.class 3KB
StringUtil.class 2KB
PublicController.class 2KB
FileController$uploadFile.class 2KB
SystemProperties.class 2KB
DBHelper$1.class 2KB
MD5Util.class 2KB
ELSetPropertyTag.class 1KB
ExcelSelfUse.class 1KB
OverOutWrapper.class 1KB
ImageTools.class 1KB
MessageSourceHelper.class 1KB
MP3Player.class 1KB
BatchSql.class 1KB
SpringApplicationContextHolder.class 1KB
DateConverter.class 1KB
JacksonJsonUtil.class 1000B
TagParams.class 792B
Response.class 743B
IndexController.class 742B
Itemset.class 482B
ExcelView.class 453B
.classpath 572B
org.eclipse.wst.common.component 523B
org.eclipse.wst.jsdt.ui.superType.container 49B
bootstrap.css 143KB
H-ui.css 127KB
bootstrap.css 115KB
bootstrap.css 115KB
animate.min.css 68KB
easyui.css 51KB
easyui.css 51KB
easyui.css 51KB
easyui.css 50KB
editor_ie7.css 47KB
easyui.css 47KB
editor_iequirks.css 46KB
editor_ie8.css 46KB
editor_ie.css 45KB
editor_gecko.css 45KB
editor.css 45KB
font-awesome-ie7.css 40KB
animation.css 38KB
font-awesome-ie7.min.css 37KB
prettyPhoto.css 29KB
font-awesome.css 27KB
font-awesome.min.css 22KB
font-awesome.css 21KB
bootstrap-responsive.css 21KB
custom-styles.css 20KB
bootstrap-theme.min.css 19KB
dialog_ie7.css 17KB
swiper.3.1.7.css 17KB
dialog_ie8.css 16KB
dialog_iequirks.css 16KB
dialog_ie.css 16KB
dialog_opera.css 16KB
dialog.css 15KB
select2.min.css 15KB
custom-styles.css 13KB
dropzone.css 11KB
cssCharts.css 10KB
tabs.css 8KB
tabs.css 8KB
tabs.css 8KB
tabs.css 8KB
checkbox3.min.css 7KB
共 1574 条
- 1
- 2
- 3
- 4
- 5
- 6
- 16
资源评论
西祠rry
- 粉丝: 0
- 资源: 13
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功