关闭

移动MISC接口1.6程序[JAVA]

1009人阅读 评论(0) 收藏 举报
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>
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:331155次
    • 积分:4620
    • 等级:
    • 排名:第6325名
    • 原创:81篇
    • 转载:153篇
    • 译文:1篇
    • 评论:43条
    最新评论