Title: RE: Need WSDL for this SOAP message
Wendy,
 
As I said, your <part> definitions must reference an <element> definition rather than a <complexType> definition. When you are using Document style, you must define the actual structure of the soap:body -- and you do that by defining a schema <element>. When using RPC style, the SOAP runtime system dynamically constructs the soap:body based on the method name and the types of the parameters.
 
So let me give you an example:
Let's assume that you want to invoke operation foobar with two parameters -- foo and bar.
 
When using Document style, your <message> definition looks something like this:
 
  <message name="foobar">
    <part name="body" element="foobar" />
  </message>
 
where element="foobar" refers to an <element> definition in the <types> section. There are multiple ways to define an element, but here's an example:
 
  <element name="foobar" type="foobarType" />
  <complexType name="foobarType">
    <element name="foo" type="string" />
    <element name="bar" type="string" />
  </complexType>
 
To ensure that Axis produces a WRAPPED service, you have to give the operation the same name as the input message:
 
  <operation name="foobar" ...>
 
When using RPC style, your <message> definition looks something like this:
 
  <message name="foobar">
    <part name="foo" type="string" />
    <part name="bar" type="string" />
  </message>
 
You define a different <part> for each parameter, and you assign each parameter a type. Since you're using simple types, you don't need to define anything in the <types> section.
 
Now, what's really interesting is that both of these definitions will produce a SOAP message that looks like this:
 
<soap:body>
   <foobar>
      <foo>foo</foo>
      <bar>bar</bar>
   </foobar>
</soap:body>
 
So getting back to your WSDL file -- you must define your <message> elements like this:
 
 <message name="SubscriptionRequest">
    <part name="SubscriptionRequest" element="typens:SubscriptionAttributes" />
 </message>
 <message name="SubscriptionResponse">
    <part name="SubscriptionResponse" element="typens:ResponseInfo" />
 </message>
 
Anne
----- Original Message -----
Sent: Thursday, July 31, 2003 7:19 PM
Subject: RE: Need WSDL for this SOAP message

Anne wrote:
> When using doc/literal, your message <part> definitions must reference an element
> definition rather than a type definition.
> So in your <types> section you also need to define an <element> definition for each message part.

I can't get this to work.  Or rather, I _can_ get it to work when referring to a complexType, but not when referring to an element.

Here's a working (WSDL2Java will run without error and generate code, I'm not yet sure it's correct but at least it does something) WSDL document:  http://www.public.asu.edu/~wsmoak/xml/webauth2.wsdl

You can see the
  <element name="SubscriptionAttributes" type="typens:subscription" />
and
  <element name="ResponseInfo" type="typens:subscriptionResponse" />
In the <types> section.

But if I try to use SubscriptionAttributes instead of subscription further down in this part:
   <message name="SubscriptionRequest"> 
     <part name="SubscriptionRequest" type="typens:subscription"/>
   </message>

Then WSDL2Java says:
G:\IRM\SharedSource\services>java org.apache.axis.wsdl.WSDL2Java -v src/wsdl/webauth2.wsdl -osrc
Parsing XML file:  src/wsdl/webauth2.wsdl
java.io.IOException: Type {urn:servicehandler-ns-type}SubscriptionAttributes is referenced but not defined.

Here's the broken-but-seemingly-correct one:   http://www.public.asu.edu/~wsmoak/xml/webauth.wsdl

In the original message, the namespace for the type attribute looked like it was external.  It had:
  <xsd:element name=PriceInfo type=xsd1:PriceInfoType">           
where xsd1 was:
  xmlns:xsd1="http://www.tlr.bis.com/rating.xsd1"
And yet PriceInfoType was defined in the same <schema>.

I'm confused again (still!), can anyone make sense of this for me?

--
Wendy Smoak
Applications Systems Analyst, Sr.
Arizona State University, PA, IRM

Reply via email to