Команда предназначена для импорта контекста в домен (в случае, если контекст с данным именем уже существует, он будет обновлен; если контекст с данным именем не существует, он будет создан).

Метод http запроса

POST

Шаблон http запроса

http://host:port/commands/change_context

Код http ответа

201 – в случае успеха;
404 – в случае ошибки.

Xsd схема xml файла с запросом


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:include schemaLocation="error.xsd" />
    <xs:complexType name="valueType">
        <xs:attribute name="value" type="xs:string" use="required"/>
    </xs:complexType>
    <!-- progressType -->
    <xs:complexType name="progressType">
        <xs:sequence>
            <xs:element name="ref" minOccurs="1" maxOccurs="1" type="valueType" />
            <xs:element name="text" minOccurs="1" maxOccurs="1" type="valueType" />
        </xs:sequence>
    </xs:complexType>
    <!-- in -->
	<xs:element name="in">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="request">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="context" type="xs:base64Binary" />
						</xs:sequence>
						<xs:attribute name="domain" type="xs:string" use="required" />
					</xs:complexType>
				</xs:element>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
    <!-- out -->
    <xs:element name="out">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="error" type="errorType" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <!-- progress -->
    <xs:element name="progress" type="progressType"/>
</xs:schema>
CODE

Внимание: в base64 должен быть закодирован целевой контекст маршрутизации, т.е. xml элемент типа contextType (тип определен в context.xsd).

context.xsd:

Схема xml-файла определена в разделе Информация-о-контексте.

Пример

Запрос: http://192.168.23.34:9999/commands/change_context
Параметры:


<?xml version="1.0" encoding="UTF-8"?>
<in>
    <request domain="biysk.local">
        <context>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KICA8Y29udGV4dCB4bWxuczp4cz0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2U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SwxMH0iLz4KICAgICAgICA8Y2RwbiBuYWk9Im5hdGlvbmFsTnVtYmVyIi8+CiAgICAgIDwvYWN0aW9ucz4KICAgICAgPHJlc3VsdD4KICAgICAgICA8Y29udGludWUgY29udGV4dD0iY3R4X2NpdHlfY29tbW9uIi8+CiAgICAgIDwvcmVzdWx0PgogICAgPC9ydWxlPgogICAgPHJ1bGUgbmFtZT0idG9faXZyIj4KICAgICAgPGNvbmRpdGlvbnM+CiAgICAgICAgPGNkcG4gZGlnaXRzPSJDPz8/Ii8+CiAgICAgIDwvY29uZGl0aW9ucz4KICAgICAgPHJlc3VsdD4KICAgICAgICA8Y29udGludWUgY29udGV4dD0iY3R4X3RvX2l2ciIvPgogICAgICA8L3Jlc3VsdD4KICAgIDwvcnVsZT4KICA8L2NvbnRleHQ+Cg==</context>
    </request>
</in>
CODE

Данная base64 строка соответствует контексту:


<?xml version="1.0" encoding="UTF-8"?>
  <context xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="ecss_routing.xsd" name="ctx_from_local" np="np_240" digitmap="auto">
    <rule name="smg-5">
      <conditions>
        <cdpn digits="2408??"/>
        <final value="true"/>
      </conditions>
      <actions>
        <called sorm_ni="local" sorm_digits="{1,2,3,4,5,6}"/>
        <cdpn digits="3854{abcdef}" nai="nationalNumber"/>
      </actions>
      <result>
        <continue context="ctx_city_common"/>
      </result>
    </rule>
    <rule name="sorm_test">
      <conditions>
        <cdpn digits="240???"/>
        <final value="true"/>
      </conditions>
      <actions>
        <called sorm_ni="private" sorm_digits="{1,2,3,4,5,6}"/>
        <cdpn ni="local" nai="subscriberNumber"/>
      </actions>
      <result>
        <local/>
      </result>
    </rule>
    <rule name="normalize_subscriber_to_national">
      <conditions>
        <cgpn digits="240???" nai="subscriberNumber"/>
      </conditions>
      <actions>
        <calling sorm_ni="private" sorm_digits="73854{1,2,3,4,5,6}"/>
        <cgpn digits="3854240{def}" nai="nationalNumber"/>
      </actions>
      <result>
        <continue/>
      </result>
    </rule>
    <rule name="to_city_emergency_0x">
      <conditions>
        <cdpn digits="0(1,2,3,4,7,9)"/>
        <final value="true"/>
      </conditions>
      <actions>
        <called sorm_ni="emergency" sorm_digits="{1,2}"/>
        <cdpn ni="emergency" nai="subscriberNumber"/>
      </actions>
      <result>
        <continue context="ctx_to_ewsd"/>
      </result>
    </rule>
    <rule name="to_city_emergency_00x">
      <conditions>
        <cdpn digits="00(2,4)"/>
        <final value="true"/>
      </conditions>
      <actions>
        <called sorm_ni="emergency" sorm_digits="{1,2,3}"/>
        <cdpn ni="emergency" nai="subscriberNumber"/>
      </actions>
      <result>
        <continue context="ctx_to_ewsd"/>
      </result>
    </rule>
    <rule name="to_city_emergency_xxx">
      <conditions>
        <cdpn digits="(05?,06?,1??)"/>
        <final value="true"/>
      </conditions>
      <actions>
        <called sorm_ni="emergency" sorm_digits="{1,2,3}"/>
        <cdpn ni="emergency" nai="subscriberNumber"/>
      </actions>
      <result>
        <continue context="ctx_to_ewsd"/>
      </result>
    </rule>
    <rule name="to_emerg_8800">
      <conditions>
        <cdpn digits="8800???????"/>
        <final value="true"/>
      </conditions>
      <actions>
        <called sorm_ni="emergency" sorm_digits="7{2,3,4,5,6,7,8,9,10,11}"/>
        <cdpn ni="emergency" digits="{bcdefghijk}" nai="nationalNumber"/>
      </actions>
      <result>
        <continue context="ctx_city_common"/>
      </result>
    </rule>
    <rule name="collect_external_subscribers">
      <conditions>
        <cdpn digits="(2-5,7,9)?????"/>
      </conditions>
      <actions>
        <called sorm_ni="local" sorm_digits="{1,2,3,4,5,6}"/>
        <cdpn digits="3854{abcdef}" nai="nationalNumber"/>
      </actions>
      <result>
        <continue context="ctx_city_common"/>
      </result>
    </rule>
    <rule name="collect_international_subscribers">
      <conditions>
        <cdpn digits="810%"/>
        <final value="true"/>
      </conditions>
      <actions>
        <called sorm_ni="international" sorm_digits="{%}"/>
        <cdpn ni="international" digits="{%}" nai="internationNumber"/>
      </actions>
      <result>
        <continue context="ctx_city_common"/>
      </result>
    </rule>
    <rule name="to_BAMTS_sprav">
      <conditions>
        <cdpn digits="81??"/>
        <final value="true"/>
      </conditions>
      <actions>
        <called sorm_ni="intercity" sorm_digits="71{3,4}"/>
        <cdpn ni="intercity" digits="{bcd}" nai="nationalNumber"/>
      </actions>
      <result>
        <continue context="ctx_city_common"/>
      </result>
    </rule>
    <rule name="to_intercity_by_oper">
      <conditions>
        <cdpn digits="85???????????"/>
        <final value="true"/>
      </conditions>
      <actions>
        <called sorm_ni="intercity" sorm_digits="75{3,4,5,6,7,8,9,10,11,12,13}"/>
        <cdpn ni="intercity" digits="{bcdefghijklm}" nai="nationalNumber"/>
      </actions>
      <result>
        <continue context="ctx_city_common"/>
      </result>
    </rule>
    <rule name="collect_national_subscribers">
      <conditions>
        <cdpn digits="8??????????"/>
        <final value="true"/>
      </conditions>
      <actions>
        <called sorm_ni="intercity" sorm_digits="7{2,3,4,5,6,7,8,9,10,11}"/>
        <cdpn ni="intercity" digits="{bcdefghijk}" nai="nationalNumber"/>
      </actions>
      <result>
        <continue context="ctx_city_common"/>
      </result>
    </rule>
    <rule name="collect_zone_subscribers">
      <conditions>
        <cdpn digits="385???????"/>
      </conditions>
      <actions>
        <called sorm_ni="intercity" sorm_digits="7{1,2,3,4,5,6,7,8,9,10}"/>
        <cdpn nai="nationalNumber"/>
      </actions>
      <result>
        <continue context="ctx_city_common"/>
      </result>
    </rule>
    <rule name="to_ivr">
      <conditions>
        <cdpn digits="C???"/>
      </conditions>
      <result>
        <continue context="ctx_to_ivr"/>
      </result>
    </rule>
  </context>
CODE