web stats
SOAP Question for a newbie. - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 04-27-2012, 07:39 AM
jupiterUK jupiterUK is offline
Mirth Newb
 
Join Date: Apr 2012
Posts: 11
jupiterUK is on a distinguished road
Default SOAP Question for a newbie.

Hi All,

I'm totally new to Mirth and need some advice with setting up a new Channel. I have a SOAP Template that could include more than the 3 entries for OUT_DERIVED_ATTRIBUTE_id_*. Is there a recommended methodology to capture the possibility of more than the 3 OUT_DERIVED_ATTRIBUTE_id's below?

<ns1:WorkDocuments>
<ns1:CONTROL id="CONTROL_id_1">
<ns1:ERROR_FOUND>false</ns1:ERROR_FOUND>
<ns1:executeRules>true</ns1:executeRules>
<ns1:TRUSTID_ID>TEST</ns1:TRUSTID_ID>
<ns1:EXPERIENCE_NUMBER>00001234</ns1:EXPERIENCE_NUMBER>
<ns1:VISIT_ID>123456789</ns1:VISIT_ID>
<ns1:OUT_DERIVED_ATTRIBUTE href="#OUT_DERIVED_ATTRIBUTE_id_1"/>
<ns1:OUT_DERIVED_ATTRIBUTE href="#OUT_DERIVED_ATTRIBUTE_id_2"/>
<ns1:OUT_DERIVED_ATTRIBUTE href="#OUT_DERIVED_ATTRIBUTE_id_3"/>
</ns1:CONTROL>
<ns1:OUT_DERIVED_ATTRIBUTE id="OUT_DERIVED_ATTRIBUTE_id_1">
<ns1:ATTRIBUTE_NAME>TEST_COLUMN_1</ns1:ATTRIBUTE_NAME>
<ns1:ATTRIBUTE_STATUS>NEW</ns1:ATTRIBUTE_STATUS>
<ns1:ATTRIBUTE_TABLE>TESTING_TABLE</ns1:ATTRIBUTE_TABLE>
<ns1:ATTRIBUTE_VALUE>Y</ns1:ATTRIBUTE_VALUE>
</ns1:OUT_DERIVED_ATTRIBUTE>
<ns1:OUT_DERIVED_ATTRIBUTE id="OUT_DERIVED_ATTRIBUTE_id_2">
<ns1:ATTRIBUTE_NAME>TEST_COLUMN_2</ns1:ATTRIBUTE_NAME>
<ns1:ATTRIBUTE_STATUS>NEW</ns1:ATTRIBUTE_STATUS>
<ns1:ATTRIBUTE_TABLE>TESTING_TABLE</ns1:ATTRIBUTE_TABLE>
<ns1:ATTRIBUTE_VALUE>N</ns1:ATTRIBUTE_VALUE>
</ns1:OUT_DERIVED_ATTRIBUTE>
<ns1:OUT_DERIVED_ATTRIBUTE id="OUT_DERIVED_ATTRIBUTE_id_3">
<ns1:ATTRIBUTE_NAME>TEST_COLUMN_3</ns1:ATTRIBUTE_NAME>
<ns1:ATTRIBUTE_STATUS>IDENTICAL</ns1:ATTRIBUTE_STATUS>
<ns1:ATTRIBUTE_TABLE>TESTING_TABLE</ns1:ATTRIBUTE_TABLE>
<ns1:ATTRIBUTE_VALUE>2</ns1:ATTRIBUTE_VALUE>
</ns1:OUT_DERIVED_ATTRIBUTE>
</ns1:WorkDocuments>

At present I've created the Source Transformer with

Variable: AttributeNameNS1
Mapping: msg['SOAP:Body']['ns1:CorticonResponse']['ns1:WorkDocuments']['ns1:OUT_DERIVED_ATTRIBUTE'][0]['ns1:ATTRIBUTE_NAME'].toString()

Variable: AttributeTableNS1
msg['SOAP:Body']['ns1:CorticonResponse']['ns1:WorkDocuments']['ns1:OUT_DERIVED_ATTRIBUTE'][0]['ns1:ATTRIBUTE_TABLE'].toString()

Variable: AttributeStatusNS1
msg['SOAP:Body']['ns1:CorticonResponse']['ns1:WorkDocuments']['ns1:OUT_DERIVED_ATTRIBUTE'][0]['ns1:ATTRIBUTE_STATUS'].toString()

Variable: AttributeValueNS1
msg['SOAP:Body']['ns1:CorticonResponse']['ns1:WorkDocuments']['ns1:OUT_DERIVED_ATTRIBUTE'][0]['ns1:ATTRIBUTE_VALUE'].toString()

and repeating this for each additional 2 more in the SOAP example then creating upto 10 more if they exist further..

Last edited by jupiterUK; 04-27-2012 at 07:43 AM.
Reply With Quote
  #2  
Old 04-30-2012, 06:58 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 3,583
narupley is on a distinguished road
Default

Assuming that there aren't any namespace issues in your channel (make sure that you aren't stripping namespaces in the protocol settings, and you may want to set the default namespace explicitly), you could do this:

Code:
for each (oda in msg.Body.ns1::CorticonResponse.ns1::WorkDocuments.ns1::OUT_DERIVED_ATTRIBUTE) {
	logger.info('Name: '+oda.ns1::ATTRIBUTE_NAME.toString()+
		' Table: '+oda.ns1::ATTRIBUTE_TABLE.toString()+
		' Status: '+oda.ns1::ATTRIBUTE_STATUS.toString()+
		' Value: '+oda.ns1::ATTRIBUTE_VALUE.toString());
}
Reply With Quote
  #3  
Old 04-30-2012, 08:32 AM
jupiterUK jupiterUK is offline
Mirth Newb
 
Join Date: Apr 2012
Posts: 11
jupiterUK is on a distinguished road
Default Hello

Hi there,

Thanks for that I will give it a try.

Thanks
AJ
Reply With Quote
Reply

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 -7. The time now is 09:20 AM.


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