国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計 > 正文

provision接口

2019-11-17 05:56:02
字體:
供稿:網(wǎng)友

PRovision接口  作者:Mouse  時間:06-02-05 16:17 
附件: 
java寫的,不知道你能用上不能.
這是主要的類,需要的類,都是一些工具方法,你自己寫吧,主要是對soap包進(jìn)行解析的.

package com.cellcom.wap.fala.common ;

import java.io.BufferedReader ;
import java.io.IOException ;
import java.io.PrintWriter ;

import javax.servlet.ServletException ;
import javax.servlet.http.HttpServlet ;
import javax.servlet.http.HttpServletRequest ;
import javax.servlet.http.HttpServletResponse ;
import javax.xml.parsers.DocumentBuilder ;

import javax.xml.parsers.DocumentBuilderFactory ;
import javax.xml.parsers.FactoryConfigurationError ;
import javax.xml.parsers.ParserConfigurationException ;

import org.w3c.dom.Document ;
import org.xml.sax.InputSource ;
import org.xml.sax.SAXException ;

import com.cellcom.common.wap.mobile.misc.DOMParsing ;
import com.cellcom.common.wap.mobile.misc.DSMPServiceProv ;
import com.cellcom.common.wap.mobile.misc.SyncOrderRelationResp ;
import com.cellcom.common.wap.mobile.misc.UnSubscribeServiceResp ;
import com.cellcom.common.wap.mobile.misc.ProvTransInterface ;


/**
*
Title: wap.fala.cn


*
Description: 接收


*
Copyright: Copyright (c) 2005


*
Company: www.cellcom.com.cn


* @author cabin
* @version 1.0
*/

public class Provision
   extends HttpServlet {
  public Provision() {
  }
  private static final String CONTENT_TYPE = "text/xml" ;
  public void service(HttpServletRequest request, HttpServletResponse response)
      throws
      ServletException, IOException {
     response.setContentType(CONTENT_TYPE) ;
     DSMPServiceProv prov = this.parseReq(request) ;
     if (prov != null) {
        this.logAndSync(prov);
        this.respReq(response,prov,0);
     }
  }
  /**
   * 將請求的SOAP包進(jìn)行解析封裝
   * @param request
   * @return
   */
  private DSMPServiceProv parseReq(HttpServletRequest request) {
     DSMPServiceProv prov = null ;
     Document doc = null ;

     try {
        BufferedReader br = request.getReader() ;
        DocumentBuilderFactory factory = DocumentBuilderFactory
            .newInstance() ;
        DocumentBuilder builder = factory.newDocumentBuilder() ;

        doc = builder.parse(new InputSource(br)) ;
        DOMParsing.printNode(doc, "  ") ;
        doc.normalize() ;
        //對包進(jìn)行解析,得到相應(yīng)的包的內(nèi)容PROV
        prov = DSMPServiceProv.ParseSoapXml(doc) ;
     }
     catch (SAXException ex) {
        System.out.println("## error SAXException:"+ex.toString());
     }
     catch (ParserConfigurationException ex) {
        System.out.println("## error ParserConfigurationException:"+ex.toString());
     }
     catch (FactoryConfigurationError ex) {
        System.out.println("## error FactoryConfigurationError:"+ex.toString());
     }
     catch (IOException ex) {
        System.out.println("## error IOException:"+ex.toString());
     }
     return prov;
  }
  public void logAndSync(DSMPServiceProv prov){
        //業(yè)務(wù)處理
        // 狀態(tài)治理命令結(jié)果 errState : 0 命令成功; -1 無效的action_id;-2 無效的service_id
        //(其它任何非0值) 命令失敗;
        //action : 1 開通; 2 停止; 3 激活 4 暫停
        ProvTransInterface provtrans = new ProvTransHandler() ;
        provtrans.logProvTrans(prov) ;
        provtrans.SyncProv(prov) ;
  }
  public void respReq(HttpServletResponse response,DSMPServiceProv prov,int errState){
     String sb = null ;
     PrintWriter out = null ;
     try {
        out = response.getWriter() ;
     }
     catch (IOException ex) {
        System.out.println(ex.toString());
     }

     if ("SyncOrderRelationReq".equals(prov.getMsgType())) {
        sb =
            SyncOrderRelationResp.getResp(errState, prov.getTransactionID()) ;
     }
     else if ("UnSubscribeServiceReq".equals(prov.getMsgType())) {
        sb =
            UnSubscribeServiceResp.getResp(errState, prov.getTransactionID()) ;

     }
     out.print(sb.toString()) ;
     out.flush() ;
     out.close() ;
  }
}


 

     
標(biāo)題: Re:provision接口  作者:Mouse  時間:06-02-05 16:18 
附件: 
移動WAP同步關(guān)系provision接口的實現(xiàn)
前陣做的小WAP項目  寫的東西也挺爛的 功能就不說了 做WAP的都明白

公布出完成的PROVISION接口代碼和數(shù)據(jù)表格式

package com.wap.provision;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;

import javax.servlet.ServletException;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import data.DTime;


public class Provision extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet
{
       protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
       {

               doPost(request, response);
       }

       protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
       {

               Connection con;

               con = (Connection)this.getServletContext().getAttribute("con");//從容器里里獲得數(shù)據(jù)庫連接
              
               DTime dtime = new DTime();//獲取當(dāng)前時間

               System.out.println("Provision start at " + dtime.getDTime());

               ServletInputStream in = request.getInputStream();//得到InputStream

               PrintWriter out = response.getWriter();//得到Writer

               Anatomy tempAnatomy = new Anatomy(in, out, con);//將數(shù)據(jù)流放入解析器

               System.out.println("data input Anatmomy");

       }

 


--------------------------------------------------------------------------------


package com.wap.provision;

import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;

import javax.servlet.ServletInputStream;

import javax.xml.parsers.DocumentBuilderFactory;

import org.w3c.dom.Document;

import data.DTime;
import data.DataBean;

public class Anatomy
{
       private String TransactionID = "";// 該消息編號

       private String MsgType = "";// 消息類型

       private String LinkID = "";// 臨時訂購關(guān)系的事務(wù)ID

       private String Version = "";// 該接口消息的版本號

       private String ActionID = "";// 服務(wù)狀態(tài)治理動作代碼

       private String ActionReasonID = "";// 產(chǎn)生服務(wù)狀態(tài)治理動作原因的代碼

       private String SPID = "";// 企業(yè)代碼

       private String SPServiceID = "";// 服務(wù)代碼

       private String accessMode = "";// 訪問模式

       private String FeatureStr = "";// 服務(wù)訂購參數(shù)

       private String Send_DeviceType = "";// 發(fā)送方地址

       private String Send_DeviceID = "";

       private String Dest_DeviceType = "";// 接收方地址

       private String Dest_DeviceID = "";

       private String Fee_UserIDType = "";// 計費(fèi)用戶標(biāo)識

       private String Fee_MSISDN = "";

       private String Fee_PseudoCode = "";// 記費(fèi)用戶MID

       private String Dest_UserIDType = "";

       private String Dest_MSISDN = "";

       private String Dest_PseudoCode = "";

       private String hRet = "";// 返回值

       private ServletInputStream in;

       private PrintWriter out;

       private Document document;

       private Connection con;

       private String[][] relation;//已存在的訂購關(guān)系

       private String[][] pause;//已經(jīng)暫停的訂購關(guān)系

       String delete_Sql_Relation;

       String delete_Sql_Pause;

       String relation_sql;

       String pause_sql;

