users@jax-rpc.java.net

Re: Array in document-style SOAP binding

From: Vivek Pandey <Vivek.Pandey_at_Sun.COM>
Date: Mon, 04 Oct 2004 15:03:08 -0700

WS-I BP 1.1 disallows use of soapenc:Array in a document-literal or
rpc-literal wsdl[1]. considering this requirement, jaxrpc for literal
representation of message part (doc-literal or rpc-literal wsdl) does
not recognize soapenc:Array and maps it to SOAPElement.

You can have a simpleType extended by xsd:list to get the String[] as
java parameter.

<simpleType name="StringArray">
    <list itemType="xsd:string"/>
</simpleType>

<element name="TerminalList" type="types:StringArray"/>
...
</type>

Or, you could define the complex type as

<complexType name="StringArrayType">

  <sequence>
    <element name="StringArray" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
  </sequence>
</complexType>


<element name="TerminalList" type="types:StringArrayType"/>


provided the operation is unwrapped, String[] will appear as the java
parameter.

-vivek.

----
[1]http://ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html#soapenc_Array
Oliver Jaun wrote:
>Hello
>
>I'm trying to define a document-style SOAP binding. So
>far it works. I even managed to have attachment
>support.
>
>The problem is that I now need a array as input
>parameter for one of my operations. In messages which
>are used in a document-style binding I MUST use the
>element attribute. I can't use the type attribute. I
>specified the following type and element:
><type>
>...
> <complexType name="StringArray">
>        <complexContent>
>          <restriction base="soapenc:Array">
>            <attribute ref="soapenc:arrayType"
>wsdl:arrayType="xsd:string[]"/>
>          </restriction>
>        </complexContent>
>      </complexType>
>
>      <element name="TerminalList"
>type="types:StringArray"/>
>...
></type>
>
>It compiles fine with wscompile (jwsdp 1.4, wscompile
>1.1.2) but when I look at the interface the array is
>mapped to SOAPElement.
>When I have a rpc-style binding and I specify
>type="types:StringArray" it is mapped to String[].
>
>How can I tell wscompile to map my
>TerminalList-Element to an Array?
>
>Thank a lot in advance. Following the complete WSDL:
>------------------------------------------------------
>
><?xml version="1.0" standalone="yes"?>
><definitions
>  name="FileDistributorService"
>  targetNamespace="http://ascom.com/FileDistributor"
>  xmlns="http://schemas.xmlsoap.org/wsdl/"
>  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>  xmlns:types="http://ascom.com/FileDistributor/types"
>  xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
>  xmlns:tns="http://ascom.com/FileDistributor"
>  xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd"
> 
>xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
>  >
>  
>  <types>
>    <schema
>targetNamespace="http://ascom.com/FileDistributor/types"
>        xmlns="http://www.w3.org/2001/XMLSchema"
>       
>xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd"
>        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>       
>xmlns:types="http://ascom.com/FileDistributor/types">
>      
>      <import
>namespace="http://ws-i.org/profiles/basic/1.1/xsd" 
>          schemaLocation="WS-ISwA.xsd"/>
>
>      <import
>namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
>      
>      <complexType name="StringArray">
>        <complexContent>
>          <restriction base="soapenc:Array">
>            <attribute ref="soapenc:arrayType"
>wsdl:arrayType="xsd:string[]"/>
>          </restriction>
>        </complexContent>
>      </complexType>
>      
>      <element name="TerminalList"
>type="types:StringArray"/>
>      <element name="SliceName" type="xsd:string"/>
>      <element name="UpdateId" type="xsd:string"/>
>      <element name="FileReference"
>type="wsi:swaRef"/>
>    </schema>
>  </types>
>  
>  <message name="getConfigurationRequest">
>    <part name="terminalList"
>element="types:TerminalList"/>
>  </message>
>
>  <message name="getConfigurationResponse">
>    <part name="configFile"
>element="types:FileReference"/>
>  </message>
>  
>  <message name="getUpdateRequest">
>    <part name="updateId" element="types:SliceName"/>
>    <part name="sliceName" element="types:UpdateId"/>
>  </message>
>  
>  <message name="getUpdateResponse">
>    <part name="updateRef"
>element="types:FileReference"/>
>  </message>
>  
>  <portType name="FileDistributor">
>    <operation name="getConfiguration">
>      <input message="tns:getConfigurationRequest"/>
>      <output message="tns:getConfigurationResponse"/>
>    </operation>
>    
>    <operation name="getUpdate">
>      <input message="tns:getUpdateRequest"/>
>      <output message="tns:getUpdateResponse"/>
>    </operation>
>  </portType>
>  
>  <binding name="FileDistributorBinding"
>type="tns:FileDistributor">
>    <soap:binding style="document"
>transport="http://schemas.xmlsoap.org/soap/http"/>
>    
>    <operation name="getConfiguration">
>      <input>
>        <soap:body parts="terminalList"
>use="literal"/>
>      </input>
>
>      <output>
>        <soap:body parts="configFile" use="literal"/>
>        <mime:multipartRelated/>
>      </output>
>    </operation>
>    
>    <operation name="getUpdate">
>      <input>
>        <soap:body parts="updateId" use="literal"/>
>        <soap:body parts="sliceName" use="literal"/>
>      </input>
>      
>      <output>
>        <soap:body parts="updateRef" use="literal"/>
>        <mime:multipartRelated/>
>      </output>
>    </operation>
>  </binding>
>  
>  <service name="FileDistributorService">
>    <port name="FileDistributorPort"
>binding="tns:FileDistributorBinding">
>      <soap:address
>location="http://localhost:8080/filedistributor/filedistributor"/>
>    </port>
>  </service>
></definitions>
>
>---------------------------------------------------
>additionally the included WS-ISwA.xsd:
>---------------------------------------------------
>
><?xml version="1.0" encoding="utf-8" ?> 
>
><xsd:schema
>xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>elementFormDefault="qualified"
>
>targetNamespace="http://ws-i.org/profiles/basic/1.1/xsd"
> xmlns:tns="http://ws-i.org/profiles/basic/1.1/xsd"> 
>	<xsd:simpleType name="swaRef"> 
>		<xsd:restriction base="xsd:anyURI" /> 
>	</xsd:simpleType> 
></xsd:schema>
>Regards
>
>Oliver Jaun
>
>
>	
>	
>		
>___________________________________________________________ALL-NEW Yahoo! Messenger - all new features - even more fun!  http://uk.messenger.yahoo.com
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
>For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
>
>  
>
-- 
Vivek Pandey
Web Technologies and Standards
Sun Microsystems Inc.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net