Siemens SIMATIC MV550 S Operating Instructions Manual page 166

Table of Contents

Advertisement

Process interfacing via an automation system (PLC, PC)
9.7 Remote client
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
{
166
// Get response
HttpWebResponse myHttpWebResponse = (HttpWebResponse)myRequest.GetResponse();
Operating Instructions, 05/2019, C79000-G8976-C494-02
SIMATIC MV500

Advertisement

Table of Contents
loading

Table of Contents