You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Dan Ciarniello <dc...@cityxpress.com> on 2004/10/09 00:07:30 UTC

WSDL2Java and Basic Profile

I am trying to follow the advice that I've seen in this mailing list by 
handcrafting a WSDL and feeding it to WSDL2Java.  I'm also trying to 
make it conform to the WS-I Basic Profile requirements.  Unfortunately, 
I'm running into problems.

When I run WSDL2Java, I this:

WSDLException (at 
/wsdl:definitions/wsdl:binding/wsdl:operation/wsdl:input): 
faultCode=INVALID_WSDL: Encountered illegal extension attribute 
'message'. Extension attributes must be in a namespace other than WSDL's.:

There may be a problem with my WSDL (see below) but I also grabbed the 
WS-I sample WSDL found at

http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html#Namespaces_for_Children_of_Part_Accessors

This gives exactly the same error.

It seems a bit odd that a "CORRECT" WSDL from the WS-I site should not 
be considered valid.

Here's my WSDL:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://cityxpress.com/external"
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
  xmlns:tns="http://cityxpress.com/external">

  <wsdl:types>
    <xsd:schema targetNamespace="http://cityxpress.com/external">
      <xsd:complexType name="CXObjectType">
        <xsd:sequence>
          <xsd:element name="thedate" type="xsd:dateTime"/>
          <xsd:element name="avalue" type="xsd:int"/>
        </xsd:sequence>
      </xsd:complexType>
    </xsd:schema>
  </wsdl:types>
  <wsdl:message name="getObjectRequest">
    <wsdl:part name="id" type="xsd:string"/>
  </wsdl:message>
  <wsdl:message name="getObjectResponse">
    <wsdl:part name="getObjectReturn" type="tns:CXObjectType"/>
  </wsdl:message>
  <wsdl:portType name="XMTestPortType">
    <wsdl:operation name="getObject">
      <wsdl:input message="tns:getObjectRequest"/>
      <wsdl:output message="tns:getObjectResponse"/>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="XMTestBinding" type="tns:XMTestPortType">
    <soap:binding style="document"
      transport="http://schemas.xmlsoap.org/soap/http/"/>
    <wsdl:operation name="getObject">
      <soap:operation soapAction=""/>
      <wsdl:input message="tns:getObjectRequest">
        <soap:body namespace="http://cityxpress.com/external" 
use="literal"/>
      </wsdl:input>
      <wsdl:output message="tns:getObjectResponse">
        <soap:body namespace="http://cityxpress.com/external" 
use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="XMTest">
    <wsdl:port name="XMTest" binding="tns:XMTestBinding">
      <soap:address location="http://localhost:8080/v01/XMTest"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

If anyone can point out the problem, it would be greatly appreciated.

Thanks,
Dan.



RE: WSDL2Java and Basic Profile

Posted by Anne Thomas Manes <an...@manes.net>.
Please file a bug report.
Thanks!

-----Original Message-----
From: Dan Ciarniello [mailto:dciarniello@cityxpress.com] 
Sent: Thursday, October 14, 2004 2:56 PM
To: axis-user@ws.apache.org
Subject: Re: WSDL2Java and Basic Profile

Anne Thomas Manes wrote:

>Dan,
>
>The child elements (<id>, <thedate>, and <avalue>) are defined as local
>elements (defined inside a complex type), and therefore must be
unqualified.
>Therefore the elements must include the "no default" namespace definitions
>(xmlns=""). If you prefer to make these element qualified, you can add the
>elementFormDefault="qualified" attribute to the <schema> definition. But
>this issue really shouldn't make a difference. 
>
>Anne
>  
>
Anne,

Thank you!  Thank you!  Thank you!

That solves a major headache for me.

You may be right in that it shouldn't really make a difference but I 
have found a couple of places where it seems to.

.NET was having problems with the responses and, as mentioned 
previously, so was the WSDL2Java-generated client code.  Adding the 
elementFormDefault="qualified" fixed the problem in both cases.

I think the reason that it makes a difference is that there are a couple 
of bugs in Axis 1.2 (and probably .NET, as well).  The first bug is that 
the automatically generated WSDL has elementFormDefault="qualified" on 
the schema regardless of whether the original WSDL contains it.  Even if 
it does, the value is ignored.  To see this, take the WSDL given below 
and generate and deploy the service then look at the auto-generated 
WSDL.  It will have elementFormDefault="qualified" on the schema 
attribute.  Add elementFormDefault="unqualified" to the WSDL and 
re-deploy.  The auto-generated WSDL will still have 
elementFormDefault="qualified".  Note that deploy.wsdd does properly 
reflect the value of elementFormDefault so the service does do the 
expected.  What this bascally means is that clients based on the 
auto-generated WSDL won't necessarily work properly because there is a 
mismatch between what the WSDL says and what the server produces.  (I 
wonder how much of the .NET interoperability problems is due to this).

Another problem that I have found is with WSDL2Java which I believe has 
hidden the above problem.  The WSDL given below causes WSDL2Java to 
produce a method signature like so:

public void getObject(String getObjectTypeId, CalendarHolder 
CXObjectTypeThedate, holders.IntHolder CXObjectTypeAvalue)

and the parameters specified as OUT parameters in deploy.wsdd.

The WSDL can be modified so that this signature is produced instead:

public CXObjectType getObject(String id).

WSDL2Java-produced client code does not work in the first case but does 
in the second.  This leads me to believe that WSDL2Java is ignoring (or 
assuming a value of "unqualified") the elementFormDefault attribute in 
the second case but not in the first.

I hope that what I've described above is clear.  Depending on comments 
received, I will post 1 or 2 bugs to JIRA.

Dan.

