ExecuteServices
Prev | Chapter 2. Available Services | Next

## ExecuteServices

The ExecuteService bundles local and remote command execution operations. Its WSDL is located at http://server:port/XServices/ExecuteService?wsdl

### rExec

provides remote execution facilities with authentication based on user names and passwords.

#### Input parameters

Table 2.1. rExec input parameters

parameter | type | required | description
--- | --- | --- | ---
host | HostConnection | Yes | Host where to execute the command. See HostConnection .
command | String | No | Any command including arguments
timeout | Long | Yes | Timeout in milliseconds. The command is forcefully terminated when timeout is reached.

#### Output parameters

##### ReturnCode type

The ReturnCode type is used as the generic answer type for most of the BruteXservices operations.

The defining Java class is `net.brutex.xservices.types.ReturnCode` .

#### Schema definition

    <xs:complexType name="ReturnCodeType">
        <xs:sequence>
            <xs:element name="returnCode" type="xs:int"/>
            <xs:element minOccurs="0" name="stdOut" type="xs:string"/>
            <xs:element minOccurs="0" name="stdErr" type="xs:string"/>
            <xs:element maxOccurs="unbounded" minOccurs="0" name="propertyList" nillable="true" type="tns:antProperty"/>
        </xs:sequence>
    </xs:complexType>

#### Example XML

    		<ReturnCode
    		xmlns:ns2="http://ws.xservices.brutex.net">
    		<returnCode>0</returnCode>
    		<stdOut/>
    		<stdErr/>
    		<propertyList>

    			See
    			tns:antProperty
    			for details about the <propertyList> elements.

    		<name>key1</name>
    		<value>value1</value>
    		</propertyList>
    		<propertyList>
    		<name>key2</name>
    		<value>value2</value>
    		</propertyList>
    		</ReturnCode>

### runCommand

Run an executable with arguments on the server providing the web service. The command is run within the environment and under the user privileges of the user who is running the Tomcat Server.

#### Input parameters

Table 2.2. runCommand input parameters

parameter | type | required | description
--- | --- | --- | ---
executable | String | Yes | Command to be run. The command may be specified with full path using forward slash "/" as path separator.
argline | String | No | Any command line arguments
timeout | Long | Yes | Timeout in milliseconds. The command is forcefully terminated when timeout is reached.

#### Output parameters

##### ReturnCode type

The ReturnCode type is used as the generic answer type for most of the BruteXservices operations.

The defining Java class is `net.brutex.xservices.types.ReturnCode` .

#### Schema definition

    <xs:complexType name="ReturnCodeType">
        <xs:sequence>
            <xs:element name="returnCode" type="xs:int"/>
            <xs:element minOccurs="0" name="stdOut" type="xs:string"/>
            <xs:element minOccurs="0" name="stdErr" type="xs:string"/>
            <xs:element maxOccurs="unbounded" minOccurs="0" name="propertyList" nillable="true" type="tns:antProperty"/>
        </xs:sequence>
    </xs:complexType>

#### Example XML

    		<ReturnCode
    		xmlns:ns2="http://ws.xservices.brutex.net">
    		<returnCode>0</returnCode>
    		<stdOut/>
    		<stdErr/>
    		<propertyList>

    			See
    			tns:antProperty
    			for details about the <propertyList> elements.

    		<name>key1</name>
    		<value>value1</value>
    		</propertyList>
    		<propertyList>
    		<name>key2</name>
    		<value>value2</value>
    		</propertyList>
    		</ReturnCode>

### runCommandWithSSH

Executes a command through a SSH session.

#### Input parameters

Table 2.3. runCommandWithSSH input parameters

parameter | type | required | description
--- | --- | --- | ---
host | HostConnection | Yes | Host to connect to (see: tns:HostConnection )
command | String | No | The command to execute.
timeout | Long | Yes | Timeout in milliseconds. The command is forcefully terminated when timeout is reached.

#### Output parameters

##### ReturnCode type

The ReturnCode type is used as the generic answer type for most of the BruteXservices operations.

The defining Java class is `net.brutex.xservices.types.ReturnCode` .

#### Schema definition

    <xs:complexType name="ReturnCodeType">
        <xs:sequence>
            <xs:element name="returnCode" type="xs:int"/>
            <xs:element minOccurs="0" name="stdOut" type="xs:string"/>
            <xs:element minOccurs="0" name="stdErr" type="xs:string"/>
            <xs:element maxOccurs="unbounded" minOccurs="0" name="propertyList" nillable="true" type="tns:antProperty"/>
        </xs:sequence>
    </xs:complexType>

#### Example XML

    		<ReturnCode
    		xmlns:ns2="http://ws.xservices.brutex.net">
    		<returnCode>0</returnCode>
    		<stdOut/>
    		<stdErr/>
    		<propertyList>

    			See
    			tns:antProperty
    			for details about the <propertyList> elements.

    		<name>key1</name>
    		<value>value1</value>
    		</propertyList>
    		<propertyList>
    		<name>key2</name>
    		<value>value2</value>
    		</propertyList>
    		</ReturnCode>

#### Sample Request:

          <ws:runCommandWithSSH>
             <host>
                <hostname>ssh.brutex.net</hostname>
                <port>22</port>
                <user>roger</user>
                <password>xxx</password>
             </host>
             <command>ls /etc/</command>
             <timeout>30000</timeout>
          </ws:runCommandWithSSH>

### telnet

Runs a telnet session with an "expect shell" like behaviour.

#### Input parameters

Table 2.4. telnet input parameters

parameter | type | required | description
--- | --- | --- | ---
host | HostConnection | Yes | Host to connect to (see: tns:HostConnection)
prompt | String | No | The prompt string to expect after login. This is used to recognize when the session is open.
command | String | No | The command to execute.
expect | String | No | The prompt to expect after the command has been executed successfully.
timeout | Long | Yes | Timeout in milliseconds. The command is forcefully terminated when timeout is reached.

#### Output parameters

##### ReturnCode type

The ReturnCode type is used as the generic answer type for most of the BruteXservices operations.

The defining Java class is `net.brutex.xservices.types.ReturnCode` .

#### Schema definition

    <xs:complexType name="ReturnCodeType">
        <xs:sequence>
            <xs:element name="returnCode" type="xs:int"/>
            <xs:element minOccurs="0" name="stdOut" type="xs:string"/>
            <xs:element minOccurs="0" name="stdErr" type="xs:string"/>
            <xs:element maxOccurs="unbounded" minOccurs="0" name="propertyList" nillable="true" type="tns:antProperty"/>
        </xs:sequence>
    </xs:complexType>

#### Example XML

    		<ReturnCode
    		xmlns:ns2="http://ws.xservices.brutex.net">
    		<returnCode>0</returnCode>
    		<stdOut/>
    		<stdErr/>
    		<propertyList>

    			See
    			tns:antProperty
    			for details about the <propertyList> elements.

    		<name>key1</name>
    		<value>value1</value>
    		</propertyList>
    		<propertyList>
    		<name>key2</name>
    		<value>value2</value>
    		</propertyList>
    		</ReturnCode>

#### Sample Request:

    	 <ws:telnet>
             <host>
                <hostname>localhost</hostname>
                <port>23</port>
                <user>brosenberger</user>
                <password></password>
             </host>
             <prompt>C:\Users\brosenberger&gt;</prompt>
             <command>dir c:\temp</command>
             <expect>enberger&gt;</expect>
             <timeout>60000</timeout>
          </ws:telnet>

Prev | Up | Next
Chapter 2. Available Services | Home | FileServices