【问题标题】:apigee policy error - java.lang.String cannot be cast to com.apigee.flow.message.Messageapigee 政策错误 - java.lang.String 无法转换为 com.apigee.flow.message.Message
【发布时间】:2014-02-08 20:40:59
【问题描述】:

我正在尝试将来自目标端点的JSON 响应转换为soap 消息。我在帖子流程中有 2 个政策。

  1. JSONTOXML - 如果我禁用 xsltransform 我会看到 xml 结果,所以这项工作。
  2. xsltransform - 这只是指向我的 xsltransform 文件,该文件的模板和动态内容应该来自步骤 1 中的 xml。

源和输出都设置为“响应”,但在第 2 步中似乎无法转换。我应该如何在第 2 步中提取 xml 并应用 xsl?我还能怎么做?谢谢

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<JSONToXML async="false" continueOnError="false" enabled="true" name="jsontoxml-2">
    <DisplayName>JSONtoXML-2</DisplayName>
    <FaultRules/>
    <Properties/>
    <Options>
        <NullValue>NULL</NullValue>
        <NamespaceBlockName>#namespaces</NamespaceBlockName>
        <DefaultNamespaceNodeName>$default</DefaultNamespaceNodeName>
        <NamespaceSeparator>:</NamespaceSeparator>
        <TextNodeName>#text</TextNodeName>
        <AttributeBlockName>#attrs</AttributeBlockName>
        <AttributePrefix>@</AttributePrefix>
        <InvalidCharsReplacement>_</InvalidCharsReplacement>
        <ObjectRootElementName>Root</ObjectRootElementName>
        <ArrayRootElementName>Array</ArrayRootElementName>
        <ArrayItemElementName>Item</ArrayItemElementName>
    </Options>
    <OutputVariable>response</OutputVariable>
    <Source>response</Source>
</JSONToXML>

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<XSL async="false" continueOnError="false" enabled="true" name="xsltransform-1">
    <DisplayName>XSLTransform-1</DisplayName>
    <FaultRules/>
    <Properties/>
    <Source>response</Source>
    <ResourceURL>xsl://xsltransform-1</ResourceURL>
    <Parameters ignoreUnresolvedVariables="true"/>
    <OutputVariable>response</OutputVariable>
</XSL>

【问题讨论】:

    标签: xslt apigee


    【解决方案1】:

    OutputVariable 不能设置为“响应”。

    尝试删除“OutputVariable”行,或将其留空。删除它,应该会导致输出转到响应负载。

    换句话说,试试这个:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <XSL async="false" continueOnError="false" enabled="true" name="xsltransform-1">
        <DisplayName>XSLTransform-1</DisplayName>
        <FaultRules/>
        <Properties/>
        <Source>response</Source>
        <ResourceURL>xsl://xsltransform-1</ResourceURL>
        <Parameters ignoreUnresolvedVariables="true"/>
    </XSL>
    

    【讨论】:

      【解决方案2】:

      总是是这样吗? OutputVariable 不能在响应时设置吗?

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-03-31
        • 1970-01-01
        • 2014-03-07
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多