>-----Original Message-----
>From: Dan Ciarniello [mailto:dciarniello@cityxpress.com] 
>Sent: Wednesday, October 13, 2004 6:36 PM
>To: axis-user@ws.apache.org
>Subject: Re: WSDL2Java and Basic Profile
>
>Anne,
>
>Thanks for the info.  I had to make a few minor changes to what you sent 
>(I've attached a corrected version below) but that gave me enough to 
>work with.  Except for one problem...
>
>WSDL2Java produces both client and server code without apparent problem 
>but when I invoke the service I get a NullPointerException.  I wonder if 
>this is a problem with "empty" namespaces.  The response from the server 
>looks like this:
>
><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>   <soapenv:Body>
>      <getObjectResponse xmlns="http://cityxpress.com/external">
>         <thedate xsi:type="xsd:dateTime" 
>xmlns="">2004-10-13T16:30:38.953Z</thedate>
>         <avalue xsi:type="xsd:int" xmlns="">0</avalue>
>      </getObjectResponse>
>   </soapenv:Body>
></soapenv:Envelope>
>
>I'm wondering if the xmlns="" in response values are the problem.  
>Should the xmlns attribute even be there?  If so, shouldn't it be 
>http://cityxpress.com/external?
>
>Thanks,
>Dan.
>
>
>Corrected WSDL:
>
><?xml version="1.0" encoding="UTF-8"?>
><wsdl:definitions targetNamespace="http://cityxpress.com/external"
>  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>  xmlns:tns="http://cityxpress.com/external">
>
>  <wsdl:types>
>    <xsd:schema targetNamespace="http://cityxpress.com/external">
>      <xsd:element name="getObject" type="tns:GetObjectType"/>
>       <xsd:complexType name="GetObjectType">
>        <xsd:sequence>
>          <xsd:element name="id" type="xsd:string"/>
>        </xsd:sequence>
>      </xsd:complexType>
>      <xsd:element name="getObjectReturn" type="tns:CXObjectType"/>     
>      <xsd:complexType name="CXObjectType">
>        <xsd:sequence>
>          <xsd:element name="thedate" type="xsd:dateTime"/>
>          <xsd:element name="avalue" type="xsd:int"/>
>        </xsd:sequence>
>      </xsd:complexType>
>    </xsd:schema>
>  </wsdl:types>
>  <wsdl:message name="getObjectRequest">
>    <wsdl:part name="parameters" element="tns:getObject"/>
>  </wsdl:message>
>  <wsdl:message name="getObjectResponse">
>    <wsdl:part name="parameters" element="tns:getObjectReturn"/>
>  </wsdl:message>
>  <wsdl:portType name="XMTestPortType">
>    <wsdl:operation name="getObject">
>      <wsdl:input message="tns:getObjectRequest"/>
>      <wsdl:output message="tns:getObjectResponse"/>
>    </wsdl:operation>
>  </wsdl:portType>
>  <wsdl:binding name="XMTestBinding" type="tns:XMTestPortType">
>    <soap:binding style="document"
>      transport="http://schemas.xmlsoap.org/soap/http/"/>
>    <wsdl:operation name="getObject">
>      <soap:operation soapAction=""/>
>      <wsdl:input>
>        <soap:body use="literal"/>
>      </wsdl:input>
>      <wsdl:output>
>        <soap:body use="literal"/>
>      </wsdl:output>
>    </wsdl:operation>
>  </wsdl:binding>
>  <wsdl:service name="XMTest">
>    <wsdl:port name="XMTest" binding="tns:XMTestBinding">
>      <soap:address location="http://localhost:8080/v01/XMTest"/>
>    </wsdl:port>
>  </wsdl:service>
></wsdl:definitions>
>
>
>
>  
>



Re: WSDL2Java and Basic Profile

Posted by Dan Ciarniello <dc...@cityxpress.com>.
Anne Thomas Manes wrote:

>Dan,
>
>The child elements (<id>, <thedate>, and <avalue>) are defined as local
>elements (defined inside a complex type), and therefore must be unqualified.
>Therefore the elements must include the "no default" namespace definitions
>(xmlns=""). If you prefer to make these element qualified, you can add the
>elementFormDefault="qualified" attribute to the <schema> definition. But
>this issue really shouldn't make a difference. 
>
>Anne
>  
>
Anne,

Thank you!  Thank you!  Thank you!

That solves a major headache for me.

You may be right in that it shouldn't really make a difference but I 
have found a couple of places where it seems to.

.NET was having problems with the responses and, as mentioned 
previously, so was the WSDL2Java-generated client code.  Adding the 
elementFormDefault="qualified" fixed the problem in both cases.

I think the reason that it makes a difference is that there are a couple 
of bugs in Axis 1.2 (and probably .NET, as well).  The first bug is that 
the automatically generated WSDL has elementFormDefault="qualified" on 
the schema regardless of whether the original WSDL contains it.  Even if 
it does, the value is ignored.  To see this, take the WSDL given below 
and generate and deploy the service then look at the auto-generated 
WSDL.  It will have elementFormDefault="qualified" on the schema 
attribute.  Add elementFormDefault="unqualified" to the WSDL and 
re-deploy.  The auto-generated WSDL will still have 
elementFormDefault="qualified".  Note that deploy.wsdd does properly 
reflect the value of elementFormDefault so the service does do the 
expected.  What this bascally means is that clients based on the 
auto-generated WSDL won't necessarily work properly because there is a 
mismatch between what the WSDL says and what the server produces.  (I 
wonder how much of the .NET interoperability problems is due to this).

Another problem that I have found is with WSDL2Java which I believe has 
hidden the above problem.  The WSDL given below causes WSDL2Java to 
produce a method signature like so:

public void getObject(String getObjectTypeId, CalendarHolder 
CXObjectTypeThedate, holders.IntHolder CXObjectTypeAvalue)

and the parameters specified as OUT parameters in deploy.wsdd.

The WSDL can be modified so that this signature is produced instead:

public CXObjectType getObject(String id).

WSDL2Java-produced client code does not work in the first case but does 
in the second.  This leads me to believe that WSDL2Java is ignoring (or 
assuming a value of "unqualified") the elementFormDefault attribute in 
the second case but not in the first.

I hope that what I've described above is clear.  Depending on comments 
received, I will post 1 or 2 bugs to JIRA.

Dan.

>-----Original Message-----
>From: Dan Ciarniello [mailto:dciarniello@cityxpress.com] 
>Sent: Wednesday, October 13, 2004 6:36 PM
>To: axis-user@ws.apache.org
>Subject: Re: WSDL2Java and Basic Profile
>
>Anne,
>
>Thanks for the info.  I had to make a few minor changes to what you sent 
>(I've attached a corrected version below) but that gave me enough to 
>work with.  Except for one problem...
>
>WSDL2Java produces both client and server code without apparent problem 
>but when I invoke the service I get a NullPointerException.  I wonder if 
>this is a problem with "empty" namespaces.  The response from the server 
>looks like this:
>
><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>   <soapenv:Body>
>      <getObjectResponse xmlns="http://cityxpress.com/external">
>         <thedate xsi:type="xsd:dateTime" 
>xmlns="">2004-10-13T16:30:38.953Z</thedate>
>         <avalue xsi:type="xsd:int" xmlns="">0</avalue>
>      </getObjectResponse>
>   </soapenv:Body>
></soapenv:Envelope>
>
>I'm wondering if the xmlns="" in response values are the problem.  
>Should the xmlns attribute even be there?  If so, shouldn't it be 
>http://cityxpress.com/external?
>
>Thanks,
>Dan.
>
>
>Corrected WSDL:
>
><?xml version="1.0" encoding="UTF-8"?>
><wsdl:definitions targetNamespace="http://cityxpress.com/external"
>  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>  xmlns:tns="http://cityxpress.com/external">
>
>  <wsdl:types>
>    <xsd:schema targetNamespace="http://cityxpress.com/external">
>      <xsd:element name="getObject" type="tns:GetObjectType"/>
>       <xsd:complexType name="GetObjectType">
>        <xsd:sequence>
>          <xsd:element name="id" type="xsd:string"/>
>        </xsd:sequence>
>      </xsd:complexType>
>      <xsd:element name="getObjectReturn" type="tns:CXObjectType"/>     
>      <xsd:complexType name="CXObjectType">
>        <xsd:sequence>
>          <xsd:element name="thedate" type="xsd:dateTime"/>
>          <xsd:element name="avalue" type="xsd:int"/>
>        </xsd:sequence>
>      </xsd:complexType>
>    </xsd:schema>
>  </wsdl:types>
>  <wsdl:message name="getObjectRequest">
>    <wsdl:part name="parameters" element="tns:getObject"/>
>  </wsdl:message>
>  <wsdl:message name="getObjectResponse">
>    <wsdl:part name="parameters" element="tns:getObjectReturn"/>
>  </wsdl:message>
>  <wsdl:portType name="XMTestPortType">
>    <wsdl:operation name="getObject">
>      <wsdl:input message="tns:getObjectRequest"/>
>      <wsdl:output message="tns:getObjectResponse"/>
>    </wsdl:operation>
>  </wsdl:portType>
>  <wsdl:binding name="XMTestBinding" type="tns:XMTestPortType">
>    <soap:binding style="document"
>      transport="http://schemas.xmlsoap.org/soap/http/"/>
>    <wsdl:operation name="getObject">
>      <soap:operation soapAction=""/>
>      <wsdl:input>
>        <soap:body use="literal"/>
>      </wsdl:input>
>      <wsdl:output>
>        <soap:body use="literal"/>
>      </wsdl:output>
>    </wsdl:operation>
>  </wsdl:binding>
>  <wsdl:service name="XMTest">
>    <wsdl:port name="XMTest" binding="tns:XMTestBinding">
>      <soap:address location="http://localhost:8080/v01/XMTest"/>
>    </wsdl:port>
>  </wsdl:service>
></wsdl:definitions>
>
>
>
>  
>


RE: WSDL2Java and Basic Profile

Posted by Anne Thomas Manes <an...@manes.net>.
Dan,

The child elements (<id>, <thedate>, and <avalue>) are defined as local
elements (defined inside a complex type), and therefore must be unqualified.
Therefore the elements must include the "no default" namespace definitions
(xmlns=""). If you prefer to make these element qualified, you can add the
elementFormDefault="qualified" attribute to the <schema> definition. But
this issue really shouldn't make a difference. 

Anne

-----Original Message-----
From: Dan Ciarniello [mailto:dciarniello@cityxpress.com] 
Sent: Wednesday, October 13, 2004 6:36 PM
To: axis-user@ws.apache.org
Subject: Re: WSDL2Java and Basic Profile

Anne,

Thanks for the info.  I had to make a few minor changes to what you sent 
(I've attached a corrected version below) but that gave me enough to 
work with.  Except for one problem...

WSDL2Java produces both client and server code without apparent problem 
but when I invoke the service I get a NullPointerException.  I wonder if 
this is a problem with "empty" namespaces.  The response from the server 
looks like this:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <getObjectResponse xmlns="http://cityxpress.com/external">
         <thedate xsi:type="xsd:dateTime" 
xmlns="">2004-10-13T16:30:38.953Z</thedate>
         <avalue xsi:type="xsd:int" xmlns="">0</avalue>
      </getObjectResponse>
   </soapenv:Body>
</soapenv:Envelope>

I'm wondering if the xmlns="" in response values are the problem.  
Should the xmlns attribute even be there?  If so, shouldn't it be 
http://cityxpress.com/external?

Thanks,
Dan.


Corrected WSDL:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://cityxpress.com/external"
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
  xmlns:tns="http://cityxpress.com/external">

  <wsdl:types>
    <xsd:schema targetNamespace="http://cityxpress.com/external">
      <xsd:element name="getObject" type="tns:GetObjectType"/>
       <xsd:complexType name="GetObjectType">
        <xsd:sequence>
          <xsd:element name="id" type="xsd:string"/>
        </xsd:sequence>
      </xsd:complexType>
      <xsd:element name="getObjectReturn" type="tns:CXObjectType"/>     
      <xsd:complexType name="CXObjectType">
        <xsd:sequence>
          <xsd:element name="thedate" type="xsd:dateTime"/>
          <xsd:element name="avalue" type="xsd:int"/>
        </xsd:sequence>
      </xsd:complexType>
    </xsd:schema>
  </wsdl:types>
  <wsdl:message name="getObjectRequest">
    <wsdl:part name="parameters" element="tns:getObject"/>
  </wsdl:message>
  <wsdl:message name="getObjectResponse">
    <wsdl:part name="parameters" element="tns:getObjectReturn"/>
  </wsdl:message>
  <wsdl:portType name="XMTestPortType">
    <wsdl:operation name="getObject">
      <wsdl:input message="tns:getObjectRequest"/>
      <wsdl:output message="tns:getObjectResponse"/>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="XMTestBinding" type="tns:XMTestPortType">
    <soap:binding style="document"
      transport="http://schemas.xmlsoap.org/soap/http/"/>
    <wsdl:operation name="getObject">
      <soap:operation soapAction=""/>
      <wsdl:input>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="XMTest">
    <wsdl:port name="XMTest" binding="tns:XMTestBinding">
      <soap:address location="http://localhost:8080/v01/XMTest"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>




Re: WSDL2Java and Basic Profile

Posted by Dan Ciarniello <dc...@cityxpress.com>.
Anne,

Thanks for the info.  I had to make a few minor changes to what you sent 
(I've attached a corrected version below) but that gave me enough to 
work with.  Except for one problem...

WSDL2Java produces both client and server code without apparent problem 
but when I invoke the service I get a NullPointerException.  I wonder if 
this is a problem with "empty" namespaces.  The response from the server 
looks like this:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <getObjectResponse xmlns="http://cityxpress.com/external">
         <thedate xsi:type="xsd:dateTime" 
xmlns="">2004-10-13T16:30:38.953Z</thedate>
         <avalue xsi:type="xsd:int" xmlns="">0</avalue>
      </getObjectResponse>
   </soapenv:Body>
</soapenv:Envelope>

I'm wondering if the xmlns="" in response values are the problem.  
Should the xmlns attribute even be there?  If so, shouldn't it be 
http://cityxpress.com/external?

Thanks,
Dan.


Corrected WSDL:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://cityxpress.com/external"
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
  xmlns:tns="http://cityxpress.com/external">

  <wsdl:types>
    <xsd:schema targetNamespace="http://cityxpress.com/external">
      <xsd:element name="getObject" type="tns:GetObjectType"/>
       <xsd:complexType name="GetObjectType">
        <xsd:sequence>
          <xsd:element name="id" type="xsd:string"/>
        </xsd:sequence>
      </xsd:complexType>
      <xsd:element name="getObjectReturn" type="tns:CXObjectType"/>     
      <xsd:complexType name="CXObjectType">
        <xsd:sequence>
          <xsd:element name="thedate" type="xsd:dateTime"/>
          <xsd:element name="avalue" type="xsd:int"/>
        </xsd:sequence>
      </xsd:complexType>
    </xsd:schema>
  </wsdl:types>
  <wsdl:message name="getObjectRequest">
    <wsdl:part name="parameters" element="tns:getObject"/>
  </wsdl:message>
  <wsdl:message name="getObjectResponse">
    <wsdl:part name="parameters" element="tns:getObjectReturn"/>
  </wsdl:message>
  <wsdl:portType name="XMTestPortType">
    <wsdl:operation name="getObject">
      <wsdl:input message="tns:getObjectRequest"/>
      <wsdl:output message="tns:getObjectResponse"/>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="XMTestBinding" type="tns:XMTestPortType">
    <soap:binding style="document"
      transport="http://schemas.xmlsoap.org/soap/http/"/>
    <wsdl:operation name="getObject">
      <soap:operation soapAction=""/>
      <wsdl:input>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="XMTest">
    <wsdl:port name="XMTest" binding="tns:XMTestBinding">
      <soap:address location="http://localhost:8080/v01/XMTest"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>



RE: WSDL2Java and Basic Profile

Posted by Anne Thomas Manes <an...@manes.net>.
Interesting. I think you found a bug in the WS-I Basic Profile.
According to the WSDL 1.1 specification [1] and the latest version of the
WSDL 1.1 XML Schema [2], the definitions/binding/operation/input element
does not include the @message attribute. Therefore the sample in the WS-I
Basic Profile is in error. 

[1] http://www.w3.org/TR/wsdl#_bindings 
[2] http://schemas.xmlsoap.org/wsdl/2003-02-11.xsd

You need to remove the @message attributes from your <input> and <output>
definitions in your <binding> definitions. 

Also, note that the example you referenced is for RPC style services, but
you've written a Document style service. When writing a Document style
service you must NOT include the namespace attribute:

R2716 A document-literal binding in a DESCRIPTION MUST NOT have the
namespace attribute specified on contained soapbind:body, soapbind:header,
soapbind:headerfault and soapbind:fault elements.

Also, when using Document style, your message <part> definitions must
reference an element rather than a type. 

R2204 A document-literal binding in a DESCRIPTION MUST refer, in each of its
soapbind:body element(s), only to wsdl:part element(s) that have been
defined using the element attribute. 

Try this WSDL:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://cityxpress.com/external"
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
  xmlns:tns="http://cityxpress.com/external">

  <wsdl:types>
    <xsd:schema targetNamespace="http://cityxpress.com/external">
      <xsd:element name="getObject" type="GetObjectType"/>
       <xsd:complexType name="GetObjectType">
        <xsd:sequence>
          <xsd:element name="id" type="xsd:string"/>
        </xsd:secquence>
      </xsd:complexType> 
      <xsd:element name="getObjectReturn" type="CXObjectType"/>      
      <xsd:complexType name="CXObjectType">
        <xsd:sequence>
          <xsd:element name="thedate" type="xsd:dateTime"/>
          <xsd:element name="avalue" type="xsd:int"/>
        </xsd:sequence>
      </xsd:complexType>
    </xsd:schema>
  </wsdl:types>
  <wsdl:message name="getObjectRequest">
    <wsdl:part name="parameters" element="tns:getObject"/>
  </wsdl:message>
  <wsdl:message name="getObjectResponse">
    <wsdl:part name="parameters" type="tns:getObjectReturn"/>
  </wsdl:message>
  <wsdl:portType name="XMTestPortType">
    <wsdl:operation name="getObject">
      <wsdl:input message="tns:getObjectRequest"/>
      <wsdl:output message="tns:getObjectResponse"/>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="XMTestBinding" type="tns:XMTestPortType">
    <soap:binding style="document"
      transport="http://schemas.xmlsoap.org/soap/http/"/>
    <wsdl:operation name="getObject">
      <soap:operation soapAction=""/>
      <wsdl:input>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="XMTest">
    <wsdl:port name="XMTest" binding="tns:XMTestBinding">
      <soap:address location="http://localhost:8080/v01/XMTest"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

Regards,
Anne

-----Original Message-----
From: Dan Ciarniello [mailto:dciarniello@cityxpress.com] 
Sent: Saturday, October 09, 2004 12:08 AM
To: axis-user@ws.apache.org
Subject: WSDL2Java and Basic Profile

I am trying to follow the advice that I've seen in this mailing list by 
handcrafting a WSDL and feeding it to WSDL2Java.  I'm also trying to 
make it conform to the WS-I Basic Profile requirements.  Unfortunately, 
I'm running into problems.

When I run WSDL2Java, I this:

WSDLException (at 
/wsdl:definitions/wsdl:binding/wsdl:operation/wsdl:input): 
faultCode=INVALID_WSDL: Encountered illegal extension attribute 
'message'. Extension attributes must be in a namespace other than WSDL's.:

There may be a problem with my WSDL (see below) but I also grabbed the 
WS-I sample WSDL found at

http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html#Namespaces_for
_Children_of_Part_Accessors

This gives exactly the same error.

It seems a bit odd that a "CORRECT" WSDL from the WS-I site should not 
be considered valid.

Here's my WSDL:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://cityxpress.com/external"
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
  xmlns:tns="http://cityxpress.com/external">

  <wsdl:types>
    <xsd:schema targetNamespace="http://cityxpress.com/external">
      <xsd:complexType name="CXObjectType">
        <xsd:sequence>
          <xsd:element name="thedate" type="xsd:dateTime"/>
          <xsd:element name="avalue" type="xsd:int"/>
        </xsd:sequence>
      </xsd:complexType>
    </xsd:schema>
  </wsdl:types>
  <wsdl:message name="getObjectRequest">
    <wsdl:part name="id" type="xsd:string"/>
  </wsdl:message>
  <wsdl:message name="getObjectResponse">
    <wsdl:part name="getObjectReturn" type="tns:CXObjectType"/>
  </wsdl:message>
  <wsdl:portType name="XMTestPortType">
    <wsdl:operation name="getObject">
      <wsdl:input message="tns:getObjectRequest"/>
      <wsdl:output message="tns:getObjectResponse"/>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="XMTestBinding" type="tns:XMTestPortType">
    <soap:binding style="document"
      transport="http://schemas.xmlsoap.org/soap/http/"/>
    <wsdl:operation name="getObject">
      <soap:operation soapAction=""/>
      <wsdl:input message="tns:getObjectRequest">
        <soap:body namespace="http://cityxpress.com/external" 
use="literal"/>
      </wsdl:input>
      <wsdl:output message="tns:getObjectResponse">
        <soap:body namespace="http://cityxpress.com/external" 
use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="XMTest">
    <wsdl:port name="XMTest" binding="tns:XMTestBinding">
      <soap:address location="http://localhost:8080/v01/XMTest"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

If anyone can point out the problem, it would be greatly appreciated.

Thanks,
Dan.