       public Anatomy(ServletInputStream In, PrintWriter Out, Connection con)
       {

               try

               {
                       this.in = In;

                       this.out = Out;

                       this.con = con;

                       this.document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(this.in);

                       getReqInfo();// 將各個字段付值

                       if (Fee_UserIDType.equals("1"))// Fee_UserIDType為1用MID,2為違代碼
                       {
                               relation_sql = "select * from Relation where SPServiceID = '" + SPServiceID + "' and Fee_MSISDN ='" + Fee_MSISDN + "'";

                               pause_sql = "select * from Pause where SPServiceID = '" + SPServiceID + "' and Fee_MSISDN ='" + Fee_MSISDN + "'";

                               delete_Sql_Relation = "DELETE FROM Relation WHERE SPServiceID = '" + SPServiceID + "' and Fee_MSISDN ='" + Fee_MSISDN + "'";

                               delete_Sql_Pause = "DELETE FROM Pause WHERE SPServiceID = '" + SPServiceID + "' and Fee_MSISDN ='" + Fee_MSISDN + "'";

                       }
                       else
                       {
                               relation_sql = "select * from Relation where SPServiceID = '" + SPServiceID + "' and Fee_PseudoCode ='" + Fee_PseudoCode + "'";

                               pause_sql = "select * from Pause where SPServiceID = '" + SPServiceID + "' and Fee_PseudoCode ='" + Fee_PseudoCode + "'";

                               delete_Sql_Relation = "DELETE FROM Relation WHERE SPServiceID = '" + SPServiceID + "' and Fee_PseudoCode ='" + Fee_PseudoCode + "'";

                               delete_Sql_Pause = "DELETE FROM Pause WHERE SPServiceID = '" + SPServiceID + "' and Fee_PseudoCode ='" + Fee_PseudoCode + "'";

                       }

                       relation = DataBean.getResultToArray(con, relation_sql);//得到當(dāng)前的一該業(yè)務(wù)已訂購的關(guān)系

                       System.out.print("Reveice ");

                       String[] InfoArray = this.getInfoArray();//將字段組合成數(shù)組

                       DataBean.InsertTable(con, "AllReceive", InfoArray);// 插入同步數(shù)據(jù)庫做記錄

                       System.out.println();

                       this.sendBack(this.getHRet());//返回狀態(tài)值

               }

               catch (Exception e)
               {
                       this.sendBack("1");// 未知錯誤

                       e.printStackTrace();
               }

       }

       private void getReqInfo()// 將各字段付值
       {

               TransactionID = getNodeValue("TransactionID", 0);

               MsgType = getNodeValue("MsgType", 0);

               LinkID = getNodeValue("LinkID", 0);

               Version = getNodeValue("Version", 0);

               ActionID = getNodeValue("ActionID", 0);

               ActionReasonID = getNodeValue("ActionReasonID", 0);

               SPID = getNodeValue("SPID", 0);

               SPServiceID = getNodeValue("SPServiceID", 0);

               AccessMode = getNodeValue("AccessMode", 0);

               FeatureStr = getNodeValue("FeatureStr", 0);

               Send_DeviceType = getNodeValue("DeviceType", 0);

               Send_DeviceID = getNodeValue("DeviceID", 0);

               Dest_DeviceType = getNodeValue("DeviceType", 1);

               Dest_DeviceID = getNodeValue("DeviceID", 1);

               Fee_UserIDType = getNodeValue("UserIDType", 0);

               Fee_MSISDN = getNodeValue("MSISDN", 0);

               Fee_PseudoCode = getNodeValue("PseudoCode", 0);

               Dest_UserIDType = getNodeValue("UserIDType", 1);

               Dest_MSISDN = getNodeValue("MSISDN", 1);

               Dest_PseudoCode = getNodeValue("PseudoCode", 1);

       }

       private String getNodeValue(String TagName, int index)

       {

               if (document.getElementsByTagName(TagName) != null && document.getElementsByTagName(TagName).item(index) != null && document.getElementsByTagName(TagName).item(index).getFirstChild() != null)
               {
                       String value = document.getElementsByTagName(TagName).item(index).getFirstChild().getNodeValue();

                       System.out.print(" " + TagName + " = " + value);

                       return value;
               }
               else
               {
                       System.out.print(" " + TagName + " = null");

                       return "";
               }
       }

       private String getHRet()
       {

               try
               {

                       if (!MsgType.equalsIgnoreCase("SyncOrderRelationReq"))
                       {
                               return "4000";// 無效的MsgType
                       }
                       else if ((Integer.parseInt(ActionReasonID) > 4) (Integer.parseInt(ActionReasonID) < 1))
                       {

                               return "4002";// 無效的ActionReasonID
                       }
                       else if ((Integer.parseInt(AccessMode) > 3) (Integer.parseInt(AccessMode) < 1))
                       {
                               return "4006";// 無效的AccessMode
                       }
                       else if ((Fee_MSISDN == null) && (Fee_PseudoCode == null))
                       {
                               return "1";
                       }

                       int id = Integer.parseInt(ActionID);

                       switch (id)
                       // relation==null 該消息在關(guān)系表無記錄 pause==null
                       // 該消息在暫停表無記錄
                       {
                       case 1:
                       {
                               if (relation == null)

                               {
                                       String[] InfoArray = this.getInfoArray();// 訂購成功
                                       // 插入關(guān)系表

                                       DataBean.InsertTable(con, "Relation", InfoArray);// 插入同步數(shù)據(jù)庫做記錄

                                       return "0";
                               }
                               else
                               {
                                       return "4007";// Misc同步開通服務(wù),但sp端以存在訂購關(guān)系,且狀態(tài)為開通
                               }
                       }
                       case 2:
                       {
                               if (relation == null)
                               {

                                       return "4011";// Misc同步停止服務(wù),但sp端不存在訂購關(guān)系
                               }
                               else if (relation != null)
                               {
                                       DataBean.deleteRow(con, delete_Sql_Relation);

                                       return "0";
                               }
                               else
                                       return "1";
                       }
                       case 3:
                       {
                               pause = DataBean.getResultToArray(con, pause_sql);

                               if ((relation == null) && (pause == null))
                               {

                                       return "4016";// Misc平臺激活服務(wù),但SP端不存在訂購關(guān)系
                               }
                               else if ((relation != null) && (pause == null))
                               {
                                       return "4015";// Misc平臺激活服務(wù),但SP端已存在訂購關(guān)系,切狀態(tài)為開通
                               }
                               else if (pause != null)
                               {
                                       DataBean.InsertTable(con, "Relation", pause[0]);

                                       DataBean.deleteRow(con, delete_Sql_Pause);

                                       return "0";// 成功
                               }
                               else
                                       return "1";

                       }

                       case 4:
                       {
                               pause = DataBean.getResultToArray(con, pause_sql);

                               if ((relation == null) && (pause == null))
                               {
                                       return "4013";// Misc平臺暫停服務(wù),但SP端不存在訂購關(guān)系
                               }
                               else if (pause != null)
                               {
                                       return "4014";// Misc平臺暫停服務(wù),但SP端存在訂購關(guān)系,//切狀態(tài)為暫停
                               }
                               else if ((relation != null) && (pause == null))
                               {
                                       DataBean.InsertTable(con, "Pause", relation[0]);

                                       DataBean.deleteRow(con, delete_Sql_Relation);

                                       return "0";

                               }
                               else
                                       return "1";

                       }
                       default:
                       {
                               return "4001";
                       }
                       }
               }
               catch (SQLException e)
               {
                       return "1";// 未知錯誤
               }

       }

       private void sendBack(String hRet)
       {

               out.println("");
               out.println("");
               out.println("");
               out.println("" + TransactionID + "");
               out.println("");
               out.println("");
               out.println("");
               out.println("1.5.0");

               out.println("SyncOrderRelationResp");
               out.println("" + hRet + "");
               out.println("");
               out.println("");
               out.println("");

               String[] sendInfo =
               { TransactionID, hRet, new DTime().getDTime() };

               System.out.println("Send TransactionID = " + TransactionID + " hRet = " + hRet);

               DataBean.InsertTable(con, "AllSend", sendInfo);// 將發(fā)送數(shù)據(jù)插入發(fā)送記錄表

               out.close();
       }

       private String[] getInfoArray()
       {

               String[] InfoArray =
               { TransactionID, MsgType, LinkID, Version, ActionID, ActionReasonID, SPID, SPServiceID, AccessMode, FeatureStr, Send_DeviceType, Send_DeviceID, Dest_DeviceType, Dest_DeviceID, Fee_UserIDType, Fee_MSISDN, Fee_PseudoCode, Dest_UserIDType, Dest_MSISDN, Dest_PseudoCode, new DTime().getDTime() };

               return InfoArray;

       }

}

 

--------------------------------------------------------------------------------

里面涉及的一數(shù)據(jù)庫操作的類


package data;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;

import java.util.Enumeration;
import java.util.Hashtable;

public class DataBean
{
      
// 將數(shù)組按單元插入數(shù)據(jù)庫 返回插入行數(shù)
       public static int InsertTable(Connection conn, String tableName, String[] rows)
       {

               try
               {
                       Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);

                       StringBuffer row = new StringBuffer();

                       int i;

                       for (i = 0; i < rows.length - 1; i++)

                       {
                               row.append("'" + rows[i] + "'" + ",");
                       }

                       row.append("'" + rows[i] + "'");

                       String sql = "INSERT INTO " + tableName + " VALUES (" + new String(row) + ")";

                       int rowcount = stmt.executeUpdate(sql);

                       stmt.close();

                       return rowcount;

               }
               catch (SQLException e)
               {

                       System.out.println("Insert Table " + tableName + " Error");

                       e.printStackTrace();

                       return -1;
               }
       }

       // 按條件刪除 返回刪除的行數(shù)
       public static int deleteRow(Connection conn, String sql)
       {

               try
               {
                       Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);

                       //stmt.execute(sql);

                       int rows = stmt.executeUpdate(sql);

                      
                       stmt.close();
                      
                       return rows;

               }
               catch (SQLException e)
               {
                      
                       System.out.println("delete sql = " + sql + " ERROR");

                       e.printStackTrace();
                      
                       return -1;
               }
       }

       // 給定sql返回2唯數(shù)組結(jié)果
       public static String[][] getResultToArray(Connection conn, String sql) throws SQLException
       {

               Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);

               ResultSet rs = stmt.executeQuery(sql);

               if (DataBean.getRowCounts(rs) == 0)
                       return null;

               ResultSetMetaData rsmd = rs.getMetaData();

               int rows = DataBean.getRowCounts(rs);

               String[][] Information = new String[rows][rsmd.getColumnCount() - 1];

               while (rs.next())

               {

                       if (rs.getRow() > rows)
                               break;
                       for (int j = 0; j < rsmd.getColumnCount() - 1; j++)
                       {
                               Information[rs.getRow() - 1][j] = rs.getString(j + 2);// 我的數(shù)據(jù)表都有自動增長的ID 做主鍵 我不取它 getString從1開始取,第1字段為ID號,故+2
                       }
               }

               rs.close();

               stmt.close();

               return Information;

       }

      
       public static int getRowCounts(ResultSet rs)
       {

               int counts = 0;

               try
               {
                       while (rs.next())
                       {
                               counts++;
                       }

                       rs.beforeFirst();

                       return counts;

               }

               catch (Exception e)
               {
                       System.out.println("getRowCounts ERROR");

                       e.printStackTrace();

                       return -1;
               }

       }
        public static Connection getConnection(String dbname, String user, String passWord) throws SQLException, Exception
       {

               Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
//我用的MS SQL
               String url = "jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=" + dbname;

               Connection conn = DriverManager.getConnection(url, user, password);

               return conn;

       }


 

--------------------------------------------------------------------------------

數(shù)據(jù)庫庫中的表結(jié)構(gòu)
CREATE TABLE [dbo].[AllReceive] (
       [ID] [int] IDENTITY (1, 1) NOT NULL ,
       [TransactionID] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
       [MsgType] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
       [LinkID] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
       [Version] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
       [ActionID] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
       [ActionReasonID] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
       [SPID] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
       [SPServiceID] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
       [AccessMode] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,

       [FeatureStr] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
       [Send_DeviceType] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
       [Send_DeviceID] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
       [Dest_DeviceType] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
       [Dest_DeviceID] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
       [Fee_UserIDType] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
       [Fee_MSISDN] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
       [Fee_PseudoCode] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
       [Dest_UserIDType] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
       [Dest_MSISDN] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
       [Dest_PseudoCode] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
       [DTime] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL
)

