?? syncorderrelationreqbean.java
字號:
package com.zhanghao.provision;
import javax.xml.soap.*;
import java.util.Iterator;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import com.zhanghao.common.util.Base64;
public class SyncOrderRelationReqBean{
public String TransactionID;
public String Version;
public SchemaOfAddress Send_Address = new SchemaOfAddress();
public SchemaOfAddress Dest_Address = new SchemaOfAddress();
public SchemaOfUserID FeeUser_ID = new SchemaOfUserID();
public SchemaOfUserID DestUser_ID = new SchemaOfUserID();
public String LinkID;
public int ActionID;
public int ActionReasonID;
public String SPID;
public String SPServiceID;
public int AccessMode;
public String FeatureStr; //=Base64(SPNumber + MsgContent)
public String SPNumber;
public String MsgContent;
public SOAPMessage soapMessage;
public SyncOrderRelationReqBean() {
}
public SyncOrderRelationReqBean(SOAPMessage soapMsg) throws Exception{
parseSOAPMsg(soapMsg);
}
public void parseSOAPMsg(SOAPMessage soapMsg) throws Exception{
this.soapMessage = soapMsg;
try{
Name name;
Iterator child;
SOAPElement soapEle;
SOAPElement soapEleTemp;
SOAPEnvelope soapEnv = soapMsg.getSOAPPart().getEnvelope();
//該消息編號
name = soapEnv.createName("TransactionID","","http://www.monternet.com/dsmp/schemas/");
TransactionID = ((SOAPElement)soapEnv.getHeader().getChildElements(name).next()).getValue();
//SyncOrderRelationReq消息Body
name = soapEnv.createName("SyncOrderRelationReq","","http://www.monternet.com/dsmp/schemas/");
child = soapEnv.getBody().getChildElements(name);
soapEle = (SOAPElement)child.next();
//該接口消息的版本號,本次所有的接口消息的版本都為“1.5.0”
name = soapEnv.createName("Version","","http://www.monternet.com/dsmp/schemas/");
Version = ((SOAPElement)soapEle.getChildElements(name).next()).getValue();
//address_info_schema 發送方的地址
name = soapEnv.createName("Send_Address","","http://www.monternet.com/dsmp/schemas/");
soapEleTemp = (SOAPElement)soapEle.getChildElements(name).next();
name = soapEnv.createName("DeviceType","","http://www.monternet.com/dsmp/schemas/");
this.Send_Address.DeviceType = Integer.parseInt(((SOAPElement)soapEleTemp.getChildElements(name).next()).getValue());
name = soapEnv.createName("DeviceID","","http://www.monternet.com/dsmp/schemas/");
this.Send_Address.DeviceID = ((SOAPElement)soapEleTemp.getChildElements(name).next()).getValue();
//address_info_schema 接收方的地址
name = soapEnv.createName("Dest_Address","","http://www.monternet.com/dsmp/schemas/");
soapEleTemp = (SOAPElement)soapEle.getChildElements(name).next();
name = soapEnv.createName("DeviceType","","http://www.monternet.com/dsmp/schemas/");
this.Dest_Address.DeviceType = Integer.parseInt(((SOAPElement)soapEleTemp.getChildElements(name).next()).getValue());
name = soapEnv.createName("DeviceID","","http://www.monternet.com/dsmp/schemas/");
this.Dest_Address.DeviceID = ((SOAPElement)soapEleTemp.getChildElements(name).next()).getValue();
//user_id_schema 計費用戶標識
name = soapEnv.createName("FeeUser_ID","","http://www.monternet.com/dsmp/schemas/");
soapEleTemp = (SOAPElement)soapEle.getChildElements(name).next();
name = soapEnv.createName("UserIDType","","http://www.monternet.com/dsmp/schemas/");
this.FeeUser_ID.UserIDType = Integer.parseInt(((SOAPElement)soapEleTemp.getChildElements(name).next()).getValue());
name = soapEnv.createName("MSISDN","","http://www.monternet.com/dsmp/schemas/");
this.FeeUser_ID.MSISDN = ((SOAPElement)soapEleTemp.getChildElements(name).next()).getValue();
name = soapEnv.createName("PseudoCode","","http://www.monternet.com/dsmp/schemas/");
this.FeeUser_ID.PseudoCode = ((SOAPElement)soapEleTemp.getChildElements(name).next()).getValue();
//user_id_schema 使用用戶標識
name = soapEnv.createName("DestUser_ID","","http://www.monternet.com/dsmp/schemas/");
soapEleTemp = (SOAPElement)soapEle.getChildElements(name).next();
name = soapEnv.createName("UserIDType","","http://www.monternet.com/dsmp/schemas/");
this.DestUser_ID.UserIDType = Integer.parseInt(((SOAPElement)soapEleTemp.getChildElements(name).next()).getValue());
name = soapEnv.createName("MSISDN","","http://www.monternet.com/dsmp/schemas/");
this.DestUser_ID.MSISDN = ((SOAPElement)soapEleTemp.getChildElements(name).next()).getValue();
name = soapEnv.createName("PseudoCode","","http://www.monternet.com/dsmp/schemas/");
this.DestUser_ID.PseudoCode = ((SOAPElement)soapEleTemp.getChildElements(name).next()).getValue();
//string 臨時訂購關系的事務ID
name = soapEnv.createName("LinkID","","http://www.monternet.com/dsmp/schemas/");
LinkID = ((SOAPElement)soapEle.getChildElements(name).next()).getValue();
//服務狀態管理動作代碼,具體值如下:
//1: 開通服務;
//2: 停止服務;
//3: 激活服務;
//4: 暫停服務;
name = soapEnv.createName("ActionID","","http://www.monternet.com/dsmp/schemas/");
ActionID = Integer.parseInt(((SOAPElement)soapEle.getChildElements(name).next()).getValue());
//產生服務狀態管理動作原因的代碼,具體值如下:
/** 1:用戶發起行為
2:Admin&1860發起行為
3:Boss停機
4:Boss開機
5:Boss過戶
6:Boss銷戶
7:Boss改號
8:扣費失敗導致的服務取消
9:其他
**/
name = soapEnv.createName("ActionReasonID","","http://www.monternet.com/dsmp/schemas/");
ActionReasonID = Integer.parseInt(((SOAPElement)soapEle.getChildElements(name).next()).getValue());
//string SP的企業代碼
name = soapEnv.createName("SPID","","http://www.monternet.com/dsmp/schemas/");
SPID = ((SOAPElement)soapEle.getChildElements(name).next()).getValue();
//string SP中該服務的服務代碼
name = soapEnv.createName("SPServiceID","","http://www.monternet.com/dsmp/schemas/");
SPServiceID = ((SOAPElement)soapEle.getChildElements(name).next()).getValue();
//服務的訪問方式1:WEB2:WAP3:SMS
name = soapEnv.createName("AccessMode","","http://www.monternet.com/dsmp/schemas/");
AccessMode = Integer.parseInt(((SOAPElement)soapEle.getChildElements(name).next()).getValue());
//服務訂購參數(base64加密)
name = soapEnv.createName("FeatureStr","","http://www.monternet.com/dsmp/schemas/");
FeatureStr = ((SOAPElement)soapEle.getChildElements(name).next()).getValue()==null?
"":((SOAPElement)soapEle.getChildElements(name).next()).getValue();
System.out.println("FeatureStr = " + FeatureStr);
if(!FeatureStr.equals("")){
String temp = Base64.decodeBase64(FeatureStr);
this.SPNumber = temp.substring(0,temp.indexOf(" ")).trim();
this.MsgContent = temp.substring(temp.indexOf(" ")+1).trim();
}
System.out.println("SPNumber = " + SPNumber);
System.out.println("MsgContent = " + MsgContent);
}
catch(Exception ex){
ex.printStackTrace();
throw new Exception("解析SOAP包錯誤:"+ex.getMessage());
}
}
public int getMsgLength(){
try{
ByteArrayOutputStream byteArrayOutStream = new ByteArrayOutputStream();
DataOutputStream dataOutStream = new DataOutputStream(byteArrayOutStream);
this.soapMessage.writeTo(dataOutStream);
return byteArrayOutStream.toByteArray().length;
}
catch(Exception ex){
return 0;
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -