An XML-DA client application references the appropriate XMLDA.NET assembly (e.g. XmlDANet.DLL) in place of the XML-DA web service reference.
Remove a web service reference that may exist and add a reference to the XMLDA.NET assembly. This can be done manually or by using the project or class wizards. The XmlDaNet.dll is usually installed as a private assembly. This copies the assembly into the project directory and makes deployment simple. The files in the project output directory can simply be copied to another computer. The XmlDaNet.dll assembly is strong named and may be installed into the global assembly cache for simpler reference.
If an existing XML-DA client application is changed to XMLDA.NET then the name of the server access class may need to be adapted to one of the class names given below.
With XMLDA.NET access to XML-DA and OPC DA V2 servers is supported through the same interface.
Server access classes
Server access may be made through two classes. See chapter Class Structure for a class structure diagram.
XmlServer | This class inherits from the class OpcXmlDA and offers some additional helper methods. |
OpcXmlDA | This class is compatible with the XML-DA .Net web service proxy stub and supports the methods defined in the XML-DA specification. The XML-DA specification describes the SOAP messages exchanged between client and server. .Net creates teh proxy stub class from the XMl-DA WSDL document. The XMLDA.NET help documentation describes the methods and data classes. The XML-DA specification may be consulted for overview and behavioral explanations. |
The client has to instantiate one of these classes to get access to the server.
Sample: | C# VB |
XmlServer Srv = new XmlServer(); Dim Srv As XmlServer = new XmlServer() |
or | C# VB |
OpcXmlDA Srv = new OpcXmlDA(); Dim Srv as OpcXmlDA = new OpcXmlDA() |
In a next step the URL has to be defined depending on the type of server to be accessed.
XML-DA web service access
The URL has to start with http:
and has the form http://localhost/webdir/service.asmx
The URL has to be set before the first method is called. Depending on the security settings it may also be necessary to define credentials.
URL | Example: XmlServer Srv = new XmlServer(); Srv.Url = "http://comp123/webdir123/XmlDAServer.asmx"; |
Credentials
|
By default the web service access uses Anonymous Access. To select another mode the credentials need to be set. For Integrated AuthenticationMode: For Basic AuthenticationMode: |
WCF XML-DA web service access
The URL starts with http: or net.tcp: or net.pipe: depending on the transport defined in the endpoint configuration.
The URL and the endpoint have to be set before the first server access.
URL | Example: XmlServer Srv = new XmlServer(); Srv.Url = http://comp123/webdir123/XmlDAServer.svc; Srv.EndPointName = "basicHTTP"; |
Configuration
|
All communication configuration settings are in the application configuration file (xxx.exe.config or web.config for web applications) |
OPC-DA server access
For OPC-DA V2 server access the server's DCOM ProgID is defined in the URL. The ProgId may be extended with computer name and access information.
When only the ProgId is defined the the OPC server is accessed using the .Net COM InterOp services.
For access to remote OPC servers and to be able to define credentials a computer name need to be specified.
The format is:
a) the ProgId only for local OPC DA-Servers. E.g. Srv.Url = "Advosol.SimDAServer.1"";
b) with computer name for remote servers. E.g. Srv.Url = "//I-3000/Advosol.SimDAServer.1";
c) with access definitions. E.g. Srv.Url = "//I-3000/Advosol.SimDAServer.1?User=xx&Password=xx&Domain=xx";
d) optionally the definition can be preceded with opda: E.g. Srv.Url = "opcda://I-3000/Advosol.SimDAServer.1";