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:[EMAIL PROTECTED] Sent: Wednesday, October 13, 2004 6:36 PM
To: [EMAIL PROTECTED]
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>
begin:vcard fn:Dan Ciarniello n:Ciarniello;Dan org:CityXpress Corp adr;dom:;;200 - 1727 West Broadway;Vancouver;BC;V6J 4W5 email;internet:[EMAIL PROTECTED] title:Software Developer tel;work:604-638-3800 ext. 322 x-mozilla-html:TRUE url:http://www.cityxpress.com version:2.1 end:vcard