web stats
Creating a SOAP Listener for messages which don't fit the default XML schema - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 04-02-2015, 10:33 AM
ohollarens ohollarens is offline
Mirth Newb
 
Join Date: Mar 2013
Posts: 15
ohollarens is on a distinguished road
Question Creating a SOAP Listener for messages which don't fit the default XML schema

Hi there,

I've been doing my best to scour the wiki and the forums before posting this, but haven't been able to find info relevant to this specific issue. I've created several Mirth channels in the past, but this is my first time trying to create a Web Service listener to accept SOAP messages and I'm having some issues.

So right now, I've created a simple channel with the default Web Service connector config. Once the channel is up, I'm able to send simple generated test messages to it with SoapUI, but the issue comes when I try to send a message in the format that a customer is trying to send them to me, which differs from the format that Mirth is expecting.

For example, Mirth defaults to expecting the messages to define this at the top:

Code:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.connectors.connect.mirth.com/">
However, the message the customer is sending instead defines this at the start:

Code:
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
So right off the bat, Mirth rejects the message because it's defining itself as a different schema than Mirth is expecting. In addition to that, Mirth's web service is expecting the SOAP message to try to hit the default "ws:acceptMessage" method in the message body, but the message is actually trying to hit a completely different function name with very different parameters, which it defines here:

Code:
<ProvideAndRegisterDocumentSetRequest xmlns="urn:ihe:iti:xds-b:2007">
	<lcm:SubmitObjectsRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:lcm="urn:oasis:names:tc:ebxml-regrep:xsd:lcm:3.0" xmlns:rim="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0" xmlns:rs="urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0" xmlns="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0">
So I'm pretty lost with this right now. I'll attach both my channel and an example message. If anyone could help clue me in to how to rectify these kind of differences between what Mirth is expecting by default and what a message is requesting, I'd really appreciate it.

Thanks!

Mirth version: 2.2.3.6825

Edit: Looking around, this thread seems to be dealing with a message in a similar format to mine. Is it possible I'd instead want an HTTP listener?
Attached Files
File Type: xml SOAPChannel.xml (4.6 KB, 40 views)
File Type: xml example_message.xml (54.3 KB, 27 views)

Last edited by ohollarens; 04-02-2015 at 10:52 AM.
Reply With Quote
  #2  
Old 04-02-2015, 11:24 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,123
narupley is on a distinguished road
Default

Yes, you should be able to use an HTTP Listener to handle weird cases like that. It's very easy to do so in 3.1 or later, because the HTTP Listener has been vastly improved, and in particular now has the ability to host static resources, like a WSDL and XSDs. That's exactly what you'd want to do to prop up an HTTP Listener channel that "acts like" a SOAP web service listener.
__________________
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 04-08-2015, 03:30 PM
ohollarens ohollarens is offline
Mirth Newb
 
Join Date: Mar 2013
Posts: 15
ohollarens is on a distinguished road
Default

Just realized I hadn't responded to this yet. Thanks a lot for the advice. Currently tweaking the receiver to be an HTTP listener and I'll see how the transformation and sending goes.
Reply With Quote
  #4  
Old 04-08-2015, 05:12 PM
ohollarens ohollarens is offline
Mirth Newb
 
Join Date: Mar 2013
Posts: 15
ohollarens is on a distinguished road
Default

Hey, quick follow-up question if you wouldn't mind.

I now have the channel receiving over an HTTP listener and then passing it to the LLP Sender. What I'm trying to do is extract a base64 string which lives a few nodes deep in the XML message using a destination Javascript transform.

The basic structure of the XML is like this:

Code:
<s:Envelope  >
	<s:Header>
	</s:Header>
	<s:Body>
        </s:Body>
</s:Envelope  >
However, I've run into some issues actually getting at the XML content. I have the source and destination connector data types set to XML and to strip namespaces, so instead of:

Code:
<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope">
it ends up as:

Code:
<s:Envelope  >
As I understand it, when Mirth turns source XML into an XML object type, it gets rid of the highest level node. So without having to worry about the <s:Envelope > node, I should theoretically be able to access the content of this node with something like:

Code:
channelMap.put('s:Body', msg['s:Body'].toString());
However, nothing that I've tried has worked so far. First, I tried this without defining a message template. Then I pasted the message into the message template window and dragged the 's:Body' node out of the tree and it produced the exact snippet above, but it still shows as empty every time I try to put it on the channel map.

So far, I haven't had any degree of success accessing any part of the msg object in Javascript other than looking at the whole thing with toString(). Could you clue me into what I'm doing wrong at all?

Thanks so much.

(I'll attach the channel and both the message with and without namespaces).
Attached Files
File Type: xml XMLWithNamespaces.xml (57.8 KB, 20 views)
File Type: xml XMLWithoutNamespaces.xml (52.7 KB, 10 views)
File Type: xml MirthChannel.xml (76.7 KB, 36 views)
Reply With Quote
  #5  
Old 04-09-2015, 06:21 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,123
narupley is on a distinguished road
Default

That is related to MIRTH-3129 and MIRTH-3196. Basically you want to turn off Strip Namespaces, and then extract the node using the correct E4X namespace syntax. This site can help with that: http://wso2.com/project/mashup/0.2/d...uickstart.html

There are also many, many threads here on the forums dealing with that.
__________________
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
  #6  
Old 04-09-2015, 10:23 AM
ohollarens ohollarens is offline
Mirth Newb
 
Join Date: Mar 2013
Posts: 15
ohollarens is on a distinguished road
Default

Thanks for the links, I wasn't able to find those while searching. After some more trial and error, it looks like I'm making progress using this pattern:

Code:
msg.*::['Body'].toString();
Thanks again for your help!

Last edited by ohollarens; 04-09-2015 at 10:55 AM.
Reply With Quote
Reply

Tags
listener, soap, soap envelope, web service, xml

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 06:25 PM.


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