其中再創(chuàng)建兩張結(jié)構(gòu)相同的表 這三張分別是AllReceive 存放所有provision request數(shù)據(jù)

Relation 當(dāng)前已經(jīng)存在的訂閱關(guān)系 Pause 當(dāng)前已暫停的訂閱關(guān)系

CREATE TABLE [dbo].[AllSend] (
       [ID] [int] IDENTITY (1, 1) NOT NULL ,
       [TransactionID] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
       [hRet] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
       [DTime] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL
)

這個表存放所有的返回狀態(tài)代碼

 


 

 

 


//該部分代碼基本上滿足要求,可以不作改動;
//SP收到同步請求包后,對訂購請求做相應(yīng)的訂購關(guān)系處理,并返回訂購關(guān)系同步應(yīng)答SyncOrderRelationResp
//MISC收到應(yīng)答包后,根據(jù)返回結(jié)果是否正確,在系統(tǒng)中生成正式的訂購關(guān)系或者取消訂購關(guān)系,并由1862系統(tǒng)給用戶下發(fā)訂購成功或取消成功的提醒消息
//SyncOrderRelationResp消息字段描述:
//字段名 重要性 類型 說明
//MsgType 必須 string 消息類型
//TransactionID 必須 string 該消息編號
//Version 必須 string 該接口消息的版本號,本次所有的接口消息的版本都為“1.5.0”
//hRet 必須 integer 返回值,主要錯誤如下:
//0:成功
//4007: MISC 同步開通服務(wù),但SP 端已存在訂購關(guān)系,且狀態(tài)為開通
//4008: MISC 同步開通服務(wù),且SP 端不存在訂購關(guān)系,但開通服務(wù)失敗
//4010: MISC 同步停止服務(wù), 且SP 端存在訂購關(guān)系, 但取消服務(wù)失敗
//4011: MISC 同步停止服務(wù), 但SP 端不存在訂購關(guān)系
//4012: MISC 同步暫停服務(wù), 且SP 端存在訂購關(guān)系, 但暫停服務(wù)失敗
//4013: MISC 同步暫停服務(wù), 但SP 端不存在訂購關(guān)系
//4015: MISC 同步激活服務(wù), 但SP 端已存在訂購關(guān)系, 且狀態(tài)為開通
//4016: MISC 同步激活服務(wù), 但SP 端不存在訂購關(guān)系
//其它錯誤請參見《MISC系統(tǒng)短信SP接入指南-接口改造分冊》。

xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:dsmp="http://www.monternet.com/dsmp/schemas/">

 

 

 

SyncOrderRelationResp

 

 



 

     
標(biāo)題: Re:provision接口  作者:Mouse  時間:06-02-05 16:21 
附件: 
用.asmx實現(xiàn)的provision接口
下面是用.net做的webservice的訂購接口的代碼,用不著什么卓望的API啦、socket啦、自己解析xml啦。反正出來的效果跟卓望文檔附錄里面的那個實例差不多啦。我自己沒測過。而且卓望文檔里有些問題描述的不清楚,只能蒙著做啦。反正我覺得他們有的地方設(shè)計的不太好,假如是我我不會那么設(shè)計的。

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml;
using System.Xml.Serialization;
using System.Web.Services.Description;

namespace Provision
{

[XmlRoot(Namespace="http://www.monternet.com/dsmp/schemas/")]
public class TransactionID: SoapHeader
{
 [XmlText(typeof(string))]
 public string ID;
}

public class UserID
{
 public int UserIDType;
 public string MSISDN;
 public string PseudoCode;
}

[XmlRoot(Namespace="http://aaa.com/")]
public class AddressInfo
{
 public int DeviceType;
 public string DeviceID;
}

public class SyncOrderRelationResp
{
 public string Version;
 public string MsgType;
 public int hRet;
}


///
/// Summary description for Service1.
///
[WebService(Namespace="http://12345.com.cn")]
[SoapDocumentService(RoutingStyle=SoapServiceRoutingStyle.RequestElement)]
public class Provision : System.Web.Services.WebService
{
 public Provision()
 {
  //CODEGEN: This call is required by the asp.net Web Services Designer
  InitializeComponent();
 }

