Announcement

Collapse
No announcement yet.

Webservice Sender Loop

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Webservice Sender Loop

    So I'm using a WebService sender and the XML looks like this:

    <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ede="http://edeia.com">
    <soap:Header>
    <ede:SoapHeaderAutenticacao/>
    </soap:Header>
    <soap:Body>
    <ede:repeatableElement>
    <ede:id></soap:id>
    </ede:repeatableElement>
    <ede:repeatableElement>
    <ede:id></soap:id>
    </ede:repeatableElement>
    </soap:Body>
    </soap:Envelope>
    Is there some way to create a loop structure inside a SOAP Envelope? Because as you can see, this element "ProAnalisesProcesso" can have zero or more repetitions. How can I do this?
    Last edited by andresilva3; 10-20-2014, 06:30 AM.

  • #2
    What I mean is how can I call a WebService mapping repeated nodes?
    Last edited by andresilva3; 10-20-2014, 06:31 AM.

    Comment


    • #3
      You can use the #foreach Velocity directive:

      Code:
      <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ede="http://edeia.com">
      	<soap:Header>
      		<ede:SoapHeaderAutenticacao/>
      	</soap:Header>
      	<soap:Body>
      		#foreach($element in $elementList)
      			<ede:repeatableElement>
      				<ede:id>$element</soap:id>
      			</ede:repeatableElement>
      		#end
      	</soap:Body>
      </soap:Envelope>
      That assumes you have a list or array of IDs in one of the variable maps first.

      Another option is to use a transformer to build up the SOAP envelope XML. In JavaScript you can iterate however you wish and build up repeating nodes.
      Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

      Nicholas Rupley
      Work: 949-237-6069
      Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


      - How do I foo?
      - You just bar.

      Comment


      • #4
        I'm opting by doing that in JavaScript since I oversimplified the XML for better understanding. I only have one question, when I create a new XML to map and use in the envelope, how do I create one with a specific namespace?
        Last edited by andresilva3; 10-20-2014, 07:40 AM.

        Comment

        Working...
        X