The following are common operations that can be closed to a class. (In fact, this code exists on the Internet)
<?xml version="1.0" encoding="utf-8"?>
<ProvBOSS>
<BIPCode>BIP9B985</BIPCode>
<BIPVer>0100</BIPVer>
<ActivityCode>T9000985</ActivityCode>
<ActionCode>0</ActionCode>
<ProcID></ProcID>
<TransIDO></TransIDO>
<ProcessTime></ProcessTime>
<TestFlag>1</TestFlag>
<MsgSender></MsgSender>
<MsgReceiver></MsgReceiver>
<SvcContVer>0100</SvcContVer>
<SvcCont>
<![CDATA[
<BizProcReq>
<OprNumb>21542</OprNumb>
<MSISDN>13800000000</MSISDN>
<IMSI>235625485</IMSI>
<OprCode>06</OprCode>
<EfftTime>20081122000000</EfftTime>
<Extra></Extra>
</BizProcReq>
]]>
</SvcCont>
</ProvBOSS>
// Load as an XML document
Xmldocument xml = new xmldocument ();
XML. loadxml (reqdata );
Xmlnode root = xml. selectsinglenode ("/provboss ");
# Region request processing process
// Change the transaction action code 0: request, 1: Response
Xmlnode actioncode = xml. selectsinglenode ("/provboss/actioncode ");
Actioncode. innertext = "1 ";
// Add the serial number of the local transaction
Xmlelement transidh = xml. createelement ("transidh ");
Transidh. innertext = datetime. Now. tostring ("yyyymmddhhmmss ");
Xmlnode transido = xml. selectsinglenode ("/provboss/transido ");
Root. insertafter (transidh, transido );
// Change the time when the responder processes the request
Xmlnode processtime = xml. selectsinglenode ("/provboss/processtime ");
Processtime. innertext = datetime. Now. tostring ("yyyymmddhhmmss ");
// Create a response/error message
Xmlelement rsptype = xml. createelement ("rsptype ");
Xmlelement rspcode = xml. createelement ("rspcode ");
Xmlelement rspdesc = xml. createelement ("rspdesc ");
Xmlelement responsenode = xml. createelement ("response ");
Responsenode. appendchild (rsptype );
Responsenode. appendchild (rspcode );
Responsenode. appendchild (rspdesc );
Rsptype. innertext = "0 ";
Rspcode. innertext = "0000 ";
Rspdesc. innertext = "success ";
Root. insertafter (responsenode, processtime );
////////////////////////////////////
// Request/response content
////////////////////////////////////
Xmlnode svccont = xml. selectsinglenode ("/provboss/svccont ");
If (svccont. firstchild. nodetype = xmlnodetype. CDATA)
{
// Obtain the value in servicecontent
Xmldocument xmlsvccont = new xmldocument ();
Xmlsvccont. loadxml (svccont. firstchild. value );
String oprnumb = xmlsvccont. selectsinglenode ("bizprocreq/oprnumb"). innertext;
String msisdn = xmlsvccont. selectsinglenode ("bizprocreq/msisdn"). innertext;
String imsi = xmlsvccont. selectsinglenode ("bizprocreq/imsi"). innertext;
String oprcode = xmlsvccont. selectsinglenode ("bizprocreq/oprcode"). innertext;
String effttime = xmlsvccont. selectsinglenode ("bizprocreq/effttime"). innertext;
// Create a response style
Xmlelement oprnumbnode = xml. createelement ("oprnumb ");
Xmlelement msisdnnode = xml. createelement ("msisdn ");
Xmlelement efftflagnode = xml. createelement ("efftflag ");
Xmlelement rsltnode = xml. createelement ("rslt ");
Xmlelement bizprocrsp = xml. createelement ("bizprocrsp ");
Bizprocrsp. appendchild (oprnumbnode );
Bizprocrsp. appendchild (msisdnnode );
Bizprocrsp. appendchild (efftflagnode );
Bizprocrsp. appendchild (rsltnode );
Oprnumbnode. innertext = oprnumb;
Msisdnnode. innertext = msisdn;
Efftflagnode. innertext = "0 ";
Rsltnode. innertext = "";
// Db operation
Try
{
//
}
Catch (exception ex)
{
}
// Modify the value of servicecontent to return the Response Message
Svccont. firstchild. value = bizprocrsp. outerxml;
}
Else
{
//
Rsptype. innertext = "1 ";
Rspcode. innertext = "0004 ";
Rspdesc. innertext = "Incorrect service content Message format ";
}
# Endregion
// Return data to the boss
Resdata = xml. outerxml;