 #region Component Designer generated code
 
 //Required by the Web Services Designer
 private IContainer components = null;
  
 ///
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 ///
 private void InitializeComponent()
 {
 }

 ///
 /// Clean up any resources being used.
 ///
 protected override void Dispose( bool disposing )
 {
  if(disposing && components != null)
  {
   components.Dispose();
  }
  base.Dispose(disposing); 
 }
 
 #endregion

 // WEB SERVICE EXAMPLE
 // The HelloWorld() example service returns the string Hello World
 // To build, uncomment the following lines then save and build the project
 // To test this web service, press F5

 public TransactionID transID;

 [WebMethod]
 [SoapHeader("transID", Direction=SoapHeaderDirection.InOut)]
 [SoapDocumentMethod("",RequestElementName="SyncOrderRelationReq",ResponseElementName="SyncOrderRelationResp")]

 [return: System.Xml.Serialization.SoapElementAttribute("return")]
 public void SyncOrderRelationReq(
  ref string Version ,
  ref string MsgType,
  AddressInfo Send_Address,
  AddressInfo Dest_Address,
  UserID FeeUser_ID,
  UserID DestUser_ID,
  string LinkID,
  int ActionID,
  int ActionReasonID,
  string SPID,
  string SPServiceID,
  int AccessMOde,
  byte[] FeatureStr,
  out int hRet
  )
 {
  Version="1.5.0";
  MsgType = "SyncOrderRelationResp";
  hRet = 0;
 }
}
}


看明白了不?

 

 

     
標(biāo)題: Re:provision接口  作者:Mouse  時間:06-02-05 16:21 
附件: 
例子:沒經(jīng)過MISC測試

 


xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">

xmlns="http://www.monternet.com/dsmp/schemas/">


xmlns="http://www.monternet.com/dsmp/schemas/">
1.5.0
SyncOrderRelationResp

 

 

 


//function.ASP
'--------取得XML流--------
function getdata(url)
dim Http
set Http=server.createobject("MSXML2.xmlhttp")
Http.open "GET",url,false
Http.setrequestHeader "Accept-Language","zh-cn"
Http.send()
if Http.readystate<>4 then
exit function
end if
   getdata=Http.responseBody
  
set http=nothing
if err.number<>0 then err.Clear
end function

'---------取得XML節(jié)點值,rootnode->父節(jié)點,node_name->節(jié)點名---------
function node_value(rootnode,node_name)
node_value=""
   set recordlist=objXML.getElementsByTagName(rootnode)
   node_value=recordlist(0).selectSingleNode(node_name).Text
   set recordlist=nothing
end function

'------SPServiceID->業(yè)務(wù)代碼,FeeUser_MSISDN->手機(jī)號-----------------------------
'------PROVISION接口業(yè)務(wù)處理函數(shù)

'用戶訂購服務(wù)
function user_register(SPServiceID,FeeUser_MSISDN)

end function

'用戶停止服務(wù)
function user_stop(SPServiceID,FeeUser_MSISDN)

end function

'用戶激活服務(wù)
function user_active(SPServiceID,FeeUser_MSISDN)

end function

'用戶暫停服務(wù)
function user_pause(SPServiceID,FeeUser_MSISDN)

end function

 

 

 

 


xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">

xmlns="http://www.monternet.com/dsmp/schemas/">



xmlns="http://www.monternet.com/dsmp/schemas/">
1.5.0
SyncOrderRelationResp

 


 

     
標(biāo)題: Re:provision接口  作者:Mouse  時間:06-02-05 16:22 
附件: 
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.IO;
using System.Text;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
using System.Web.sessionState;
using System.Web.Services.Protocols;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
using System.Web.Services.Description;

