【问题标题】:JMS Adapter adding namespace value xmlns=""JMS 适配器添加命名空间值 xmlns=""
【发布时间】:2015-07-17 19:57:53
【问题描述】:

使用 SOA BPEL2.0,我正在尝试将字符串映射到 JMS 出站队列。

我正在使用如下简单的xsd

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                      elementFormDefault="qualified">
<xsd:element name="FullName" type="xsd:string"/>
</xsd:schema>

目前队列消息生成为

<?xml version="1.0" encoding="UTF-8" ?><FullName xmlns="">
....
....
</FullName>

所需的队列消息在哪里

<?xml version="1.0" encoding="UTF-8" ?><FullName>
....
....
</FullName>

我没有使用任何 xsl 左右。

任何帮助或线索都会非常棒。

【问题讨论】:

    标签: xml xsd namespaces jms bpel


    【解决方案1】:

    请尝试以下代码:

    它从已处理文件中删除所有命名空间定义,但复制所有其他节点和值:元素、属性、cmets、文本和处理指令。

    <?xml version="1.0"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
        <xsl:output indent="yes" method="xml" encoding="utf-8" omit-xml-declaration="yes"/>
    
        <!-- Stylesheet to remove all namespaces from a document -->
        <!-- NOTE: this will lead to attribute name clash, if an element contains
            two attributes with same local name but different namespace prefix -->
        <!-- Nodes that cannot have a namespace are copied as such -->
    
        <!-- template to copy elements -->
        <xsl:template match="*">
            <xsl:element name="{local-name()}">
                <xsl:apply-templates select="@* | node()"/>
            </xsl:element>
        </xsl:template>
    
        <!-- template to copy attributes -->
        <xsl:template match="@*">
            <xsl:attribute name="{local-name()}">
                <xsl:value-of select="."/>
            </xsl:attribute>
        </xsl:template>
    
        <!-- template to copy the rest of the nodes -->
        <xsl:template match="comment() | text() | processing-instruction()">
            <xsl:copy/>
        </xsl:template>
    
    </xsl:stylesheet>
    

    【讨论】:

    • 谢谢,我正在尝试使用 BPEL2.0,但它不起作用。我在这里使用下面提到的代码... bpel:doXslTransform("xsl/NamespaceRemoval.xsl", $Invoke2_Produce_Message_InputVariable.body)$Invoke2_Produce_Message_InputVariable .body
    • 我找到了解决方案,我为 Opaque 更改了 JMS 适配器,然后我将整个 XML 转换为字符串,并使用 Base64Encoder 将 XML 字符串编码为 Base64,并将这个 Base64 编码值发送到 Opaque JMS 队列。并获得所需的结果消息。
    猜你喜欢
    • 2018-08-25
    • 1970-01-01
    • 2011-08-08
    • 2011-11-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多