While I agree that Axis probably shouldn't generate a WSDL which
contains xmlns="", that's not what you said is happening. You
indicated that you are receiving a response message that contains
xmlns="", and depending on the schema for the message, this might be
appropriate.

xmlns="" is the proper way to declare no default namespace, and its
the only way to override a previously declared defaul namespace.

Let me demonstrate with an example.
Let's say that you have this schema:

<s:schema targetNamespace="some-uri" elementFormDefault="unqualified"
   xmlns:s="http://www.w3.org/2001/XMLSchema";>
  <s:element name="foobar">
    <s:complexType>
      <s:sequence>
        <s:element name="foo" type="s:string"/>
        <s:element name="bar" type="s:string"/>
      </s:sequence>
    </s:complexType>
  </s:element>
</s:schema>

In this schema, "foobar" is in the "some-uri" namespace, but "foo" and
"bar" are local elements to "foobar" and they belong to no namespace.
Therefore in a valid document instance, these elements must be
unqualified.

A valid instance of this schema might look like this:

<tns:foobar xmlns:foobar="some-uri">
  <foo>one</foo>
  <bar>two</bar>
</tns:foobar>

But another valid instance might look like this:

<foobar xmlns="some-uri">
  <foo xmlns="">one</foo>
  <bar xmlns="">two</bar>
</foobar>

Since "foo" and "bar" are in no namespace, you must override the
default namespace in each element.

According to XML Schema, if you don't specify
elementFormDefault="qualified", then all local elements default to
unqualified -- but .NET has a bug, and it defaults to qualified.
Therefore to fix your problem, add elementFormDefault="qualified" to
your schema.

Anne

