Thanks for pointing me to right direction. I'll try JAXB databinding
NamespaceMap .


dkulp wrote:
> 
> 
> 
> This is actually JAXB, not CXF, generating those.   This is logged as a
> bug 
> for JAXB:
> https://jaxb.dev.java.net/issues/show_bug.cgi?id=425
> but is considered low priority since it doesn't really affect the real 
> structure of the XML.    Basically, JAXB doesn't know which namespaces
> it's 
> going to need so it just outputs everything it knows about ahead of time.
> 
> 
> You can TRY setting a NamespaceMap  on the JAXB databinding to an empty
> map or 
> something.   That MAY work.   I'm not really sure. 
> 
> Dan
> 
> 
> 
> On Thu July 23 2009 11:34:26 am Potluri5 wrote:
>> Hi,
>>
>>    I have a  CXF web service. Wsdl2Java approach is used to auto generate
>> code.
>>
>> Generated method signature is,
>>
>> @WebResult(name = "pointerCountResponse", targetNamespace =
>> "http://xxxxxxxxxx/service/pointerCount/v1.1/";, partName =
>> "pointerCountResponse")
>>     @WebMethod(action =
>> "http://xxxxxxxxxx/PointerCountService/pointerCount";)
>>     public java.lang.Object pointerCount(
>>         @WebParam(partName = "pointerCountRequest", name =
>> "pointerCount",
>> targetNamespace = "http://xxxxxxxxxx/service/pointerCount/v1.1/";)
>>         java.lang.Object pointerCountRequest,
>>         @WebParam(partName = "messageTrackingInfo", mode =
>> WebParam.Mode.INOUT, name = "messageTrackingInfo", targetNamespace =
>> "http://xxxxxxxxxx/schemas/message/v1.1/2007-01-12/";, header = true)
>>         javax.xml.ws.Holder<java.lang.Object> messageTrackingInfo
>>
>> Here  messageTrackingInfo which is header information,
>> pointerCountRequest
>> which is request and pointerCountResponse which is response are all W3C
>> Documents.
>>
>> Once business logic is done I will update incoming messageTrackingInfo
>> and
>> create pointerCountResponse document and send them as response.
>>
>> Issue here is CXF is creating extra namespace declarations in soap:body
>> which is pointerCountResponse document.
>> xmlns:ns2="http://xxxxxxxxx/specs/schemas/message/v1.1/2007-01-12/"; which
>> is related to soap:header is placed in soap:body. Not sure why it is
>> creating that namespace there, no one is referencing that.
>>
>>
>> To be more clear here is an example.
>>
>> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
>>     <soap:Header>
>>         <ns2:messageTrackingInfo
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>>             xmlns:xsd="http://www.w3.org/2001/XMLSchema";
>>             xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";
>>            
>> xmlns="http://xxxxxxxxx/specs/schemas/message/v1.1/2007-01-12/";
>>            
>> xmlns:uri="http://xxxxxxxxx/specs/schemas/uri/v1.1/2007-01-12/";
>>
>> xmlns:svc="http://xxxxxxxxx/specs/schemas/service/v1.1/2007-01-12/";
>>
>> xmlns:ns2="http://xxxxxxxxx/specs/schemas/message/v1.1/2007-01-12/";
>>             branchStack="0" convSeq="0"
>>             svc:currentSendingOperatorURI="http://xxxxxxxxx";
>>             svc:currentServiceDefURI="http://xxxxxxxxx";
>>             svc:currentServiceLabel="dont know"
>>             svc:currentServiceProviderURI="xxxxxxxxx"
>>             svc:initialUserURI="xxxxxxxxx"
>>             svc:requesterInvocationNum="78" svc:serviceInvocationNum="78"
>> svc:serviceLabel="foobar"
>>             svc:serviceProviderURI="bar"
>>             svc:serviceRequesterURI="xxxxxxxxx"
>>             uri:serviceDefURI="foo"/>
>>     </soap:Header>
>>     <soap:Body>
>>         <pointerCountResponse
>>
>> xmlns="http://xxxxxxxxx/specs/schemas/gateway/service/pointerCount/v1.1/";
>>
>> xmlns:ns2="http://xxxxxxxxx/specs/schemas/message/v1.1/2007-01-12/";>
>>             <pcsv:pointerCountConfirmation
>>
>> xmlns:pcsv="http://xxxxxxxxx/specs/schemas/gateway/service/pointerCount/v1.
>>1/"
>>
>> xmlns:svc="http://xxxxxxxxx/specs/schemas/service/v1.1/2007-01-12/";
>>
>> xmlns:wij-uri="http://xxxxxxxxx/specs/schemas/uri/v1.1/2007-01-12/";
>>                 svc:recordCount="0"
>>                 wij-uri:submitterURI="http://xxxxxxxxx";
>>             />
>>         </pointerCountResponse>
>>     </soap:Body>
>> </soap:Envelope>
>>
>> If anyone has faced a similar issue or can think of anything to solve
>> this problem please get back to me.
> 
> -- 
> Daniel Kulp
> [email protected]
> http://www.dankulp.com/blog
> 
> 

-- 
View this message in context: 
http://www.nabble.com/CXF-is-creating-extra-namespace-declarations-tp24628505p24629498.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to