欢迎加入工业 IT !
对于这些技术,最好的选择是“AspenTech SqlPlus ODBC 驱动程序”。
话虽如此,您正在谈论的是相当旧的 IP21 服务器上的端点,所以我想它类似于http://.../SQLPlusWebService/SQLplusWebService.asmx。
在这种情况下,它是 SqlPlus 周围的 SOAP 包装器:您不必安装 Windows ODBC 驱动程序……但您仍然需要学习 SqlPlus 语法。
如需更多信息,您可以咨询 AspenTech,也可以安装 SqlPlus 客户端“Aspen SqlPlus”,并查看“C:\Program Files (x86)\AspenTech\InfoPlus.21\db21\ 中的帮助文件”代码\ipsqlplus.chm"
编辑:这是 C# 中的一个示例,用于列出所有记录:
static void Main(string[] args)
{
const string SERVER_HOST = "SERVERHOST";
const string SERVER_URL = "http://{0}/SQLPlusWebService/SQLplusWebService.asmx";
const string SOAP12 =
"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
+ "<soap12:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\">"
+ "<soap12:Body>"
+ "<ExecuteSQL xmlns=\"http://www.aspentech.com/SQLplus.WebService/\">"
+ "<command>{0}</command>"
+ "</ExecuteSQL>"
+ "</soap12:Body>"
+ "</soap12:Envelope>";
const string SQLPLUS_COMMAND_ALLRECORDS =
"SELECT * FROM all_records";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(
string.Format(SERVER_URL, SERVER_HOST));
// If required by the server, set the credentials.
request.Credentials = CredentialCache.DefaultCredentials;
request.ContentType = "application/soap+xml; charset=utf-8";
request.Method = "POST";
XmlDocument soapEnvelopeDocument;
soapEnvelopeDocument = new XmlDocument();
soapEnvelopeDocument.LoadXml(string.Format(SOAP12, SQLPLUS_COMMAND_ALLRECORDS));
byte[] bytes;
bytes = Encoding.UTF8.GetBytes(soapEnvelopeDocument.OuterXml);
request.ContentLength = bytes.Length;
using (Stream stream = request.GetRequestStream())
{
stream.Write(bytes, 0, bytes.Length);
}
// Get the response.
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
// Display the status.
Console.WriteLine(response.StatusDescription);
// Get the stream containing content returned by the server.
Stream dataStream = response.GetResponseStream();
// Open the stream using a StreamReader for easy access.
StreamReader reader = new StreamReader(dataStream);
// Read the content.
string responseFromServer = reader.ReadToEnd();
// Display the content.
Console.WriteLine(responseFromServer);
// Cleanup the streams and the response.
reader.Close();
dataStream.Close();
response.Close();
}