Accessing Data Structures and Fields in Return Values

When you are creating a return-xml map with a return type that contains structured data (such as an array), public fields, or paired get and set methods, you can map the individual members just as you would with a parameter-xml map. The following example illustrates how you use the word "return" to indicate that the return value should be used. This example parses the data members of an object to individual XML elements.

    /*
     * @jws:operation
     * @jws:return-xml xml-map::
     *     <book>
     *         <title>{return.title}</title>
     *         <isbn>{return.isbn}</isbn>
     *         <price>{return.price}</price>
     *     </book>
     * ::
     */
    public BookDataControl.BookData getPriceByISBN(String ISBN)
    {
        /*
         *  Code to query a book inventory database using the BookDataControl database control and return
         *  a BookData object containing data about the book. The BookData object exposes
         *  public data members for title, isbn, and price.
         */
    }

Related Topics

Matching XML Shapes

Database Control: Using a Database from Your Web Service

Making Simple Substitutions Using Curly Braces