Hi Gaurav,
2013/9/19 Gaurav Chandna <[email protected]>:
> Hi Aki,
>
> I was exploring more on this issue and following are the findings:
>
> 1. If xmlbeans are used for generating java binding objects the all the java
> objects generated have prefix element missing in QName constructor such as:
>   private static final javax.xml.namespace.QName LASTACTIVITYDATE$0 =
>         new
> javax.xml.namespace.QName*("http://www.cvscaremark.com/esl/eldm/entities/1_0";,
> "lastActivityDate");*
>
> 2. Because of missing prefix in the QName Constructor in Java binding
> objects below mentioned changes are done in mentioned file gave desired
> result - DatawriterImpl used for  xmlbeans -
> private static void writeStartElement(XMLStreamReader reader,XMLStreamWriter
> writer) throws XMLStreamException {
>  if (uri != null) {
>   writeElementNS = true;
>   Iterator<String> it =
> CastUtils.cast(writer.getNamespaceContext().getPrefixes(uri));
>   while (it != null && it.hasNext()) {
>     String s = it.next();
>     if (s == null) {
>         s = "";
> }
>  *// Changes to override the default behaviour to write the namespace
>   else {
>    prefix = s;
>    writeElementNS = false;
>   }
>  /** if (s.equals(prefix)) { writeElementNS = false; }*/
>  // Changes to override the default behaviour to write the namespace*         
>           }
>                 }
>         }
>

I added an option to get certain namespace declarations excluded from
being serialized for jaxb's databinding.
But I haven't looked at xmlbeans' databinding to see if there is a
similar possibility.

>
> 3. I have tried soap.env.ns map, it is also not working - It has included
> all the declared nsmap in soap header segment but in the soap body its not
> replacing namespaces with prefix.

This property works for the envelope part but not for the inside the bean.

>
> 4. I have tried StaxTransform feature for outtransfor elements which is
> giving partial success of dropping complete repeated namespace from soap
> body but not appending the namespace prefix before the element.
>

if you have figured out using the stax transform feature and the only
missing piece is the lack of the prefix for the namespace, there is
potentially a way. The stax transform feature keeps the original
prefix to maintain the qname linking (the original prefix may be used
in some of the QName attribute types). But in your case, setting the
default namespace to another arbitrary uri, your original namespace
may be prefixed. not sure about this, but worth a try. see
http://cxf.apache.org/docs/transformationfeature.html#TransformationFeature-Defaultnamespaceontheoutput

regards, aki

> Your help will be much appreciated!!!
> Being a newbie to CXF, I might be in wrong direction....request you to
> please provide right solution for same.
>
>
> -
> Gaurav
>
>
>
> --
> View this message in context: 
> http://cxf.547215.n5.nabble.com/Issue-in-Prefix-management-of-namespace-in-cxf-2-5-10-tp5733766p5734258.html
> Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to