Hi

On Wed, May 4, 2011 at 12:22 PM, Clint Dovholuk <[email protected]> wrote:
> Thanks Sergey and Dan... I'll reply to you both in one email if that's ok. 
> (thanks for replying!) I had the same thought and I added 
> elementFormDefault="qualified", regenerated the code but it still doesn't 
> seem to want to work.  I then took the elementFormDefault out and went the  
> package-info.java and it produces the same results... All it does it take the 
> xml and turn it into:
>
> TO
>      <input xmlns:q1="http://testing-cxf-and-jaxws"; xsi:type="q1:Meat" 
> xmlns="">
>        <q1:animal /> <!-- here is the qualification -->
>      </input>
> FROM
>      <input xmlns:q1="http://testing-cxf-and-jaxws"; xsi:type="q1:Meat" 
> xmlns="">
>        <animal />
>      </input>
>
> This made sense to me... From my understanding of xml the problem isn't the 
> qualification of the elements that is the issue. Rather, it is the fact that 
> from outer element (web service) to inner elements (jaxb domain objects) the 
> actual namespace is CHANGING.  That change is what forces the requalification 
> which subsequently forces the new 'default' namespace to be applied.  It's 
> like CXF - or JAXB - whatever is just not respecting the namespace set on the 
> type.
>
> So it seems to me that the xml parser thinks that the outer web service tags 
> are all in namespace "test" while all the jaxb artifacts are in the empty 
> namespace "" which just isn't right...
>

I'm not sure why 'input' is forced to be unqualified, can you try add
the namespace attribute to WebParam itself as Dan suggested ?

May be you just need to add another XmlSchema to package-info.java ?
One for the "http://tests"; and another for
"http://testing-cxf-and-jaxws";

Cheers, Sergey

> When I code the classes by hand - and I don't use xjc to generate the domain 
> objects this problem doesn't happen...  I'll keep trying to figure it out but 
> if you gents have any other ideas -I'm all ears.
>
> Thanks again
>
> -Clint
>
> Sent from my Dell Precision T1500
>
>
> -----Original Message-----
> From: Daniel Kulp [mailto:[email protected]]
> Sent: Tuesday, May 03, 2011 11:10 AM
> To: [email protected]
> Cc: Clint Dovholuk
> Subject: Re: CXF switches namespace from expected to xmlns=""
>
>
>
> By default, JAX-WS (and thus CXF) produces unqualified schemas and messages.
> Thus, only the root element is namespace qualified and the sub elements would
> not be.    If you add the namespace attribute to the @WebParam, that would
> change it for that parameter.
>
> Alternatively, add a package-info.java with something like:
>
> @javax.xml.bind.annotation.XmlSchema(
>      namespace = "http://apache.org/hello_world_soap12_http/types";,
> elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
>
> to force the elements into qualified form.
>
> Dan
>
>
> On Tuesday, May 03, 2011 10:07:54 AM Clint Dovholuk wrote:
>> Hi All,
>>
>>
>>
>> Preface: If this has been addressed in the past I'm sorry...
>>
>> I really did scour the internet but my search foo was apparently
>> insufficient.
>>
>>
>>
>> I am having a problem where the namespace of the service and all types in
>> the service are getting translated from the expected namespace to
>> xmlns="".  I created a silly contrived example (which I could provide
>> schema, mvn pom usage etc if need be) but basically I have:
>>
>> Class/Method:
>>
>>     @WebService(targetNamespace = "http://testing-cxf-and-jaxws";)
>>
>>     public class FoodSoapService
>>
>>     {
>>
>>       public AbstractFood testing(@WebParam(name = "input") AbstractFood
>> input)
>>
>>       {
>>
>>         return input;
>>
>>       }
>>
>>     }
>>
>>
>>
>> Produces:
>>
>>     <soap:Body>
>>
>>       <testing xmlns="http://test/";>
>>
>>         <input xmlns:q1="http://testing-cxf-and-jaxws"; xsi:type="q1:Meat"
>> xmlns="">
>>
>>           <animal />
>>
>>         </input>
>>
>>       </testing>
>>
>>     </soap:Body>
>>
>>
>>
>> See how the testing tag has the 'proper' namespace but the input tag has
>> switched over to xmlns=""?
>>
>>
>>
>> I am sure this is a totally simple issue but boy - I just cannot figure out
>> what I've done wrong. Any pointers or thoughts would be much appreciated.
>>
>>
>>
>> -Clint
>>
>>
>>
>> More Details:
>>
>> We start with a schema, generate domain artifacts via JAXB, the JAXB
>> artifacts are in the 'proper' namespace ala: @XmlType(name =
>> "AbstractFood", namespace = "http://testing-cxf-and-jaxws";)
>
> --
> Daniel Kulp
> [email protected]
> http://dankulp.com/blog
> Talend - http://www.talend.com
>

Reply via email to