A WS reference is the WSDL web service description imported from the specified source. WS references are not editable, but one can study their structure and the structure of data types that are used to describe parameters and returned values:
Further work with such a reference is performed using the embedded 1C programming language.
Description of a reference to the web server in the configuration tree, using the WS reference object, is convenient for rarely changing services. The web service description is once obtained, when creating the configuration object, and is stored in the configuration. So, all the requests to this reference from the embedded language will be executed rapidly.
However, in case the web service description is changed, it will be required to re-import its description into the WS reference.
Dynamic request to web services
For work with frequently changing web services, the embedded language provides a possibility to dynamically read the web service description and build its proxy. This feature also allows calling web services, the location of which will be known during the program execution. However, despite all the advantages, this operation method is slower since each time when creating the web service proxy, it will take time for receiving the web service description.
There is an example below how to create the web service proxy and use one of the web service methods:
// Create a web-service definition by WSDL-description
Definition = New WSDefinitions("http://www.host.com/mailing&WSDL");
// Creating Proxy for accessing a web service and receiving XDTO factory
Proxy = New WSProxy(Definition, "http://mail", "MailService", "Mail");
Factory = Proxy.XDTOFactory;
// Creating XDTO object - a web service call parameter
OutMessage = Factory.Create(Factory.Type("http://ordering", "Order"));
// Assigning values to the properties of XDTO object
OutMessage.addr = "firstname.lastname@example.org";
OutMessage.subject = "Message subject";
OutMessage.text = "Text subject";
// Accessing a web service operation
MessageSent = Proxy.send(OutMessage);