File adapter requests and responses for a write action


The write action request for a File adapter can be performed on text and XML files. To write any data to a file, the data must be specified in the <line> element in the adapter request. The following table describes the elements of an adapter request for File adapter with a write action.

 Elements of an adapter request for the File adapter with a write action

The following figure shows an XML template for the File adapter request with write action for a text file.

XML template of the File adapter request with write action for text file

<fileRequest>
 <filename></filename>
 <character-set></character-set>
 <filetype></filetype>
 <lines>
   <line></line>
 </lines>
</fileRequest>

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

The following figure shows an XML template for the File adapter request with write action for an XML file.

XML template of the File adapter request with write action for an XML file

<fileRequest>
 <filename></filename>
 <character-set></character-set>
 <filetype>xml</filetype>
 <!--XML document-->
</fileRequest>

The following figure shows a sample adapter request for the File adapter with write action for a text file. Use the adapter request XML when you create a custom process by using the Call Adapter activity in TrueSight Orchestration Development Studio.

XML sample of the File adapter request with write action for a text file

<fileRequest>
 <filename>/tmp/writefile.txt</filename>
 <character-set>Shift_JIS</character-set>
   <filetype>text</filetype>
   <lines>
     <line>data to be written</line>
       ...
   </lines>
</fileRequest>

The following figure shows a sample adapter request for the File adapter with write action for an XML file. Use the adapter request XML when you create a custom process by using the Call Adapter activity in TrueSight Orchestration Development Studio.

XML sample of the File adapter request with write action for an XML file

<fileRequest>
 <filename>/tmp/writefile.txt</filename>
 <character-set>Shift_JIS</character-set>
   <filetype>xml</filetype>
 <!--The XML document to be written to the specified file-->
</fileRequest>

The write action request for a File adapter returns an adapter response containing the summary information for the request. A detailed output is not returned for this action. The following table describes the elements of a File adapter response to a request with write action.

 Elements of a File adapter response to a request with write action

The following figure illustrates an XML sample of the File adapter response to a request with write action.

XML sample of the File adapter response to a request with write action

<file-output>
 <metadata>
   <status>success or error</status>
   <error>Present only with status of 'error'</error>
   <execution-milliseconds>value</execution-milliseconds>
 </metadata>
 <output/>
</file-output>

 

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

TrueSight Orchestration Content 21.3