📄 headersetextend.java
字号:
package com.wireless.sms.unsoap.workthread;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPException;
import org.apache.axis.AxisFault;
import org.apache.axis.client.Stub;
import org.apache.axis.message.SOAPHeaderElement;
import com.vasp.HeaderSet;
public class HeaderSetExtend extends HeaderSet{
public static String _down_header_SPNumber = "SPNumber";
public static String _T_down_header_SPNumber = null;
public static String _down_header_sessionId = "sessionId";
public static String _T_down_header_sessionId = null;
public static String _down_header_sessionEnd = "sessionEnd";
public static String _T_down_header_sessionEnd = null;
public static String _down_header_linkId = "linkId";
public static String _T_down_header_linkId = null;
//20070727 new change by sdun order
public static String _down_header_groupMessaging = "groupMessaging";
public static boolean _T_down_header_groupMessaging;
/**
* @deprecated
*/
public static String _down_header_multicastMessaging = "multicastMessaging";
/**
* @deprecated
*/
public static boolean _T_down_header_multicastMessaging;
/**
* @deprecated
*/
public static boolean is_T_down_header_multicastMessaging()
{
return _T_down_header_multicastMessaging;
}
/**
* @deprecated
*/
public static void set_T_down_header_multicastMessaging(boolean messaging)
{
_T_down_header_multicastMessaging = messaging;
}
public HeaderSetExtend() {
super();
}
public static void setDownSoapHeader(Stub stub) {
try
{
SOAPHeaderElement soapHeaderElement = new SOAPHeaderElement(_header_element_namespace, "RequestSOAPHeader");
SOAPElement soapElement = soapHeaderElement.addChildElement(_down_header_spId);
soapElement.addTextNode(_T_down_header_spId);
soapElement = soapHeaderElement.addChildElement(_down_header_serviceId);
soapElement.addTextNode(_T_down_header_serviceId);
if(_T_down_header_spPassword != null)
{
soapElement = soapHeaderElement.addChildElement(_down_header_timeStamp);
soapElement.addTextNode(_T_down_header_timeStamp);
soapElement = soapHeaderElement.addChildElement(_down_header_spPassword);
String md5password = digest(_T_down_header_spId, _T_down_header_spPassword, _T_down_header_timeStamp);
System.out.println("md5password:" + md5password.toUpperCase());
soapElement.addTextNode(md5password.toUpperCase());
}
if(_T_down_header_OA != null)
{
soapElement = soapHeaderElement.addChildElement(_down_header_OA);
soapElement.addTextNode(_T_down_header_OA);
}
if(_T_down_header_FA != null)
{
soapElement = soapHeaderElement.addChildElement(_down_header_FA);
soapElement.addTextNode(_T_down_header_FA);
}
if(_T_down_header_groupMessaging)
{
soapElement = soapHeaderElement.addChildElement(_down_header_groupMessaging);
soapElement.addTextNode(Boolean.toString(_T_down_header_groupMessaging));
}
//new added
if(_T_down_header_SPNumber != null)
{
soapElement = soapHeaderElement.addChildElement(_down_header_SPNumber);
soapElement.addTextNode(_T_down_header_SPNumber);
}
if(_T_down_header_sessionId != null)
{
soapElement = soapHeaderElement.addChildElement(_down_header_sessionId);
soapElement.addTextNode(_T_down_header_sessionId);
}
if(_T_down_header_sessionEnd != null)
{
soapElement = soapHeaderElement.addChildElement(_down_header_sessionEnd);
soapElement.addTextNode(_T_down_header_sessionEnd);
}
if(_T_down_header_linkId != null)
{
soapElement = soapHeaderElement.addChildElement(_down_header_linkId);
soapElement.addTextNode(_T_down_header_linkId);
}
stub.setHeader(soapHeaderElement);
}
catch(SOAPException e)
{
System.out.println("set soap header error: ");
e.printStackTrace();
}
}
private static String digest(String spId, String passwd, String timestamp)
{
try
{
MessageDigest md = MessageDigest.getInstance("MD5");
System.out.println(" ");
System.out.println(spId);
System.out.println(passwd);
System.out.println(timestamp);
md.update(spId.getBytes());
md.update(passwd.getBytes());
md.update(timestamp.getBytes());
byte b[] = md.digest();
String tmp = "";
String s[] = new String[16];
for(int i = 0; i < 16; i++)
{
int ii = b[i];
if(b[i] < 0)
ii = b[i] + 256;
s[i] = Integer.toHexString(ii);
if(s[i].length() == 1)
s[i] = "0" + s[i];
tmp = tmp + s[i];
}
System.out.println(tmp);
return tmp;
}
catch(Exception ex)
{
ex.printStackTrace();
}
return null;
}
public static synchronized String get_T_down_header_linkId() {
return _T_down_header_linkId;
}
public static synchronized void set_T_down_header_linkId(String id) {
_T_down_header_linkId = id;
}
public static synchronized String get_T_down_header_SPNumber() {
return _T_down_header_SPNumber;
}
public static synchronized void set_T_down_header_SPNumber(String _t_down_header_san) {
_T_down_header_SPNumber = _t_down_header_san;
}
public static synchronized String get_T_down_header_sessionId() {
return _T_down_header_sessionId;
}
public static synchronized void set_T_down_header_sessionId(String id) {
_T_down_header_sessionId = id;
}
public static synchronized String get_T_down_header_sessionEnd() {
return _T_down_header_sessionEnd;
}
public static synchronized void set_T_down_header_sessionEnd(String end) {
_T_down_header_sessionEnd = end;
}
public static void main(String[] args){
String faultXML = new AxisFault("Server.NoLogFile",
"No log file configured for the LogHandler!",
null, null).getMessage();
faultXML = "中国汉字";
try {
faultXML = new String(faultXML.getBytes("GBK"),"UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
System.out.println(faultXML);
}
public static boolean is_T_down_header_groupMessaging() {
return _T_down_header_groupMessaging;
}
public static void set_T_down_header_groupMessaging(boolean messaging) {
_T_down_header_groupMessaging = messaging;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -