David had the great idea to post this issue at the [xsl] list, asking for a
fixup via XSLT. There, Wendell Piez outlined a solution for
eliminating redundant
namespace nodes, which I managed to implement, see below. But,
quoting Wendell, "complications could arise if you ever have clashing
namespaces (same namespace and different prefix or same prefix
different namespace)."
<?xml version="1.0"?>
<xsl:stylesheet version="2.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:apply-templates select="*"/>
</xsl:template>
<xsl:template match="/element()">
<xsl:copy copy-namespaces = "no">
<xsl:for-each-group select = "descendant-or-self::node()"
group-by = "node-name(.)">
<xsl:variable name="key" select="current-grouping-key()"/>
<xsl:if test="namespace-uri-from-QName($key)">
<xsl:namespace name="{ prefix-from-QName($key) }">
<xsl:value-of select="namespace-uri-from-QName($key)"/>
</xsl:namespace>
</xsl:if>
</xsl:for-each-group>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@*|*">
<xsl:copy copy-namespaces = "no">
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
On 9 November 2010 19:41, KARR, DAVID (ATTSI) <dk068x_at_att.com> wrote:
> I'm experimenting with using Apache CXF to consume some web services.
>
> I have an existing service client that uses JAXB, with an ad hoc Soap
> infrastructure. When I marshal the envelope in the existing code, I get
> xmlns attributes for all the namespaces that are actually used in the
> envelope, which isn't many. It only produces one application-specific
> one.
>
> Our WSDL defines a service with a large number of operations. Each one
> of them has their own operation-specific schema.
>
> When I now marshal the request with CXF, I get a request that is much,
> much, larger than the original code. This is because it has xmlns
> attributes for EVERY schema referenced in the WSDL, even though only one
> is referenced in the operation. What's worse is that that huge list of
> xmlns attributes is present in two places in the envelope, both on the
> body child element and in an element in the header.
>
> Is there some way I can get the envelope back closer to what I had
> before?
>
> I asked about this on the CXF list, but they replied that this isn't
> something that CXF can control, it's entirely in the JAXB arena.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>