On 7/26/05, Dovholuk, Clint <[EMAIL PROTECTED]> wrote:
> Thanks for your time and the reply Anne.
> 
> Thanks too for the 'wrapped' tip, I missed that...
> 
> However, I'm not sold that this is a .NET interop issue.  Should Axis
> ever be writing out a wsdl which contains xmlns=""?  It seems to me that
> Axis generating a wsdl with xmlns="" (ever) would be a bug/problem...
> But maybe I'm doing something wrong?
> 
> -Clint
> 
> 
> 
> -----Original Message-----
> From: Anne Thomas Manes [mailto:[EMAIL PROTECTED]
> Sent: Monday, July 25, 2005 8:59 PM
> To: [email protected]
> Subject: Re: xmlns="" for me too, calling axis from .NET - piggy backing
> on: RE: .NET server, Axis 1.2.1 client, poorly formed messages
> 
> Clint,
> 
> If you want to enable interop with .NET then do the following:
> 
> 1- use style="wrapped" rather than style="document" in your WSDD.
> 2- edit your generated WSDL as follows:
>   a- Remove the abstract type and define NewLocation as a simple
> sequence
>       rather than as an extension of AbstractLocation.
>   b- Replace all nillable="true" attributes with nillible="false"
> minOccurs="0".
>   c- Replace the ArrayOf_xsd_anyType (and its child item element) with
>       specific type definitions (i.e., don't use type="xsd:anyType").
> 3- regen your server from the edited WSDL.
> 
> Anne
> 
> On 7/22/05, Dovholuk, Clint <[EMAIL PROTECTED]> wrote:
> > Hi Anne (and everyone)
> >
> > I have a similar issue but I have a .NET client consuming an Axis
> > webservice and I'm seeing the xmlns="" in the response...  I've setup
> > my wsdl to use doc/lit, so while it's related, I don't think it's an
> > "RPC-thing"?
> >
> > I have a class which I let Axis generate a wsdl for (below) and I've
> > also attached my wsdd entry...
> >
> > Unfortunately the search hits so many results, finding the right
> > pointer has been impossible...
> >
> > Thanks for any pointers,
> > -Clint
> >
> > ****************************** WSDD ENTRY
> > ******************************
> >
> >   <service name="myTestService" provider="java:RPC" style="document"
> > use="literal">
> >     <parameter name="allowedMethods" value="createLocation" />
> >     <parameter name="className" value="com.myNamespace.MyService" />
> >     <namespace>http://http://my-namespace.com</namespace>
> >
> >     --- BEAN MAPPINGS ---
> >
> >   </service>
> > ****************************** END WSDD ENTRY
> > ******************************
> >
> > ****************************** WSDL ******************************
> > <?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions
> > targetNamespace="http://http://my-namespace.com";
> > xmlns:apachesoap="http://xml.apache.org/xml-soap";
> > xmlns:impl="http://http://my-namespace.com";
> > xmlns:intf="http://http://my-namespace.com";
> > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
> > xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/";
> > xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
> > <!--WSDL created by Apache Axis version: 1.2.1 Built on Jun 14, 2005
> > (09:15:57 EDT)-->  <wsdl:types>
> >   <schema elementFormDefault="qualified"
> > targetNamespace="http://http://my-namespace.com";
> > xmlns="http://www.w3.org/2001/XMLSchema";>
> >    <complexType abstract="true" name="AbstractLocation">
> >     <sequence/>
> >    </complexType>
> >    <complexType name="NewLocation">
> >     <complexContent>
> >      <extension base="impl:AbstractLocation">
> >       <sequence>
> >        <element name="accountNumber" nillable="true"
> type="xsd:string"/>
> >        <element name="address" nillable="true" type="xsd:string"/>
> >        <element name="city" nillable="true" type="xsd:string"/>
> >        <element name="country" nillable="true" type="xsd:string"/>
> >        <element name="county" nillable="true" type="xsd:string"/>
> >        <element name="floor" nillable="true" type="xsd:string"/>
> >        <element name="phoneNumber" nillable="true" type="xsd:string"/>
> >        <element name="postalCode" nillable="true" type="xsd:string"/>
> >        <element name="siteName" nillable="true" type="xsd:string"/>
> >        <element name="state" nillable="true" type="xsd:string"/>
> >       </sequence>
> >      </extension>
> >     </complexContent>
> >    </complexType>
> >    <element name="locs">
> >     <complexType>
> >      <sequence>
> >       <element maxOccurs="unbounded" minOccurs="0" name="item"
> > type="impl:NewLocation"/>
> >      </sequence>
> >     </complexType>
> >    </element>
> >    <complexType name="ArrayOf_xsd_anyType">
> >     <sequence>
> >      <element maxOccurs="unbounded" minOccurs="0" name="item"
> > type="xsd:anyType"/>
> >     </sequence>
> >    </complexType>
> >    <complexType name="ReturnedItems">
> >     <sequence>
> >      <element name="errorsExist" type="xsd:boolean"/>
> >      <element name="returnedItems" nillable="true"
> > type="impl:ArrayOf_xsd_anyType"/>
> >     </sequence>
> >    </complexType>
> >    <element name="createLocationReturn" type="impl:ReturnedItems"/>
> >   </schema>
> >  </wsdl:types>
> >    <wsdl:message name="createLocationRequest">
> >       <wsdl:part element="impl:locs" name="locs"/>
> >    </wsdl:message>
> >    <wsdl:message name="createLocationResponse">
> >       <wsdl:part element="impl:createLocationReturn"
> > name="createLocationReturn"/>
> >    </wsdl:message>
> >    <wsdl:portType name="MyService">
> >       <wsdl:operation name="createLocation" parameterOrder="locs">
> >          <wsdl:input message="impl:createLocationRequest"
> > name="createLocationRequest"/>
> >          <wsdl:output message="impl:createLocationResponse"
> > name="createLocationResponse"/>
> >       </wsdl:operation>
> >    </wsdl:portType>
> >    <wsdl:binding name="myTestServiceSoapBinding"
> type="impl:MyService">
> >       <wsdlsoap:binding style="document"
> > transport="http://schemas.xmlsoap.org/soap/http"/>
> >       <wsdl:operation name="createLocation">
> >          <wsdlsoap:operation soapAction=""/>
> >          <wsdl:input name="createLocationRequest">
> >             <wsdlsoap:body use="literal"/>
> >          </wsdl:input>
> >          <wsdl:output name="createLocationResponse">
> >             <wsdlsoap:body use="literal"/>
> >          </wsdl:output>
> >       </wsdl:operation>
> >    </wsdl:binding>
> >    <wsdl:service name="MyServiceService">
> >       <wsdl:port binding="impl:myTestServiceSoapBinding"
> > name="myTestService">
> >          <wsdlsoap:address
> > location="http://10.60.93.22:40000/eon/services/myTestService"/>
> >       </wsdl:port>
> >    </wsdl:service>
> > </wsdl:definitions>
> > ****************************** END WSDL ******************************
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > -----Original Message-----
> > From: John Baker [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, July 20, 2005 5:42 AM
> > To: [email protected]; Anne Thomas Manes
> > Subject: Re: .NET server, Axis 1.2.1 client, poorly formed messages
> >
> > Anne,
> >
> > You are absolutely correct. The .NET server is exposing
> > style="document"; style="rpc" came about to fix a broken client (to
> > Axis) getting confused about what to do when style="document" is
> > present in the WSDL.
> >
> > I'll change it back and try this all again :)
> >
> >
> > John
> >
> > On Tue, Jul 19, 2005 at 10:07:43AM -0400, Anne Thomas Manes wrote:
> > > John,
> > >
> > > The empty namespace on the child element of the SOAP Body is caused
> > > by
> >
> > > the fact that the WSDL specifies "rpc" style in the <soap:binding>
> > > definition, but it doesn't specify a namespace attribute in the
> > > <soap:body> definitions. (When using RPC style, you must specify a
> > > namespace attribute in <soap:body>.)
> > >
> > > I'm really astonished to see a .NET server exposing a WSDL that uses
> 
> > > RPC/Literal -- .NET doesn't support RPC/Literal. This WSDL is
> > > totally wrong for an RPC style service. It looks like a wrapped
> > > document/literal style service. As I said in another response I made
> 
> > > to you yesterday, you should change the style to "document", and
> > > then it should work. (As I mentioned yesterday, you do have a number
> 
> > > of elements defined in the schema with no types defined -- you
> > > should also define their types.)
> > >
> > > Anne
> > >
> > > On 7/14/05, John Baker <[EMAIL PROTECTED]> wrote:
> > > > Hello,
> > > >
> > > > I am using Axis (1.2.1) to connect to a .NET server, but the
> > > > server isn't deserialising the Axis generated message correctly.
> > > >
> > > > I've used this wsdl:
> > > > http://www.javasystemsolutions.com/serviceRequestConnector.wsdl
> > > >
> > > > And I've used the wsdl2java program to create my Java stubs.
> > > >
> > > > Now this is what Axis generates for the
> > > > SubmitGeneralServiceRequest
> > method:
> > > >
> > > > <?xml version="1.0" encoding="UTF-8"?> <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>
> > > >   <SubmitGeneralServiceRequest xmlns="">
> > > >     <ns1:SubmittedGeneralServiceRequest
> > xmlns:ns1="http://www.caps-solutions.co.uk/schema/uniform/72b/servicer
> > eq
> > uest/sr/srtypes">
> > > >       <ns1:ServiceRequestIdentification
> > > >
> > > > (etc.)
> > > >
> > > > The .NET server replies:
> > > >
> > > > Server was unable to process request. A valid
> > > > SubmittedGeneralServiceRequestType object is required
> > > >
> > > > Now it strikes me that xmlns="" looks wrong.
> > > >
> > > > Does anyone have any ideas what's going on?
> > > >
> > > > Thanks,
> > > >
> > > >
> > > > John
> > > >
> >
>

Reply via email to