无法从有效负载中删除命名空间

Unable to remove namespace from payload

提问人:Wajih Haider 提问时间:8/31/2023 最后编辑:Mads HansenWajih Haider 更新时间:8/31/2023 访问量:37

问:

嗨,大家好,我正在尝试在 wso2 MI 中制作有效载荷,并为下面提到的代码编写了一个代码:

    <payloadFactory media-type="xml">
      <format>
        <soapenv:Envelope xmlns:chan="http://www.tibco.com/ChangeSubOfferingAPI/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
          <soapenv:Header/>
            <soapenv:Body>
              <chan:ChangeSubOfferingRqsAPI>
                <Header>
                  <Username>$1</Username>
                </Header>
                <Body>
                  <SerialNo>$2</SerialNo>
                </Body>
              </chan:ChangeSubOfferingRqsAPI>
            </soapenv:Body>
         </soapenv:Envelope>
       </format>
       <args>
         <arg evaluator="xml" expression="$ctx:userName"/>
         <arg evaluator="xml" expression="$ctx:password"/>
       </args>
  </payloadFactory>

我得到这个有效载荷:

<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:chan="http://www.tibco.com/ChangeSubOfferingAPI/">
    <soapenv:Body>
        <chan:ChangeSubOfferingRqsAPI>
            <Header xmlns="http://ws.apache.org/ns/synapse">
                <Username>abcd</Username>
            </Header>
            <Body xmlns="http://ws.apache.org/ns/synapse">
                <SerialNo>100000000</SerialNo>
            </Body>
        </chan:ChangeSubOfferingRqsAPI>
    </soapenv:Body>
</soapenv:Envelope>

谁能帮我理解一个指南,即在有效负载工厂中更改什么,以便从和元素中删除 xmlns?而不是我只希望它。元素也是如此。HeaderBody<Header xmlns="http://ws.apache.org/ns/synapse"><Header>Body

XML xml-namespaces 有效负载 wso2-micro-integrator

评论


答:

0赞 ycr 8/31/2023 #1

您需要在有效负载中添加一个空命名空间,例如xmlns=""

<payloadFactory media-type="xml">
      <format>
        <soapenv:Envelope xmlns="" xmlns:chan="http://www.tibco.com/ChangeSubOfferingAPI/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
          <soapenv:Header/>
            <soapenv:Body>
              <chan:ChangeSubOfferingRqsAPI>
                <Header>
                  <Username>$1</Username>
                </Header>
                <Body>
                  <SerialNo>$2</SerialNo>
                </Body>
              </chan:ChangeSubOfferingRqsAPI>
            </soapenv:Body>
         </soapenv:Envelope>
       </format>
       <args>
         <arg evaluator="xml" expression="$ctx:userName"/>
         <arg evaluator="xml" expression="$ctx:password"/>
       </args>
</payloadFactory>