移动MISC接口1.6程序[JAVA]

转载 2006年06月21日 14:48:00
JAVA处理源码

package com.xzm.wapplatform;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.parsers.*;
import org.w3c.dom.Document;



public class ProvisionCmcc extends HttpServlet {
	public void doPost(
		HttpServletRequest request,
		HttpServletResponse response)
		throws ServletException, IOException {
			
		System.out.println("ProvisionCmcc : "+new java.util.Date());
		ServletInputStream in;
		PrintWriter out;
	
		String transactionID="";

		//in = request.getInputStream();
		//System.out.println("in.available="+in.available());
		//byte[] temp=new byte[in.available()];
		//in.read(temp);
		//String strTemp=new String(temp);
		//System.out.println("ProvisionCmcc body="+strTemp);
		/*int b=0;
		while((b=in.read())!=-1){
			System.out.println((char)b);
		}
		out = response.getWriter();
		out.println("<?xml version=/"1.0/"?>");
		out.println("<misc_command version=/"1.5/">");
		out.println("<command_name>provision_response</command_name>");
		out.println("<command_data_block>");
		out.println("<result_id>0</result_id>");
		out.println("<result_string>successful</result_string>");
		out.println("</command_data_block>");
		out.println("</misc_command>");
		out.close();*/
		try {
			in = request.getInputStream();
			
			String devicetype_send="";
			String devicetype_dest="";
			String deviceid_send="";
			String deviceid_dest="";
			String useridtype_Fee="";
			String useridtype_Dest="";
			String isdn_Fee="";
			String isdn_Dest="";
			String pseudoCode_Fee="";
			String pseudoCode_Dest="";
			String linkID="";
			String actionID="";
			String actionReasonID="";
			String spID="";
			String spServiceID="";
			String accessMode="";
			String featureStr="";

			
			DocumentBuilderFactory factory =
			DocumentBuilderFactory.newInstance();
			DocumentBuilder builder = factory.newDocumentBuilder();
			Document document = builder.parse(in);
			
			//TransactionID
			if(document.getElementsByTagName("TransactionID") != null
					&& document.getElementsByTagName("TransactionID").item(0) != null 
					&& document.getElementsByTagName("TransactionID").item(0).getFirstChild() != null){
				transactionID=document.getElementsByTagName("TransactionID").item(0).getFirstChild().getNodeValue();
				System.out.println("ProvisionCmcc get TransactionID="+transactionID);
			}else{
				System.out.println("ProvisionCmcc get TransactionID == null");
			}
			
			//DeviceType
			if(document.getElementsByTagName("DeviceType") != null
					&& document.getElementsByTagName("DeviceType").item(0) != null 
					&& document.getElementsByTagName("DeviceType").item(0).getFirstChild() != null){
				devicetype_send=document.getElementsByTagName("DeviceType").item(0).getFirstChild().getNodeValue();
				System.out.println("ProvisionCmcc get send address.DeviceType="+devicetype_send);
			}else{
				System.out.println("ProvisionCmcc get send address.DeviceType ==null");
			}			
			if(document.getElementsByTagName("DeviceType") != null
					&& document.getElementsByTagName("DeviceType").item(1) != null 
					&& document.getElementsByTagName("DeviceType").item(1).getFirstChild() != null){
				devicetype_dest=document.getElementsByTagName("DeviceType").item(1).getFirstChild().getNodeValue();
				System.out.println("ProvisionCmcc get dest address.DeviceType="+devicetype_dest);
			}else{
				System.out.println("ProvisionCmcc get dest address.DeviceType ==null");
			}
			
			
			//DeviceID
			if(document.getElementsByTagName("DeviceID") != null
					&& document.getElementsByTagName("DeviceID").item(0) != null 
					&& document.getElementsByTagName("DeviceID").item(0).getFirstChild() != null){
				deviceid_send=document.getElementsByTagName("DeviceID").item(0).getFirstChild().getNodeValue();
				System.out.println("ProvisionCmcc get send address.DeviceID="+deviceid_send);
			}else{
				System.out.println("ProvisionCmcc get send address.DeviceID ==null");
			}			
			if(document.getElementsByTagName("DeviceID") != null
					&& document.getElementsByTagName("DeviceID").item(1) != null 
					&& document.getElementsByTagName("DeviceID").item(1).getFirstChild() != null){
				deviceid_dest=document.getElementsByTagName("DeviceID").item(1).getFirstChild().getNodeValue();
				System.out.println("ProvisionCmcc get dest address.DeviceID="+deviceid_dest);
			}else{
				System.out.println("ProvisionCmcc get dest address.DeviceID ==null");
			}
			
			//UserIDType
			if(document.getElementsByTagName("UserIDType") != null
					&& document.getElementsByTagName("UserIDType").item(0) != null 
					&& document.getElementsByTagName("UserIDType").item(0).getFirstChild() != null){
				useridtype_Fee=document.getElementsByTagName("UserIDType").item(0).getFirstChild().getNodeValue();
				System.out.println("ProvisionCmcc get send FeeUser_ID.UserIDType="+useridtype_Fee);
			}else{
				System.out.println("ProvisionCmcc get send FeeUser_ID.UserIDType ==null");
			}			
			if(document.getElementsByTagName("UserIDType") != null
					&& document.getElementsByTagName("UserIDType").item(1) != null 
					&& document.getElementsByTagName("UserIDType").item(1).getFirstChild() != null){
				useridtype_Dest=document.getElementsByTagName("UserIDType").item(1).getFirstChild().getNodeValue();
				System.out.println("ProvisionCmcc get dest DestUser_ID.UserIDType="+useridtype_Fee);
			}else{
				System.out.println("ProvisionCmcc get dest DestUser_ID.UserIDType ==null");
			}
			
			//MSISDN
			if(document.getElementsByTagName("MSISDN") != null
					&& document.getElementsByTagName("MSISDN").item(0) != null 
					&& document.getElementsByTagName("MSISDN").item(0).getFirstChild() != null){
				isdn_Fee=document.getElementsByTagName("MSISDN").item(0).getFirstChild().getNodeValue();
				if(isdn_Fee==null){
					System.out.println("ProvisionCmcc get send FeeUser_ID.MSISDN ==null");
				}else{
					System.out.println("ProvisionCmcc get send FeeUser_ID.MSISDN="+isdn_Fee);
				}
			}else{
				System.out.println("ProvisionCmcc get send FeeUser_ID.MSISDN ==null");
			}			
			if(document.getElementsByTagName("MSISDN") != null
					&& document.getElementsByTagName("MSISDN").item(1) != null 
					&& document.getElementsByTagName("MSISDN").item(1).getFirstChild() != null){
				isdn_Dest=document.getElementsByTagName("MSISDN").item(1).getFirstChild().getNodeValue();
				if(isdn_Dest==null){
					System.out.println("ProvisionCmcc get dest DestUser_ID.MSISDN ==null");
				}else{
					System.out.println("ProvisionCmcc get dest DestUser_ID.MSISDN="+isdn_Dest);
				}
			}else{
				System.out.println("ProvisionCmcc get dest DestUser_ID.MSISDN ==null");
			}
			
			//PseudoCode
			if(document.getElementsByTagName("PseudoCode") != null
					&& document.getElementsByTagName("PseudoCode").item(0) != null 
					&& document.getElementsByTagName("PseudoCode").item(0).getFirstChild() != null){
				pseudoCode_Fee=document.getElementsByTagName("PseudoCode").item(0).getFirstChild().getNodeValue();
				System.out.println("ProvisionCmcc get send FeeUser_ID.PseudoCode="+pseudoCode_Fee);
			}else{
				System.out.println("ProvisionCmcc get send FeeUser_ID.PseudoCode ==null");
			}			
			if(document.getElementsByTagName("PseudoCode") != null
					&& document.getElementsByTagName("PseudoCode").item(1) != null 
					&& document.getElementsByTagName("PseudoCode").item(1).getFirstChild() != null){
				pseudoCode_Dest=document.getElementsByTagName("PseudoCode").item(1).getFirstChild().getNodeValue();
				System.out.println("ProvisionCmcc get dest DestUser_ID.PseudoCode="+pseudoCode_Dest);
			}else{
				System.out.println("ProvisionCmcc get dest DestUser_ID.PseudoCode ==null");
			}
			
			//LinkID
			if(document.getElementsByTagName("LinkID") != null
					&& document.getElementsByTagName("LinkID").item(0) != null 
					&& document.getElementsByTagName("LinkID").item(0).getFirstChild() != null){
				linkID=document.getElementsByTagName("LinkID").item(0).getFirstChild().getNodeValue();
				System.out.println("ProvisionCmcc get LinkID="+linkID);
			}else{
				System.out.println("ProvisionCmcc get LinkID ==null");
			}
			
			//ActionID
			if(document.getElementsByTagName("ActionID") != null
					&& document.getElementsByTagName("ActionID").item(0) != null 
					&& document.getElementsByTagName("ActionID").item(0).getFirstChild() != null){
				actionID=document.getElementsByTagName("ActionID").item(0).getFirstChild().getNodeValue();
				System.out.println("ProvisionCmcc get ActionID="+actionID);
			}else{
				System.out.println("ProvisionCmcc get ActionID ==null");
			}
			
			//ActionReasonID
			if(document.getElementsByTagName("ActionReasonID") != null
					&& document.getElementsByTagName("ActionReasonID").item(0) != null 
					&& document.getElementsByTagName("ActionReasonID").item(0).getFirstChild() != null){
				actionReasonID=document.getElementsByTagName("ActionReasonID").item(0).getFirstChild().getNodeValue();
				System.out.println("ProvisionCmcc get ActionReasonID="+actionReasonID);
			}else{
				System.out.println("ProvisionCmcc get ActionReasonID ==null");
			}
			
			//SPID
			if(document.getElementsByTagName("SPID") != null
					&& document.getElementsByTagName("SPID").item(0) != null 
					&& document.getElementsByTagName("SPID").item(0).getFirstChild() != null){
				spID=document.getElementsByTagName("SPID").item(0).getFirstChild().getNodeValue();
				System.out.println("ProvisionCmcc get SPID="+spID);
			}else{
				System.out.println("ProvisionCmcc get SPID ==null");
			}
			
			//SPServiceID
			if(document.getElementsByTagName("SPServiceID") != null
					&& document.getElementsByTagName("SPServiceID").item(0) != null 
					&& document.getElementsByTagName("SPServiceID").item(0).getFirstChild() != null){
				spServiceID=document.getElementsByTagName("SPServiceID").item(0).getFirstChild().getNodeValue();
				System.out.println("ProvisionCmcc get SPServiceID="+spServiceID);
			}else{
				System.out.println("ProvisionCmcc get SPServiceID ==null");
			}
			
			//AccessMode
			if(document.getElementsByTagName("AccessMode") != null
					&& document.getElementsByTagName("AccessMode").item(0) != null 
					&& document.getElementsByTagName("AccessMode").item(0).getFirstChild() != null){
				accessMode=document.getElementsByTagName("AccessMode").item(0).getFirstChild().getNodeValue();
				System.out.println("ProvisionCmcc get AccessMode="+accessMode);
			}else{
				System.out.println("ProvisionCmcc get AccessMode ==null");
			}
			
			//FeatureStr
			if(document.getElementsByTagName("FeatureStr") != null
					&& document.getElementsByTagName("FeatureStr").item(0) != null 
					&& document.getElementsByTagName("FeatureStr").item(0).getFirstChild() != null){
				featureStr=document.getElementsByTagName("FeatureStr").item(0).getFirstChild().getNodeValue();
				System.out.println("ProvisionCmcc get FeatureStr="+featureStr);
			}else{
				System.out.println("ProvisionCmcc get FeatureStr ==null");
			}
			

			out = response.getWriter();
			out.println("<?xml version=/"1.0/" encoding=/"utf-8/"?>");
			out.println("<SOAP-ENV:Envelope 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//">");
			out.println("<SOAP-ENV:Header>");
			out.println("<TransactionID xmlns=/"http://www.monternet.com/dsmp/schemas//">"+transactionID+"</TransactionID>");
			out.println("</SOAP-ENV:Header>");
			out.println("<SOAP-ENV:Body>");
			out.println("<SyncOrderRelationResp xmlns=/"http://www.monternet.com/dsmp/schemas//">");
			out.println("<Version>1.5.0</Version>");
			out.println("<MsgType>SyncOrderRelationResp</MsgType>");
			out.println("<hRet>0</hRet>");
			out.println("</SyncOrderRelationResp>");
			out.println("</SOAP-ENV:Body>");
			out.println("</SOAP-ENV:Envelope>");
			out.close();
			
			//洢
			UserOfCmcc user=new UserOfCmcc();
			//user.setUserState(strAction,strServiceID_Gate,strMID,strMDN);
			ProvisionCmccData data=new ProvisionCmccData();
			data.setVarVal(devicetype_send,devicetype_dest,deviceid_send,deviceid_dest
					,useridtype_Fee,useridtype_Dest,isdn_Fee,isdn_Dest,pseudoCode_Fee
					,pseudoCode_Dest,linkID,actionID,actionReasonID,spID
					,spServiceID,accessMode,featureStr);
			user.setUserState(data);
			
		} catch (Exception e) {
			out = response.getWriter();
			out.println("<?xml version=/"1.0/" encoding=/"utf-8/"?>");
			out.println("<SOAP-ENV:Envelope 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//">");
			out.println("<SOAP-ENV:Header>");
			out.println("<TransactionID xmlns=/"http://www.monternet.com/dsmp/schemas//">"+transactionID+"</TransactionID>");
			out.println("</SOAP-ENV:Header>");
			out.println("<SOAP-ENV:Body>");
			out.println("<SyncOrderRelationResp xmlns=/"http://www.monternet.com/dsmp/schemas//">");
			out.println("<Version>1.5.0</Version>");
			out.println("<MsgType>SyncOrderRelationResp</MsgType>");
			out.println("<hRet>0</hRet>");
			out.println("</SyncOrderRelationResp>");
			out.println("</SOAP-ENV:Body>");
			out.println("</SOAP-ENV:Envelope>");
			out.close();
			e.printStackTrace(System.err);
		}
		System.out.println("received over");
		
	}

	public void doGet(HttpServletRequest request, HttpServletResponse response)
		throws ServletException, IOException {
		doPost(request, response);
	}
}



Wap1.6业务订购数据包样例.txt
MISC1.6的业务订购关系同步的请求包:

<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope 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/">
<SOAP-ENV:Header>
    <TransactionID xmlns="http://10.1.2.122/misc/dsmp.xsd">00110100037392</TransactionID>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<SyncOrderRelationReq xmlns="http://10.1.2.122/misc/dsmp.xsd">
<Version>1.5.0</Version>
<MsgType>SyncOrderRelationReq</MsgType>
<Send_Address>
<DeviceType>0</DeviceType>
<DeviceID>0011</DeviceID>
</Send_Address>
<Dest_Address>
<DeviceType>400</DeviceType>
<DeviceID>0</DeviceID>
</Dest_Address>
<FeeUser_ID>
<UserIDType>2</UserIDType>
<MSISDN></MSISDN>
<PseudoCode>00116000000286</PseudoCode>
</FeeUser_ID>
<DestUser_ID>
<UserIDType>2</UserIDType>
<MSISDN></MSISDN>
<PseudoCode>00116000000286</PseudoCode>
</DestUser_ID>
<LinkID>SP</LinkID>
<ActionID>1</ActionID>
<ActionReasonID>1</ActionReasonID>
<SPID>919102</SPID>
<SPServiceID>0000000064</SPServiceID>
<AccessMode>2</AccessMode>
<FeatureStr></FeatureStr>
</SyncOrderRelationReq>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>



MISC1.6的业务订购关系同步的响应包:

<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:x
sd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV="http://schemas.xmlsoap.org
/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Header>
<TransactionID xmlns="http://www.monternet.com/dsmp/schemas/">
00110100037392</TransactionID>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<SyncOrderRelationResp xmlns="http://www.monternet.com/dsmp/schemas/">
<Version>1.5.0</Version>
<MsgType>SyncOrderRelationResp</MsgType>
<hRet>0</hRet>
</SyncOrderRelationResp>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

相关文章推荐

misc 1.6 provision模拟端

  • 2009-06-14 08:48
  • 440KB
  • 下载

JAVA基础【1.3】《Java核心技术1》Java程序设计概述-Java JDK1.6新特性【收集】

JDK1.6的九大新特性 一:Desktop类和SystemTray类     在JDK1.6中,AWT新增加了两个类:Desktop和SystemTray。     前者可以用来打开系统默认浏览...

MISC接口改造分册

  • 2010-01-19 11:41
  • 643KB
  • 下载

中国移动短信MISC割接

短信息中心错误与中国移动代码的对应关系。 MI::zzzz SMSC返回状态报告的状态值为EXPIRED MJ:zzzz SMSC返回状态报告的状态值为DELETED MK:zzzz...

MISC SP 业务反向取消接口

  • 2008-07-03 12:27
  • 235KB
  • 下载

移动支付misc

由于公司有想去做移动支付终端,所以学习了40多天PBOC(the People's Bank of China) 2.0 spec。后来由于种种原因而流产,在这里把自己学习的东西做个总结。此文主要...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)