Apache Axis sample client

This describes the sample client and script found in the $SYBASE/WS-15_0/samples/apacheclient directory in UNIX, or in the %SYBASE%\WS-15_0\samples\apacheclient directory in Windows.

If you know what you are interested in, just follow the appropriate link.

Prerequisites to using the sample client

To use the sample script provided, you must first ensure that you have access to a valid JRE.

Make sure the JRE variable points to your JRE by changing, if necessary, the variable definitions in all scripts in the apacheclient directory. You must use JRE version 1.3.1 or later. By default, the JRE supplied in the UNIX $SYBASE_JRE6 or Windows %SYBASE_JRE6% directory is used.

runexecute

The runexecute script executes a stored procedure or T-SQL statement on Adaptive Server Enterprise through Adaptive Server Enterprise Web Services. This sample application invokes the execute Web method.

Syntax

runexecute “web_service_URLaseServerName user_ID passwordSQLX_optionoutput_class countselect_statement

Parameters

The number of times to execute the statement. If the value of count is greater than 1, a session is created, and a persistent connection is used.

  • sql_statement

    The statement to be executed on Adaptive Server Enterprise. This statement must be delimited by double quotes.

  • Example1

    This example checks the version number for Adaptive Server Enterprise using a select statement.

    runexecute "http://johndoe-sun:8183/services/ase" johndoe-sun sa nopasswordspecified "tablename=ws" all 1 "select @@version"

    Adaptive Server Enterprise Web Services returns an XML schema, a DTD, and a result set containing the result of the executed statement.

    Example 2

    This example executes a stored procedure called booksales on the pubs2 database. The stored procedure returns the number of copies sold for a specified book title ID.

    runexecute "http://johndoe-sun:8183/services/ase" johndoe-sun sa nopasswordspecified "columnstyle=attribute,format=no,rowname=wsrow,prefix=Unnamedcol,nullstyle=attribute,header=yes" all 1 "execute booksales MC2222"

    Adaptive Server Enterprise Web Services returns an XML schema, a DTD, and a result set containing the result of the executed statement.

    This is the result set returned:

    <?xml version="1.0" ?>
     <resultset
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     <wsrow title="Silicon Valley Gastronomic Treats"
    total_sales="2032" Unnamedcol1="Books sold"/>
     </resultset>

    This is the DTD returned:

    <!ELEMENT resultset (row*)>
     <!ELEMENT row (title, total_sales, Unnamedcol1)>
     <!ELEMENT title (#PCDATA)>
     <!ELEMENT total_sales (#PCDATA)>
     <!ELEMENT Unnamedcol1 (#PCDATA)>

    This is the schema returned:

    <?xml version="1.0" ?>
     <xsd:schema
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:sqlxml="http://www.iso-standards.org/mra/9075/
    sqlx">
     <xsd:import
      namespace="http://www.w3.org/2001/XMLSchema"
      schemaLocation="http://www.iso-standards.org/mra/
    9075/sqlx.xsd" />
     <xsd:complexType
      name="RowType.resultset">
      <xsd:attribute name="title"
       type="VARCHAR_80" use="required"/>
      <xsd:attribute name="total_sales" type="INTEGER"
       use="optional"/>
      <xsd:attribute name="Unnamedcol1"
       type="VARCHAR_24" use="optional"/>
     </xsd:complexType>
     <xsd:complexType
      name="TableType.resultset">
      <xsd:sequence>
       <xsd:element name="wsrow"
        type="RowType.resultset"  minOccurs="0"
        maxOccurs="unbounded"/>
      </xsd:sequence>
     </xsd:complexType>
     <xsd:simpleType name="VARCHAR_80">
      <xsd:restriction base="xsd:string">
      <xsd:length value="80"/>
      </xsd:restriction>
     </xsd:simpleType>
     <xsd:simpleType name="INTEGER">
      <xsd:restriction base="xsd:integer">
       <xsd:maxInclusive value="2147483647"/>
       <xsd:minInclusive value="-2147483648"/>
      </xsd:restriction>
     </xsd:simpleType>
     <xsd:simpleType name="VARCHAR_24">
      <xsd:restriction base="xsd:string">
       <xsd:length value="24"/>
      </xsd:restriction>
       </xsd:simpleType>
     <xsd:element name="resultset"   type="TableType.resultset"/> 
     </xsd:schema>