web stats
Another parsing SOAP responses thread - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 01-22-2014, 11:55 AM
discofris discofris is offline
OBX.1 Kenobi
 
Join Date: Jan 2014
Location: Belgium
Posts: 46
discofris is on a distinguished road
Default Another parsing SOAP responses thread

I'm also trying to parse my soap responses to an HL7 message.

I've tried with the Replace function and the URLdecode function as in this topic: http://www.mirthcorp.com/community/f...ead.php?t=1819 but that wasn't really successful .

This is my response that I'd like to parse:

Code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?><soap:Envelope   ><soap:Header/><soap:Body><GetPendingTransactionsResponse ><GetPendingTransactionsResult>&lt;TransactionResult &gt;
  &lt;API_Transaction_Log&gt;
    &lt;ikAPI_transaction_log&gt;2597&lt;/ikAPI_transaction_log&gt;
    &lt;tStamp&gt;2014-01-22T20:31:59.6429784+01:00&lt;/tStamp&gt;
    &lt;cTransaction_direction&gt;OUTBOUND&lt;/cTransaction_direction&gt;
    &lt;cTransaction_type&gt;Outbound_Transaction&lt;/cTransaction_type&gt;
    &lt;cTransaction_code&gt;RETRIEVE&lt;/cTransaction_code&gt;
    &lt;tTransaction&gt;User ID : integrator  -  User password : *****  -  XML Data : &amp;lt;PendingTransaction &amp;gt;&amp;lt;iInterface_nbr&amp;gt;1&amp;lt;/iInterface_nbr&amp;gt;&amp;lt;/PendingTransaction&amp;gt;&lt;/tTransaction&gt;
    &lt;iExit_status&gt;0&lt;/iExit_status&gt;
    &lt;cDesc_exit_status&gt;Transaction traitée.&lt;/cDesc_exit_status&gt;
  &lt;/API_Transaction_Log&gt;
  &lt;PendingTransactions&gt;
    &lt;ikAPI_transaction_out&gt;52836&lt;/ikAPI_transaction_out&gt;
    &lt;Key_request&gt;11702&lt;/Key_request&gt;
    &lt;unique_id /&gt;
    &lt;record&gt;T1313&lt;/record&gt;
    &lt;name&gt;INCONNU 21/11/2013 12:41&lt;/name&gt;
    &lt;surname&gt;INCONNU 21/11/2013 12:41&lt;/surname&gt;
  &lt;/PendingTransactions&gt;
&lt;/TransactionResult&gt;</GetPendingTransactionsResult></GetPendingTransactionsResponse></soap:Body></soap:Envelope>
If I could only already replace those encoded tags ...

Any guidance highly appreciated.
Reply With Quote
  #2  
Old 01-22-2014, 11:58 AM
narupley's Avatar
narupley narupley is offline
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,125
narupley is on a distinguished road
Default

What specific code are you using and what problems are you having? There are dozens of examples on these forums dealing with parsing XML messages like this.
__________________
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
  #3  
Old 01-22-2014, 12:04 PM
discofris discofris is offline
OBX.1 Kenobi
 
Join Date: Jan 2014
Location: Belgium
Posts: 46
discofris is on a distinguished road
Default

I have 2 destinations in my channel. First one sends the soap message and the second one currently writes the response to a simple file.

This is the transformer in my second channel:
Code:
var destination = responseMap.get('GetPending');
var responseMessage = destination.getMessage();
var xmlResponse = new XML(responseMessage);
Reply With Quote
  #4  
Old 01-22-2014, 12:12 PM
discofris discofris is offline
OBX.1 Kenobi
 
Join Date: Jan 2014
Location: Belgium
Posts: 46
discofris is on a distinguished road
Default

Quote:
Originally Posted by narupley View Post
There are dozens of examples on these forums dealing with parsing XML messages like this.
I know there are dozens of examples. This one e.g.:
http://www.mirthcorp.com/community/f...+soap+response

But I wanna get rid of those ugly &lt; &gt; tags ...
__________________
Mirth Connect Server 3.4.1.8057
Java version: 1.8.0_101

on Debian 8.5 and various Winboxes
Reply With Quote
  #5  
Old 01-22-2014, 12:43 PM
narupley's Avatar
narupley narupley is offline
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,125
narupley is on a distinguished road
Default

First of all, that response appears to be invalid. There are bound prefixes, but no corresponding namespace declaration. It looks like you have incorrectly stripped the namespaces at some point.

Second, in your transformer, you need to define a Namespace object, and use it to reference the Body tag underneath the root node. You would use the "ns::node" syntax for that; look here for more info: http://wso2.com/project/mashup/0.2/d...uickstart.html
__________________
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
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 -8. The time now is 04:28 AM.


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