users@jax-rpc.java.net

RE: document/literal parameters

From: Anne Thomas Manes <anne_at_manes.net>
Date: Thu, 16 Sep 2004 21:32:44 -0400

First of all, you don't specify "parameters" when using document/literal.
Instead you define an element, which is the only child of the <env:Body>.

I have a couple of blog entries that discuss document/literal and
wrapped/literal here:
http://www.burtongroup.com/weblogs/annethomasmanes/archives/cat_apache_axis.
html

(they pertain to Axis, but the WSDL definitions are the same)

There are some basic rules you must follow when defining a document/literal
WSDL:

1- You must define the input and output elements.
2- Your input and output <wsdl:message> definitions must contain only one
body part, and those parts must reference your input and output elements.
3- You don't specify a parameterOrder attribute in your <wsdl:operation>
definition.
4- Your <wsdlsoap:body> definitions should contain only "name" and "use"
attributes. They should not contain "encodingStyle" or "namespace"
attributes.

I don't know the details of how wscompile generates code, but your input
element looks okay, except that the WS-I Basic Profile tells you not to use
the "ArrayOf_" naming convention.

You don't *need* to name the complex type unless you want to be able to use
it in multiple situations (and if you don't I'm pretty sure that wscompile
won't generate a class for it) so you might try defining it like this:

<element name="ClearContentRequest">
  <complexType>
    <sequence>
      <element name="strings" type="xsd:string"
         minOccurs="0" maxOccurs="unbounded"/>
    </sequence>
   </complexType>
</element>
-----
   <wsdl:message name="clearContentRequest">
      <wsdl:part name="in0" element="impl:ClearContentRequest"/>
   </wsdl:message>
   <wsdl:message name="clearContentResponse"/>
-----
<wsdl:operation name="clearContent">
   <wsdl:input message="impl:clearContentRequest"
       name="clearContentRequest"/>
   <wsdl:output message="impl:clearContentResponse"
       name="clearContentResponse"/>
   <wsdl:fault message="impl:DIException" name="DIException"/>
</wsdl:operation>
------
<wsdl:operation name="clearContent">
   <wsdlsoap:operation soapAction=""/>
   <wsdl:input name="clearContentRequest">
      <wsdlsoap:body use="literal"/>
   </wsdl:input>
   <wsdl:output name="clearContentResponse">
      <wsdlsoap:body use="literal"/>
   </wsdl:output>
   <wsdl:fault name="DIException">
      <wsdlsoap:fault use="literal"/>
   </wsdl:fault>
</wsdl:operation>

Note that if you want to use the wrapped convention, then you need to give
your input element the same name as the operation, and your message part
names should be "parameters". That WSDL would look like this:

<element name="clearContent">
  <complexType>
    <sequence>
      <element name="strings" type="xsd:string"
         minOccurs="0" maxOccurs="unbounded"/>
    </sequence>
   </complexType>
</element>
-----
   <wsdl:message name="clearContentRequest">
      <wsdl:part name="parameters" element="impl:clearContent"/>
   </wsdl:message>
   <wsdl:message name="clearContentResponse"/>
-----
<wsdl:operation name="clearContent">
   <wsdl:input message="impl:clearContentRequest"
       name="clearContentRequest"/>
   <wsdl:output message="impl:clearContentResponse"
       name="clearContentResponse"/>
   <wsdl:fault message="impl:DIException" name="DIException"/>
</wsdl:operation>
------
<wsdl:operation name="clearContent">
   <wsdlsoap:operation soapAction=""/>
   <wsdl:input name="clearContentRequest">
      <wsdlsoap:body use="literal"/>
   </wsdl:input>
   <wsdl:output name="clearContentResponse">
      <wsdlsoap:body use="literal"/>
   </wsdl:output>
   <wsdl:fault name="DIException">
      <wsdlsoap:fault use="literal"/>
   </wsdl:fault>
</wsdl:operation>

- Anne

-----Original Message-----
From: Bill Keicher [mailto:wkeicher_at_endeca.com]
Sent: Thursday, September 16, 2004 8:12 PM
To: 'users_at_jax-rpc.dev.java.net'
Subject: document/literal parameters

How do you specify in document/literal wsdl that a parameter is an array?
Along those same lines, how would you specify multiple parameters to a
document/literal defined method?

I've tried defining the following with mixed results depending on the tool I
use to generate client side code, sometimes its an array, sometimes it's a
class (ArrayOf_xsd_string) that contains an array. I have similar problems
with mehtods that take in multiple parameters...
------
<complexType name="ArrayOf_xsd_string">
    <sequence>
      <element name="strings" type="xsd:string" maxOccurs="unbounded"
nillable="true"/>
    </sequence>
   </complexType>
<element name="ClearContentRequest" type="impl:ArrayOf_xsd_string"/>
-----
   <wsdl:message name="clearContentRequest">
      <wsdl:part name="in0" element="impl:ClearContentRequest"/>
   </wsdl:message>
   <wsdl:message name="clearContentResponse"/>
-----
<wsdl:operation name="clearContent" parameterOrder="in0">
         <wsdl:input message="impl:clearContentRequest"
name="clearContentRequest"/>
         <wsdl:output message="impl:clearContentResponse"
name="clearContentResponse"/>
         <wsdl:fault message="impl:DIException" name="DIException"/>
      </wsdl:operation>
------
<wsdl:operation name="clearContent">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="clearContentRequest">
            <wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:com.endeca.service.dataindexing" use="literal"/>
         </wsdl:input>
         <wsdl:output name="clearContentResponse">
            <wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:com.endeca.service.dataindexing" use="literal"/>
         </wsdl:output>
         <wsdl:fault name="DIException">
            <wsdlsoap:fault
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" name="DIException"
namespace="urn:com.endeca.service.dataindexing" use="literal"/>
         </wsdl:fault>
      </wsdl:operation>

thanks,
bill

-------------------------------
William Keicher
Software Engineer
Endeca

T: 617-621-7250
F: 617-577-7766
E: wkeicher_at_endeca.com
-------------------------------


This email message and any attachments are confidential to Endeca. If you
are not the intended recipient, please notify Endeca immediately -- by
replying to this message or by sending an email to: legal_at_endeca.com -- and
destroy all copies of this message and any attachments. Thank you.

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


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