Information

This site will undergo a brief period of maintenance on Friday, 18 December at 12:30 AM Central/12:00 PM IST. During a 30 minute window, site availability may be intermittent.

Adapter request and response for the Script adapter


The Script adapter does not use an action. You can include a <script> element that contains the entire script to be executed, or a <script-path> element that contains the path and the name of the script to be executed.

Warning

Note

Starting with the 20.12.02 release, the Script adapter can also execute a request when the adapter is enabled on a peer that is compliant with the Internet Protocol version 6 (IPv6).

When you use a context item as an input for an adapter request, you must enclose the adapter request in <request-data> elements. However, when you create a static request, <request-data> is not required and the adapter request starts with the <adapterName-adapter-request> element.

BMC recommends that you do not include empty elements in the adapter request because they might cause errors.

The following table describes the elements of a Script adapter request elements:


 Elements of a Script adapter request

The following figure shows an XML template for the Script adapter request with the <script> element.

XML template of the Script adapter request with the <script> element


<script-request>
 <script-type></script-type>
 <parameters></parameters>
 <return-values></return-values>
 <script></script>
</script-request>

The following figure shows an XML template for the Script adapter request with the <script-path> element.

XML template of the Script adapter request with the <script-path> element


<script-request>
 <script-type></script-type>
 <parameters></parameters>
 <return-values></return-values>
 <script-path></script-path>
</script-request>

The following figure shows an XML sample of the Script adapter request with the <script> element as Jython. Use the adapter request XML when you create a custom process by using the Call Adapter activity in BMC Atrium Orchestrator Development Studio.

XML sample of the Script adapter request with the <script> element as Jython


<script-request>
 <script-type>Jython</script-type>
 <parameters>
   <a>3</a>
   <b>4</b>
   <d>5</d>
   <e>7</e>
 </parameters>
 <return-values>
   <value>c</value>
   <value>f</value>
 </return-values>
 <script><![CDATA[c=a+b;f=d+e]]></script>
</script-request>

The following figure shows an XML sample of the Script adapter request with the <script> element as Perl. Use the adapter request XML when you create a custom process by using the Call Adapter activity in BMC Atrium Orchestrator Development Studio.

XML sample of the Script adapter request with the <script> element as Perl


<script-request>
 <script-type>Perl</script-type>
 <parameters>
   <var1>This is a test</var1>
 </parameters>
 <return-values>
   <value>out</value>
 </return-values>
 <script><![CDATA[($out)=$var1=~/\w+ \w+ \w+ (\w+)/;]]></script>
</script-request>

The following figure shows an XML sample of the Script adapter request with the <script-path> element that contains the path and the name of the script to be executed. Use the adapter request XML when you create a custom process by using the Call Adapter activity in BMC Atrium Orchestrator Development Studio.

XML sample of the Script adapter request with <script-path> element


<script-request>
 <script-type>Jython or Perl</script-type>
 <parameters>
   <a>3</a>
   <b>4</b>
   <d>5</d>
   <e>7</e>
 </parameters>
 <return-values>
   <value>c</value>
   <value>f</value>
 </return-values>
 <script-path>/usr/scripts/named_script</script-path>
</script-request>

The following figure shows an XML sample of the Script adapter request when the adapter supports Language Enablement (LE) and uses Jython scripts.

XML sample of the Script adapter request when the adapter supports LE and uses Jython scripts

ScriptLE_JythonlRequest.gif

The following figure shows an XML sample of the Script adapter request when the adapter supports LE and uses Perl scripts.

XML sample of the Script adapter request when the adapter supports LE and uses Perl scripts

ScriptLE_PerlRequest.gif

The Script adapter returns an adapter response that contains return values specified in the adapter request. The attribute for each value specifies the data type. The following table describes the elements of the Script adapter response.


 Elements of the Script adapter response

The following figure shows an XML sample for Script adapter response with the <script> element as Jython.

XML sample of the Script adapter response with the script element as Jython


<return-values>
 <c type="scalar">7</c>
 <f type="scalar">12</f>
</return-values>

The following figure shows an XML sample for Script adapter response with the <script> element as Perl.

XML sample of the Script adapter response with the script element as Perl


<return-values>
 <out type="scalar">test</out>
</return-values>

The following figure shows an XML sample of the Script adapter response when the adapter supports LE and uses Jython scripts.

XML sample of the Script adapter response when the adapter supports LE and uses Jython scripts

JythonREsponse.gif

The following figure shows an XML sample of the Script adapter request when the adapter supports LE and uses Perl scripts.

XML sample of the Script adapter response when the adapter supports LE and uses Perl scripts

Perl_Response.gif

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*

(archive) BMC Atrium Orchestrator Base Adapters 20.12.03