namespace Provision
{
///
/// dsmp 的摘要說明。
///
[WebService(Namespace="http://www.monternet.com/dsmp/schemas/")]
public class Provision : System.Web.Services.WebService
{
public Provision()
{
InitializeComponent();
}

#region 組件設(shè)計器生成的代碼

//Web 服務(wù)設(shè)計器所必需的
private IContainer components = null;

///
/// 設(shè)計器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內(nèi)容。
///
private void InitializeComponent()
{
}

///
/// 清理所有正在使用的資源。
///
protected override void Dispose( bool disposing )
{
if(disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}

#endregion

public TransactionID transID;

[WebMethod]
[SoapHeader("transID", Direction=SoapHeaderDirection.InOut)]
[SoapDocumentMethod("sim.SyncOrderRelation",RequestElementName="SyncOrderRelationReq",ResponseElementName="SyncOrderRelationResp",Use=System.Web.Services.Description.SoapBindingUse.Literal)]
[return: System.Xml.Serialization.SoapElementAttribute("return")]
public void SyncOrderRelation(
[XmlElement(Form=XmlSchemaForm.Unqualified)]
ref string Version ,
[XmlElement(Form=XmlSchemaForm.Unqualified)]
ref string MsgType,
[XmlElement(Form=XmlSchemaForm.Unqualified)]
AddressInfo Send_Address,
[XmlElement(Form=XmlSchemaForm.Unqualified)]
AddressInfo Dest_Address,
[XmlElement(Form=XmlSchemaForm.Unqualified)]
UserID FeeUser_ID,
[XmlElement(Form=XmlSchemaForm.Unqualified)]
UserID DestUser_ID,
[XmlElement(Form=XmlSchemaForm.Unqualified)]
string LinkID,
[XmlElement(Form=XmlSchemaForm.Unqualified)]
int ActionID,
[XmlElement(Form=XmlSchemaForm.Unqualified)]
int ActionReasonID,
[XmlElement(Form=XmlSchemaForm.Unqualified)]
string SPID,
[XmlElement(Form=XmlSchemaForm.Unqualified)]
string SPServiceID,
[XmlElement(Form=XmlSchemaForm.Unqualified)]
int AccessMode,
[XmlElement(Form=XmlSchemaForm.Unqualified)]
byte[] FeatureStr,
[XmlElement(Form=XmlSchemaForm.Unqualified)]
out int hRet
)
{
Version="1.5.0";
hRet = 0;
MsgType = "SynOrderRelationReq";
}
}

[XmlRoot(Namespace="http://www.monternet.com/dsmp/schemas/")]
public class TransactionID: SoapHeader
{
[XmlText(typeof(string))]
public string ID;

}

public class UserID
{
[XmlElement(Form=XmlSchemaForm.Unqualified)]
public int UserIDType;
[XmlElement(Form=XmlSchemaForm.Unqualified)]
public string MSISDN;
[XmlElement(Form=XmlSchemaForm.Unqualified)]
public byte[] PseudoCode;
}

public class AddressInfo
{
[XmlElement(Form=XmlSchemaForm.Unqualified)]
public int DeviceType;
[XmlElement(Form=XmlSchemaForm.Unqualified)]
public string DeviceID;
}
}


 



發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 卫辉市| 普陀区| 昌黎县| 新沂市| 宁明县| 綦江县| 岳阳县| 南岸区| 昭苏县| 湟中县| 新乡县| 五家渠市| 五华县| 苏尼特右旗| 浦城县| 长子县| 巩义市| 凤凰县| 阳江市| 浦县| 成都市| 永川市| 奉节县| 兴安县| 定远县| 碌曲县| 周至县| 莱西市| 乌兰县| 临桂县| 呼伦贝尔市| 花莲县| 扎鲁特旗| 花莲市| 兴和县| 全州县| 江川县| 陆丰市| 霞浦县| 门头沟区| 阿拉善左旗|