0% found this document useful (0 votes)
10 views

Sample

Uploaded by

testeuuuu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Sample

Uploaded by

testeuuuu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Sample Code

The WSDL structure links are available when you open the Web Service in a browser

http://bsestarmfdemo.bseindia.com/MFOrderEntry/MFOrder.svc?singleWsdl

Sample code for order entry in .NET

For the Method name getPassword in addition to the password an random alphanumeric passkey is sent
using the getPassword input so that the response will contain the encrypted password to be used in all
subsequent messages.

After the login request to get encrypted password use the encrypted password in subsequent Orders.

Sample String Passed for Order Entry

webOrderEntryClient.orderEntryParam("NEW", "00100120160129030807", "", "1000001",


"10000","001001", "GFG-HDFC", "R", "FRESH", "P", "5000", "", "N", "234323456", "", "Y", "", "", E123456, "Y",
"N", "N", "",
"5lEPKDkD6y/4uOciwnsBCajFaAZldwax/ltyIaMAJV7Rap7DmqL8x5gWg2dp5XA7zxdCGZj1u8I=",
"abcdef1234567890", "", "", "")

Example Code for Order Entry

namespace BSEStarMFClientApp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)


{
BSEStarMF.MFWebOrderEntryClient webOrderEntryClient = new
BSEStarMF.MFWebOrderEntryClient();
string passkey = "E23456789D";
string password = webOrderEntryClient.getPassword("111101", "xyza2000#$", passkey);
string [] bsePassArray = password.Split('|');

string response = webOrderEntryClient.orderEntryParam("NEW","000008", "", "111101", "1111",


"10001", "02-DP", "P", "FRESH", "PHYSICAL", "100000", "", "N", "", "", "Y", "", "", "E123456", "Y", "N", "N", "",
bsePassArray[1], passkey, "", "", "");
MessageBox.Show(response);
}
}
}
Sample XML for UCC Upload

XML Request for UCC Upload:

<?xml version='1.0' encoding='utf-8'?>

<soap-env:Envelope xmlns:ns1="http://tempuri.org/" xmlns:soap-


env="http://www.w3.org/2003/05/soap-envelope">

<soap-env:Header>

<ns3:Action
xmlns:ns3="http://www.w3.org/2005/08/addressing">http://tempuri.org/IMFUploadService/MFAPI</n
s3:Action>

<ns4:To
xmlns:ns4="http://www.w3.org/2005/08/addressing">http://bsestarmfdemo.bseindia.com/MFUploadS
ervice/MFUploadService.svc/Basic</ns4:To>

</soap-env:Header>

<soap-env:Body>

<ns1:MFAPI>

<ns1:Flag>02</ns1:Flag>

<ns1:UserId>1000001</ns1:UserId>

<ns1:EncryptedPassword>/OEBxWPm/KPU0j7y04lJ8RpiFrn++A8Jb2sJymYtb5lI5eNyUWCrYA==</ns1:
EncryptedPassword> <ns1:param>4|SI|01|01|Demo|||05/08/1982|M||ABCDE0000A||||P||||||SB|
50100000000000|400000006|HDFC0000001|Y||||||||||||||||||||||702, Tower, Society, Area,
|City||City|MA|400001|India|||||[email protected]|E|02|||||||||||||||9000000001</ns1:param>

</ns1:MFAPI>

</soap-env:Body>

</soap-env:Envelope>
XML Response for UCC Upload:

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"
xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header><a:Action
s:mustUnderstand="1">http://tempuri.org/IMFUploadService/MFAPIResponse</a:Action></s:Header><
s:Body><MFAPIResponse xmlns="http://tempuri.org/"><MFAPIResult>RECORD INSERTED
SUCCESSFULLY</MFAPIResult></MFAPIResponse></s:Body></s:Envelope>
Sample code for Image Upload

string result = "";


try
{
PasswordRequest obj = new PasswordRequest();

obj.UserId = TxtUserID.Text;
obj.MemberId = txtMemberId.Text;
obj.Password = TxtPassword.Text;

string url1 =
"http://bsestarmfdemo.bseindia.com/StarMFFileUploadService/StarMFFileUploadService.svc/Ge
tPassword";
var httpWebRequest = (HttpWebRequest)WebRequest.Create(url1);
httpWebRequest.Method = "POST";
httpWebRequest.ContentType = "text/json";

httpWebRequest.Credentials = CredentialCache.DefaultCredentials;

string json = JsonConvert.SerializeObject(obj);

using (var streamWriter = new


StreamWriter(httpWebRequest.GetRequestStream()))
{
streamWriter.Write(json);
streamWriter.Flush();
streamWriter.Close();
}

var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();

using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))


{
result = streamReader.ReadToEnd();
}

Response1 Response = new


JavaScriptSerializer().Deserialize<Response1>(result);

if (Response.Status == "100")
{
FileData1 Data = new FileData1();

Data.UserId = TxtUserID.Text;
Data.MemberCode = txtMemberId.Text;
Data.ClientCode = TxtClientCode.Text;
Data.EncryptedPassword = Response.ResponseString;
Data.Flag = ddlType.SelectedValue;
Data.DocumentType = ddlDocumentType.SelectedValue;
Data.FileName = FileUpload1.FileName;
Data.pFileBytes = FileUpload1.FileBytes;

WebClient client = new WebClient();


client.Headers["Content-type"] = "application/json";

MemoryStream stream = new MemoryStream();


DataContractJsonSerializer serializer = new
DataContractJsonSerializer(typeof(FileData1));
serializer.WriteObject(stream, Data);

byte[] data1 =
client.UploadData("http://bsestarmfdemo.bseindia.com/StarMFFileUploadService/StarM
FFileUploadService.svc/UploadFile", "POST", stream.ToArray());

string Result = client.Encoding.GetString(data1);

Response1 response1 = new


JavaScriptSerializer().Deserialize<Response1>(Result);

LblResponse.Text = response1.ResponseString;
}
}
catch (Exception ex)
{
throw ex;
}

You might also like