web-services - 如何使用名称/值对创建 HTTP POST 的 Mule ESB 服务?

标签 web-services http esb endpoints mule

我需要创建一个 mule 服务,它将数据 POST 到需要名称/值对(而不是 xml)的 Web 服务,然后处理来自该服务的 XML 响应。我找不到关于如何为 http POST 准备有效负载的好示例。

有人可以提供一些见解或示例吗?

到目前为止我所拥有的是(我不知道是否需要“PathToTransformerClass”):

    <service name="myService">
        <inbound>
            <vm:inbound-endpoint path="myService.request" synchronous="true">
                <custom-transformer class="PathToTransformerClass" />
            </vm:inbound-endpoint>
        </inbound>
        <outbound>
            <pass-through-router>
                <http:outbound-endpoint address="URIofWebServiceToPostTo" method="POST" synchronous="true">
                    <response-transformers>
                        <custom-transformer class="PathToClassToProcessTheResponse" />
                    </response-transformers>
                </http:outbound-endpoint>
            </pass-through-router>
        </outbound>
    </service>

最佳答案

以下内容可能会有所帮助:http://comments.gmane.org/gmane.comp.java.mule.user/29342

我也找不到任何示例,但看起来像是内置的 HTTP transformers

http-response-to-object-transformer A transformer that converts an HTTP response to a Mule Message. The payload may be a String, stream, or byte array.

http-response-to-string-transformer Converts an HTTP response payload into a string. The headers of the response will be preserved on the message.

object-to-http-request-transformer This transformer will create a valid HTTP request using the current message and any HTTP headers set on the current message.

message-to-http-response-transformer This transformer will create a valid HTTP response using the current message and any HTTP headers set on the current message.

对象到http-request-transformer可能是你最好的选择;也许您可以创建一个键值对映射,然后将其转换为 URL 编码形式?不确定,但希望这能为您提供一些有关 Google 的信息。

关于web-services - 如何使用名称/值对创建 HTTP POST 的 Mule ESB 服务?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3295188/

相关文章:

java - 用于使用 SOAP - WSDL 的命令行 java 客户端

c# - CORS 请求的资源上不存在 'Access-Control-Allow-Origin' header

firebase - 使用带有 Flutter Web App 的 http 包发布到 Cloud Firestore 及其 REST API

java - JBoss ESB - 如何为文件系统提供程序提供多个输入文件夹

c# - 使用 ESB(即 MassTransit)时,微服务如何才能真正独立?

java - 有人对 SeeBeyond/Sun 的 JCAPS 产品有任何反馈吗

web-services - 无法访问Web服务端点: Spring-WS 2

web-services - 具有基本身份验证和 SetCredentials 的 ServiceStack Web 服务

javascript - 正则表达式:匹配内容类型 http header 中的 javascript mime 类型

ruby-on-rails - Nginx 在非标准端口上代理 https 到 http?