PreviousArticleThis is about the C # Implementation of cmpp3.0. In order to test the provision interface, I used system. net. the httpwebrequest class sends the sample XML in the MISC system Short Message SP access guide-interface transformation sub-book to the Web service, and returns the corresponding resp package (also a piece of XML) from the web service ), next we willCodePost it:
1. XML content of the syncorderrelationreq package:
Code
< 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://www.monternet.com/dsmp/schemas" > 00110318384464 </ Transactionid >
</ SOAP-ENV: Header >
< SOAP-ENV: Body >
< Syncorderrelationreq Xmlns = "Http://www.monternet.com/dsmp/schemas" >
< 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 > 1 </ Useridtype >
< Msisdn > 13456781234 </ Msisdn >
< Pseudo Code > </ Pseudo Code >
</ Feeuser_id >
< Destuser_id >
< Useridtype > 1 </ Useridtype >
< Msisdn > 13456781234 </ Msisdn >
< Pseudo Code > </ Pseudo Code >
</ Destuser_id >
< Linkid > SP </ Linkid >
< Actionid > 1 </ Actionid >
< Actionreasonid > 1 </ Actionreasonid >
< Spid > 419000 </ Spid >
< Spserviceid > -Yyxxyyxx </ Spserviceid >
< Accessmode > 3 </ Accessmode >
< Featurestr > Mta2njixndqgree = </ Featurestr >
</ Syncorderrelationreq >
</ SOAP-ENV: Body >
</ SOAP-ENV: Envelope > 2. httpwebrequest: Code
System. xml. xmldocument Doc = New Xmldocument ();
Doc. Load ( " C: \ syncorderrelationreq. xml " );
Memorystream MS = New Memorystream ();
Doc. Save (MS );
System. net. httpwebrequest R=(System. net. httpwebrequest) system. net. webrequest. Create ("Http: // localhost/websrv/dsmp. asmx");
R. Method = " Post " ;
R. contenttype = @" Text/XML; charset = UTF-8 " ;
R. headers. Add ( " Soapaction " , " \ "" + " Sim. syncorderrelation " + " \ "" );
R. Credentials = System. net. credentialcache. defaultcredentials;
Byte[] Bytes=Ms. toarray ();
R. contentlength=Bytes. length;
Stream s=R. getrequeststream ();
S. Write (bytes,0, Bytes. Length );
S. Close ();
streamreader Sr = New streamreader (R. getresponse (). getresponsestream ();
string retxml = Sr. readtoend ();
Sr. close ();
doc = New xmldocument ();
Doc. loadxml (retxml);
Doc. save ( " C :\\ syncorderrelationresp. XML " ); This is only a small example of using httpwebrequest to call the web service. You only need to save the preceding XML file as syncorderrel in drive C. In the ationreq. xml file, the results returned by the web service are saved in syncorderrelationresp. xml of drive C.