provision接口

provision接口  作者:Mouse  

用Java写的,不知道你能用上不能.
这是主要的类,需要的类,都是一些工具方法,你自己写吧,主要是对soap包进行解析的.

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包进行解析封装
   * @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() ;
        
//对包进行解析,得到相应的包的内容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){
        
//业务处理
        
// 状态管理命令结果 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() ;
  }

}



 

      
标题: Re:provision接口  作者:Mouse  时间:
06 - 02 - 05   16 : 18   
附件:  
移动WAP同步关系provision接口的实现 
前阵做的小WAP项目  写的东西也挺烂的 功能就不说了 做WAP的都明白

公布出完成的PROVISION接口代码和数据表格式

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");//从容器里里获得数据库连接
               
               DTime dtime 
= new DTime();//获取当前时间

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

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

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

               Anatomy tempAnatomy 
= new Anatomy(inout, con);//将数据流放入解析器

               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 = "";// 临时订购关系的事务ID

       
private String Version = "";// 该接口消息的版本号

       
private String ActionID = "";// 服务状态管理动作代码

       
private String ActionReasonID = "";// 产生服务状态管理动作原因的代码

       
private String SPID = "";// 企业代码

       
private String SPServiceID = "";// 服务代码

       
private String AccessMode = "";// 访问模式

       
private String FeatureStr = "";// 服务订购参数

       
private String Send_DeviceType = "";// 发送方地址

       
private String Send_DeviceID = "";

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

       
private String Dest_DeviceID = "";

       
private String Fee_UserIDType = "";// 计费用户标识

       
private String Fee_MSISDN = "";

       
private String Fee_PseudoCode = "";// 记费用户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;//已存在的订购关系

       
private String[][] pause;//已经暂停的订购关系

       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);//得到当前的一该业务已订购的关系

                       System.
out.print("Reveice ");

                       String[] InfoArray 
= this.getInfoArray();//将字段组合成数组

                       DataBean.InsertTable(con, 
"AllReceive", InfoArray);// 插入同步数据库做记录

                       System.
out.println();

                       
this.sendBack(this.getHRet());//返回状态值

               }

               
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 该消息在关系表无记录 pause==null
                       
// 该消息在暂停表无记录
                       {
                       
case 1:
                       
{
                               
if (relation == null)
                               
{
                                       String[] InfoArray 
= this.getInfoArray();// 订购成功
                                       
// 插入关系表

                                       DataBean.InsertTable(con, 
"Relation", InfoArray);// 插入同步数据库做记录

                                       
return "0";
                               }

                               
else
                               
{
                                       
return "4007";// Misc同步开通服务,但sp端以存在订购关系,且状态为开通
                               }

                       }

                       
case 2:
                       
{
                               
if (relation == null)
                               
{
                                       
return "4011";// Misc同步停止服务,但sp端不存在订购关系
                               }

                               
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平台激活服务,但SP端不存在订购关系
                               }

                               
else if ((relation != null&& (pause == null))
                               
{
                                       
return "4015";// Misc平台激活服务,但SP端已存在订购关系,切状态为开通
                               }

                               
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平台暂停服务,但SP端不存在订购关系
                               }

                               
else if (pause != null)
                               
{
                                       
return "4014";// Misc平台暂停服务,但SP端存在订购关系,//切状态为暂停
                               }

                               
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);// 将发送数据插入发送记录表

               
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;

       }


}


 

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

里面涉及的一数据库操作的类


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
{
       
// 将数组按单元插入数据库 返回插入行数
       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;
               }

       }


       
// 按条件删除 返回删除的行数
       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唯数组结果
       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);// 我的数据表都有自动增长的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;

       }



}
  

 

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

数据库库中的表结构
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 


其中再创建两张结构相同的表 这三张分别是AllReceive 存放所有provision request数据

Relation 当前已经存在的订阅关系 Pause 当前已暂停的订阅关系

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 
)

这个表存放所有的返回状态代码

 


 

 

 


// 该部分代码基本上满足要求,可以不作改动;
// SP收到同步请求包后,对订购请求做相应的订购关系处理,并返回订购关系同步应答SyncOrderRelationResp
// MISC收到应答包后,根据返回结果是否正确,在系统中生成正式的订购关系或者取消订购关系,并由1862系统给用户下发订购成功或取消成功的提醒消息
// SyncOrderRelationResp消息字段描述:
// 字段名 重要性 类型 说明
// MsgType 必须 string 消息类型
// TransactionID 必须 string 该消息编号
// Version 必须 string 该接口消息的版本号,本次所有的接口消息的版本都为“1.5.0”
// hRet 必须 integer 返回值,主要错误如下:
// 0:成功
// 4007: MISC 同步开通服务,但SP 端已存在订购关系,且状态为开通 
// 4008: MISC 同步开通服务,且SP 端不存在订购关系,但开通服务失败 
// 4010: MISC 同步停止服务, 且SP 端存在订购关系, 但取消服务失败 
// 4011: MISC 同步停止服务, 但SP 端不存在订购关系 
// 4012: MISC 同步暂停服务, 且SP 端存在订购关系, 但暂停服务失败 
// 4013: MISC 同步暂停服务, 但SP 端不存在订购关系 
// 4015: MISC 同步激活服务, 但SP 端已存在订购关系, 且状态为开通 
// 4016: MISC 同步激活服务, 但SP 端不存在订购关系 
// 其它错误请参见《MISC系统短信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

 

 


 

      
标题: Re:provision接口  作者:Mouse  时间:
06 - 02 - 05   16 : 21   
附件:  
用.asmx实现的provision接口 
下面是用.net做的Webservice的订购接口的代码,用不着什么卓望的API啦、socket啦、自己解析xml啦。反正出来的效果跟卓望文档附录里面的那个实例差不多啦。我自己没测过。而且卓望文档里有些问题描述的不清楚,只能蒙着做啦。反正我觉得他们有的地方设计的不太好,如果是我我不会那么设计的。

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();
 }


 
Component Designer generated code

 
// 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;
 }

}

}



看明白了不?

 

 

      
标题: Re:provision接口  作者:Mouse  时间:
06 - 02 - 05   16 : 21   
附件:  
例子:没经过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节点值,rootnode->父节点,node_name->节点名---------
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->业务代码,FeeUser_MSISDN->手机号-----------------------------
'
------PROVISION接口业务处理函数

' 用户订购服务
function user_reGISter(SPServiceID,FeeUser_MSISDN)

end function

' 用户停止服务
function user_stop(SPServiceID,FeeUser_MSISDN)

end function

' 用户激活服务
function user_active(SPServiceID,FeeUser_MSISDN)

end function

' 用户暂停服务
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

 


 

      
标题: 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();
}


组件设计器生成的代码

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;
}

}


 

你可能感兴趣的:(visio)