Prezioso
Prezioso

Reputation: 171

Mule: Http->xml

Mule version: 3,5 (Actually, mule studio)

I'm new at using mule and can't seem to figure out how to do the following properly:

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 form:

<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.

Real Question: What could I use to transform the data from the inbound http to xml?

Side Question: I can send the whole payload to one 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?)

Upvotes: 1

Views: 282

Answers (1)

David Dossot
David Dossot

Reputation: 33413

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. Creating a schema representing the target XML would help a lot.
  • Otherwise, if you're using the Community Edition, you can use different options:
    • A Groovy component using the excellent MarkupBuilder to generate the target XML right from the inbound message payload,
    • 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).

I'm sure there are other options, but these should get you going :)

Upvotes: 1

Related Questions