EasyManua.ls Logo

Siemens SIMATIC MV540 H - Page 166

Siemens SIMATIC MV540 H
238 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Process interfacing via an automation system (PLC, PC)
9.7 Remote client
SIMATIC MV500
166 Operating Instructions, 06/2018, C79000-G8976-C494-01
Pseudocode example
C# Pseudocode XML Restore
byte[] buffer;
Stream newStream;
string xmlDoc = File.ReadAllText("C:\\MV400_para.xml");
ASCIIEncoding encoding = new ASCIIEncoding();
// Prepare POST data: Restore everything except the Remote Client's IP
string postData =
"[REMOTEXMLUPLOADPARA]\r\nContent-Disposition: form-data;
name=\"xmlfile\"\r\nContent-Type: text/xml\r\n\r\n" + xmlDoc + "\r\n" +
// set value to off if TCP settings shall not be imported
"[REMOTEXMLUPLOADPARA]\r\nContent-Disposition: form-data;
name=\"importtcp\"\r\n\r\non\r\n" +
// set value to off if PROFINET settings shall not be imported
"[REMOTEXMLUPLOADPARA]\r\nContent-Disposition: form-data;
name=\"importdp\"\r\n\r\non\r\n" +
// set value to off if serial communication settings shall not be imported
"[REMOTEXMLUPLOADPARA]\r\nContent-Disposition: form-data;
name=\"importserial\"\r\n\r\non\r\n" +
// set value to off if security settings shall not be imported
"[REMOTEXMLUPLOADPARA]\r\nContent-Disposition: form-data;
name=\"importsec\"\r\n\r\non\r\n" +
// set value to off if programs, calibrations, fonts and models shall not be imported
"[REMOTEXMLUPLOADPARA]\r\nContent-Disposition: form-data;
name=\"importcodes\"\r\n\r\non\r\n" +
// set value to off if Custom GUI shall not be imported
"[REMOTEXMLUPLOADPARA]\r\nContent-Disposition: form-data;
name=\"importcustomgui\"\r\n\r\non\r\n" +
// set value to on if the Remote Client's IP shall be imported (off recommended)
"[REMOTEXMLUPLOADPARA]\r\nContent-Disposition: form-data;
name=\"importremoteclientip\"\r\n\r\noff\r\n" +
"[REMOTEXMLUPLOADPARA]\r\n";
buffer = encoding.GetBytes(postData);
// Create http request
HttpWebRequest myRequest =
(HttpWebRequest)WebRequest.Create("http://192.168.0.42/xml/restore.cgi");
myRequest.Method = "POST";
myRequest.ContentType = "multipart/form-data; boundary=[REMOTEXMLUPLOADPARA]\r\n";
myRequest.ContentLength = buffer.Length;
// Send the data.
newStream = myRequest.GetRequestStream();
newStream.Write(buffer, 0, buffer.Length);
// Close stream
newStream.Close();
try
{
// Get response
HttpWebResponse myHttpWebResponse = (HttpWebResponse)myRequest.GetResponse();

Table of Contents

Related product manuals