3. ExecuteServices

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

3.1. rExec

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

3.1.1. Input parameters

Table 2.1. rExec input parameters

parametertyperequireddescription
hostHostConnectionYes Host where to execute the command. See HostConnection .
commandStringNoAny command including arguments
timeoutLongYesTimeout in milliseconds. The command is forcefully terminated when timeout is reached.

3.1.2. Output parameters

3.1.2.1. 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>
	

3.2. 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.

3.2.1. Input parameters

Table 2.2. runCommand input parameters

parametertyperequireddescription
executableStringYesCommand to be run. The command may be specified with full path using forward slash "/" as path separator.
arglineStringNoAny command line arguments
timeoutLongYesTimeout in milliseconds. The command is forcefully terminated when timeout is reached.

3.2.2. Output parameters

3.2.2.1. 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: Start Windows Command Interpreter and print "Hello World" to STDOUT.

	<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.xservices.brutex.net">
   <soapenv:Header/>
   <soapenv:Body>
      <ws:runCommand>
         <executable>c:/windows/system32/cmd.exe</executable>
         <argline>/C "echo Hallo Welt!"</argline>
         <timeout>3000</timeout>
      </ws:runCommand>
   </soapenv:Body>
</soapenv:Envelope>
	

Sample response:

	<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <ns2:runCommandResponse xmlns:ns2="http://ws.xservices.brutex.net">
         <return>
            <returnCode>0</returnCode>
            <stdOut/>
            <stdErr/>
            <propertyList>
               <name>ExecuteService.result</name>
               <value>0</value>
            </propertyList>
            <propertyList>
               <name>ExecuteService.stdout</name>
               <value>Hallo Welt!</value>
            </propertyList>
            <propertyList>
               <name>ExecuteService.stderr</name>
               <value/>
            </propertyList>
         </return>
      </ns2:runCommandResponse>
   </soap:Body>
</soap:Envelope>

Sample request: Start notepad.exe and close it after 15 seconds.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.xservices.brutex.net">
   <soapenv:Header/>
   <soapenv:Body>
      <ws:runCommand>
         <executable>c:/windows/system32/notepad.exe</executable>
         <argline></argline>
         <timeout>15000</timeout>
      </ws:runCommand>
   </soapenv:Body>
</soapenv:Envelope>

3.3. runCommandWithSSH

Executes a command through a SSH session.

3.3.1. Input parameters

Table 2.3. runCommandWithSSH input parameters

parametertyperequireddescription
hostHostConnectionYes Host to connect to (see: tns:HostConnection )
commandStringNoThe command to execute.
timeoutLongYesTimeout in milliseconds. The command is forcefully terminated when timeout is reached.

3.3.2. Output parameters

3.3.2.1. 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>
	

3.3.3. 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>
	

3.4. telnet

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

3.4.1. Input parameters

Table 2.4. telnet input parameters

parametertyperequireddescription
hostHostConnectionYesHost to connect to (see: tns:HostConnection)
promptStringNoThe prompt string to expect after login. This is used to recognize when the session is open.
commandStringNoThe command to execute.
expectStringNoThe prompt to expect after the command has been executed successfully.
timeoutLongYesTimeout in milliseconds. The command is forcefully terminated when timeout is reached.

3.4.2. Output parameters

3.4.2.1. 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>
	

3.4.3. 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>