Web Services
  Home arrow Web Services arrow Page 2 - Use collection types with SOAP and JAX-RPC
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 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? 
Google.com  
WEB SERVICES

Use collection types with SOAP and JAX-RPC
By: developerWorks
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 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:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log 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


    Use collection types with SOAP and JAX-RPC - Listing 2. The generated XML Schema for the CustomerService class.
    ( Page 2 of 5 )

    <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="ArrayOfXSDAnyType">
      <sequence>
        <element maxOccurs="unbounded"
            minOccurs="0"
            name="item"
            nillable="true"
            type="xsd:anyType"/>
      </sequence>
       </complexType>
       <element name="getCustomersResponse">
      <complexType>
        <sequence>
          <element name="getCustomersReturn"
              nillable="true"
              type="impl:ArrayOfXSDAnyType"/>
        </sequence>
      </complexType>
       </element>
    </schema>   

    As you can see, the tooling generates a complex type definition for something called ArrayOfXSDAnyType, which is, in turn, an unbounded sequence of type <xsd:anyType>. Why didn't it generate an element of type xsd:linkedList to contain your Customers? It's because there is no xsd:linkedList. There is no xsd:hashMap, no xsd:treeSet, no xsd:vector and no xsd:stack. All of those ficticious types would have some implied functioniality associated with them beyond storing an ordered list of objects. Each language, tool or environment is at liberty to provide arbitrary collection constructs that do one of the following:

    - Implement variations of the implied functionality
    - Omit that type of collection
    - Define others not included in Java collections.

    So how do you exchange collections of objects in an interoperable fashion? The answer is using an array.

    The solution? Plain arrays...

    While some of the collection classes might actually work in your specific environment (such as a Java to Java environment), they might not work in others. Thus, we recommend against using those classes on the service interface. The only way in which collections of objects should be transferred between Web services is as an array. The WS-I Basic Profile describes how arrays (which are still a language-specific construct) are mapped to XML and how this is described in the XML Schema, making its handling interoperable across multiple environments. Listing 3 shows what the changed CustomerService JavaBean looks like:



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


    Email Marketing Software
    iContact Email Marketing Software Simplifies Online Communication.
    Internet Marketing Company
    Provider of internet marketing services to boost your site rankings.
    seo firm
    SEO firm with excellent organic results for clients in all verticals
    Survey software
    Survey Software that helps you create elegant web based surverys.



    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek