From GridLAB-D Wiki
Jump to: navigation, search

xml - send an Xml query to a GridLAB-D server

Synopsis

Prior to {{VERSION40}

http://server:port/xml/object:property
http://server:port/xml/object:property=value
http://server:port/xml/global
http://server:port/xml/module::global

As of Keeler (Version 4.0)

http://server:port/xml/object/property
http://server:port/xml/object/*
http://server:port/xml/object/property=value
http://server:port/xml/global
http://server:port/xml/module::global

Description

In server mode HTTP clients can read and write data entities. The replies to Xml queries are always presented in XML.

Note
In the following description GNU wget is used to illustrate the query method because it is available on all supported platforms. However, depending on the programming language used to make the queries, different query functions may be required. Some example include send ("C"), urlread (Matlab), and GetMethod (Java). Often these function calls require that an socket connection environment be established using calls such as connect ("C") or HttpClient (Java).

To read a value use the following query:

 host% wget http://hostname:6267/xml/specification

where the specification may take the forms

  • varname to read a global variable
  • module::varname to read a module variable
  • name:property to read an object property

To write data entities, use the following query:

 host% wget http://hostname:6267/xml/specification=value

where value is a string describing the value as you would in a GLM file.

Return value

The response to global variable requests will be in the form

 <globalvar>
   <name>variable_name</name>
   <value>value[ unit]</value>
 </globalvar>

The response to object property requests will be in the form

 <property>
   <object>object_name</object>
   <name>property_name</name>
   <value>value[ unit]</value>
 </property>

Errors

The HTTP 1.1 return status may be

200 - OK
The query is valid, the result could formatted and the result was returned.
202 - ACCEPTED
The query is valid and was accepted.
404 - NOT FOUND
The query was not valid or the result could not be formatted. No result was returned.

See also