You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Wim Verreydt <wi...@anova.be> on 2013/11/06 10:55:45 UTC

Not honouring attributeFormDefault and some elements without namespace

Hi All,

I have a problem with the WSDL auto-generated by CXF. The source model is generated from an xsd file, when exposed as webparam, I notice te following problems:

The WSDL states :

<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns=“http://www.testnamespace.com/v1"xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="incidentService" targetNamespace="http://www.testnamespace.com/v1">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.testnamespace.com/v1" attributeFormDefault="unqualified" elementFormDefault="unqualified"targetNamespace="http://www.testnamespace.com/v1">

The elementFormDefault is defined as qualified in the package-info.java file generated by JAXB from the xsd file but cxf does not seem to respect that and sets it “unqualified”. 


The second problem I have could be a consequence of the previous one but when I let SoapUI generate a sample request, it looks like:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1=“http://www.testnamespace.com/v1">
   <soapenv:Header/>
   <soapenv:Body>
      <v1:A>
         <!--Optional:-->
         <B>
            <C>?</C>
            <D>
               <!--Optional:-->
               <E>
                  <v1:F>
                     <v1:G>?</v1:G>
                     <v1:H>?</v1:H>
…

So some elements require a namespace (v1) and some don’t although they are defined in the same way in the xsd file and are in the same package. Unfortunately they all should all end up in the same namespace.  

I’m using CXF 2.6.0 

Thanks in advance!

Wim





Re: Not honouring attributeFormDefault and some elements without namespace

Posted by Daniel Kulp <dk...@apache.org>.
First off, can you try with a more recent version of CXF?   This might already be fixed.

You mention that this is a combination of JAXB generated stuff and “Java first” for the WSDL generation.   In that case, it’s likely that the WSDL first part generates the initial schema as it would likely need to create the wrapper elements for the operations (the <v1:A> element and the immediate children in your example).   JAX-WS dictates those should be unqualified.   If you have an object generated for the A, you would need to have the appropriate @RequestWrapper annotation added to have it use that instead.  You may also need to add the targetNamespace attributes to all the @WebParam annotations.

In any case, a more complete example would be useful.   Definitely would need to see the generated JAXB objects as well as the service interface with the various JAX-WS annotations.

Dan



On Nov 6, 2013, at 10:55 AM, Wim Verreydt <wi...@anova.be> wrote:

> Hi All,
> 
> I have a problem with the WSDL auto-generated by CXF. The source model is generated from an xsd file, when exposed as webparam, I notice te following problems:
> 
> The WSDL states :
> 
> <wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns=“http://www.testnamespace.com/v1"xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="incidentService" targetNamespace="http://www.testnamespace.com/v1">
> <wsdl:types>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.testnamespace.com/v1" attributeFormDefault="unqualified" elementFormDefault="unqualified"targetNamespace="http://www.testnamespace.com/v1">
> 
> The elementFormDefault is defined as qualified in the package-info.java file generated by JAXB from the xsd file but cxf does not seem to respect that and sets it “unqualified”. 
> 
> 
> The second problem I have could be a consequence of the previous one but when I let SoapUI generate a sample request, it looks like:
> 
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1=“http://www.testnamespace.com/v1">
>   <soapenv:Header/>
>   <soapenv:Body>
>      <v1:A>
>         <!--Optional:-->
>         <B>
>            <C>?</C>
>            <D>
>               <!--Optional:-->
>               <E>
>                  <v1:F>
>                     <v1:G>?</v1:G>
>                     <v1:H>?</v1:H>
> …
> 
> So some elements require a namespace (v1) and some don’t although they are defined in the same way in the xsd file and are in the same package. Unfortunately they all should all end up in the same namespace.  
> 
> I’m using CXF 2.6.0 
> 
> Thanks in advance!
> 
> Wim
> 
> 
> 
> 

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com