web stats
Webservice Sender Loop - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 10-20-2014, 05:47 AM
andresilva3 andresilva3 is offline
OBX.1 Kenobi
 
Join Date: Oct 2014
Posts: 27
andresilva3 is on a distinguished road
Default Webservice Sender Loop

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

Quote:
<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 at 06:30 AM.
Reply With Quote
  #2  
Old 10-20-2014, 06:25 AM
andresilva3 andresilva3 is offline
OBX.1 Kenobi
 
Join Date: Oct 2014
Posts: 27
andresilva3 is on a distinguished road
Default

What I mean is how can I call a WebService mapping repeated nodes?

Last edited by andresilva3; 10-20-2014 at 06:31 AM.
Reply With Quote
  #3  
Old 10-20-2014, 07:03 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,116
narupley is on a distinguished road
Default

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.
Reply With Quote
  #4  
Old 10-20-2014, 07:37 AM
andresilva3 andresilva3 is offline
OBX.1 Kenobi
 
Join Date: Oct 2014
Posts: 27
andresilva3 is on a distinguished road
Default

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 at 07:40 AM.
Reply With Quote
Reply

Tags
loop, webservice

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 02:28 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation