【问题标题】:web Service Consumer component in mulemule 中的 web 服务使用者组件
【发布时间】:2017-12-26 04:44:52
【问题描述】:

Web 服务使用者在使用转换器消息时正在返回值。但是当我使用 xslt 组件时它不起作用。它返回 null。

这是我的流程。

Http->字节数组转字符串->xslt->webservice消费者。

谁能帮帮我?

这是我的意见

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

<PayLoad>
 <RoutingHeader>
    <SourceID>1234</SourceID>
    <SourceName>ISGN</SourceName>
    <SourceRefNum>167309</SourceRefNum>
    <SourceRoutingRef />
    <DestinationID>999</DestinationID>
    <DestinationRefNum />
    <DestinationRoutingRef />
    <TransDate>2017-04-17T09:04:24.702000-04:00</TransDate>
  </RoutingHeader>
<PayLoad>

我正在使用 xslt 组件将此 xml 转换为肥皂

这是我的 xsl xode

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:s="URI_SOAP_WS">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:header/>
    <soap:Body>
        <xsl:apply-templates/>
    </soap:Body>
</soap:Envelope>
</xsl:template>
<xsl:template match="*">
 <xsl:element name="s:{local-name()}" namespace="http://spring.io/guides/s-
  producing-web-service">
    <xsl:apply-templates select="node()|@*" />
</xsl:element>
</xsl:template>
</xsl:stylesheet>

当我将此soap文件发送到webservice消费者组件时,得到null

【问题讨论】:

  • 请添加您的输入和 xsl 代码 - 它会更容易为您提供帮助。
  • 我已经添加了我的输入文件和 xsl 文件。你能帮帮我吗?

标签: xml web-services xslt soap mule


【解决方案1】:

您的意思是网络服务提供商返回不同的值吗?

你能检查这两种情况下发送的输入吗? Dataweave 对 XML 的操作与 json 或 java 对象不同。

尝试通过浏览器访问webservice,找到正确的输入结构,并在flow中实现。

【讨论】:

  • 它返回 null。
【解决方案2】:

当我使用您的 XSL 转换 XML 时,我得到以下结果:

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:s="URI_SOAP_WS" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:header/>
<soap:Body>
<s:PayLoad xmlns:s="http://spring.io/guides/s-producing-web-service">
<s:RoutingHeader>
<s:SourceID>1234</s:SourceID>
<s:SourceName>ISGN</s:SourceName>
<s:SourceRefNum>167309</s:SourceRefNum>
<s:SourceRoutingRef/>
<s:DestinationID>999</s:DestinationID>
<s:DestinationRefNum/>
<s:DestinationRoutingRef/>
<s:TransDate>2017-04-17T09:04:24.702000-04:00</s:TransDate>
</s:RoutingHeader>
</s:PayLoad>
</soap:Body>
</soap:Envelope>

当您将使用架构http://schemas.xmlsoap.org/soap/envelope/检查此转换后的代码时
您将遇到以下错误:

使用 XML 模式验证当前文件:

ERROR: Element '{http://schemas.xmlsoap.org/soap/envelope/}header': This element is not expected. Expected is one of ( {http://schemas.xmlsoap.org/soap/envelope/}Header, {http://schemas.xmlsoap.org/soap/envelope/}Body ).

这意味着只有块&lt;soap:header/&gt;应该从大写为&lt;soap:Header/&gt;,在XSL中更改它并重试。

如果仍有问题,请尝试以下检查:

How to use Web-Service-Consumer connector in Mule Community Edition

mule - web service consumer (soap) always returns null

【讨论】:

  • 谢谢。我的问题不在于将 xml 转换为肥皂。但与网络服务消费者。当我将soap文件传递给Web服务使用者时,它返回空值
  • @KarthickRicky 您是否尝试过使用正确的
    转换为肥皂,然后将您的肥皂传递给网络服务使用者?
  • 是的。我试过了。但它不起作用。只有当我将soap文件发送给网络服务消费者时它才返回null。
  • @KarthickRicky 我已经编辑了带有附加链接的答案,希望对您的情况有所帮助。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-11-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多