Web Services
  Home arrow Web Services arrow Page 3 - Use collection types with SOAP and JAX...
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
OLM
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
WEB SERVICES

Use collection types with SOAP and JAX-RPC
By: developerWorks
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 2 stars2 stars2 stars2 stars2 stars / 4
    2004-12-22

    Table of Contents:
  • Use collection types with SOAP and JAX-RPC
  • Listing 2. The generated XML Schema for the CustomerService class.
  • Listing 3. The CustomerService class using a simple array.
  • Create a wrapper interface
  • Resources

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
     
    ADVERTISEMENT

    The Web Buyer's Guide is your best source for white papers on a wide range of IT products and services. This Week's Featured White Papers: Protecting Web Applications from Attack and Misuse by Citrix Systems

    Use collection types with SOAP and JAX-RPC - Listing 3. The CustomerService class using a simple array.
    (Page 3 of 5 )

    public class TheCustomerService {
      public Customer[] getCustomers(String queryString) {
        Customer customer1, customer2;
        /* ... retrieve customers for query ... */
        /* create an array large enough to hold the result set */
        Customer[] customers = new Customer[2];
        /* iterate over the result set assigning to the array */
        customers[0] = customer1;
        customers[1] = customer2;
        return customers;
      }
    }

    As you can see, we have replaced the LinkedList with an array of type Customer. Listing 4 shows the resulting XML Schema in the WSDL definition:

    Listing 4. The updated XML Schema for the CustomerService class.

    <schema elementFormDefault="qualified"
      targetNamespace=http://pack
      xmlns=http://www.w3.org/2001/XMLSchema
      xmlns:apachesoap="http://xml.apache.org/xml-soap"
      xmlns:impl="http://pack" xmlns:intf="http://pack"
      xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
      <element name="getCustomers">
        <complexType>
          <sequence>
            <element name="queryString"
                nillable="true"
                type="xsd:string"/>
          </sequence>
        </complexType>
      </element>
      <complexType name="Customer">
        <sequence>
          <element name="customerID"
              nillable="true"
              type="xsd:string"/>
        </sequence>
      </complexType>
      <element name="getCustomersResponse">
        <complexType>
          <sequence>
            <element maxOccurs="unbounded"
              name="getCustomersReturn"
              type="impl:Customer"/>
          </sequence>
        </complexType>
      </element>
    </schema>


    This resulting schema definition and the SOAP message that is generated for this service are language-neutral and follow the WS-I Basic Profile.

    More Web Services Articles
    More By developerWorks


     

       

    WEB SERVICES ARTICLES

    - Dynamic Data Analysis on the Web-a Design Ap...
    - Use collection types with SOAP and JAX-RPC
    - Blogging Away To Glory (A bBlog Primer)
    - Introduction to Service Oriented Architectur...
    - Connecting Smart Devices on the Internet
    - An Embeddable Standards Compliant Web Servic...

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway