简体   繁体   English

ule子:Http-> xml

[英]Mule: Http->xml

Mule version: 3,5 (Actually, mule studio) ule子版本:3,5(实际上是m子工作室)

I'm new at using mule and can't seem to figure out how to do the following properly: 我是使用m子的新手,似乎无法弄清楚如何正确执行以下操作:

Want to achieve: Send data from a html form to mule which then splits the payload and sends one part to one java program and the other to another. 要实现:将数据从html表单发送到mule,然后将其拆分为有效负载,并将一部分发送给一个Java程序,将另一部分发送给另一个Java程序。

Html form: HTML形式:

<form method="GET" action="http://localhost:8081">
 <input type="text" name="name"/>
 <input type="text" name="lastname"/>
 <input type="submit" value="Submit" />
</form>

This points to localhost and the port which is set in MuleStudio. 这指向localhost和在MuleStudio中设置的端口。

Real Question: What could I use to transform the data from the inbound http to xml? 真正的问题:我可以使用什么将数据从入站http转换为xml?

Side Question: I can send the whole payload to one javaprogram. 附加问题:我可以将整个有效负载发送到一个javaprogram。 (first a POJO and then to the actual program. - is this the right way or can I send it to the program and skipping the POJO?) (首先是POJO,然后是实际的程序。-这是正确的方法吗,还是可以将其发送到程序中并跳过POJO?)

Since your main concern is about transformation, let's only address it. 由于您主要关注的是转换,所以我们只解决它。

  • If you're using the Enterprise Edition, you can use DataMapper to generate the XML you need. 如果使用的是Enterprise Edition,则可以使用DataMapper生成所需的XML。 Creating a schema representing the target XML would help a lot. 创建一个表示目标XML的模式会很有帮助。
  • Otherwise, if you're using the Community Edition, you can use different options: 否则,如果您使用的是Community Edition,则可以使用其他选项:
    • A Groovy component using the excellent MarkupBuilder to generate the target XML right from the inbound message payload, 一个Groovy组件,使用出色的MarkupBuilder来从入站消息有效负载中生成目标XML,
    • A chain of standard transformers that first transform the submitted data to a generic XML form ( object-to-xml-transformer ) then transform it to the desired form ( xslt-transformer ). 一系列标准转换器,首先将提交的数据转换为通用XML形式( object-to-xml-transformer ),然后将其转换为所需形式( xslt-transformer )。

I'm sure there are other options, but these should get you going :) 我确定还有其他选择,但是这些应该可以帮助您:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM