web stats
Unable to Process SOAP Message - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 09-03-2012, 08:03 AM
polsonmrhc polsonmrhc is offline
What's HL7?
 
Join Date: May 2012
Location: McAlester, OK
Posts: 4
polsonmrhc is on a distinguished road
Default Unable to Process SOAP Message

Hello Everyone,

I'm trying to use a simple web form to pass a SOAP message containing an XML document to a web service listener channel (SOAP Listener.xml) and am not finding any success. So in trying to break the problem down into individual pieces, I decided to try using the Send Message dashboard task to send the SOAP message (see the SOAP Message.txt file) directly to the channel. Based on the data in the Raw Message tab under the View Messages task, it looks like it is recognizing the CDATA information (see the Raw Message.txt file), but it generates the following error:

Quote:
ERROR-300: Transformer error
ERROR MESSAGE: Error evaluating transformer
com.mirth.connect.server.MirthJavascriptTransforme rException:
CHANNEL: SOAP Listener
CONNECTOR: sourceConnector
SCRIPT SOURCE:
SOURCE CODE:
1: function validate(mapping, defaultValue, replacement) {var result = mapping;if ((result == undefined) || (result.toString().length == 0)) { if (defaultValue == undefined) { defaultValue = ''} result = defaultValue; } result = new java.lang.String(result.toString()); if (replacement != undefined) {for (i = 0; i < replacement.length; i++) { var entry = replacement[i]; result = result.replaceAll(entry[0], entry[1]); } } return result; }function $(string) { if (connectorMap.containsKey(string)) { return connectorMap.get(string); }else if (channelMap.containsKey(string)) { return channelMap.get(string); }else if (globalChannelMap.containsKey(string)) { return globalChannelMap.get(string); }else if (globalMap.containsKey(string)) { return globalMap.get(string); }else { return ''; }}function $g(key, value) {if (arguments.length == 1) { return globalMap.get(key); }else if (arguments.length == 2) { globalMap.put(key, value); }}function $gc(key, value) {if (arguments.length == 1) { return globalChannelMap.get(key); }else if (arguments.length == 2) { globalChannelMap.put(key, value); }}function $c(key, value) {if (arguments.length == 1) { return channelMap.get(key); }else if (arguments.length == 2) { channelMap.put(key, value); }}function $co(key, value) {if (arguments.length == 1) { return connectorMap.get(key); }else if (arguments.length == 2) { connectorMap.put(key, value); }}function $r(key, value) {if (arguments.length == 1) { return responseMap.get(key); }else if (arguments.length == 2) { responseMap.put(key, value); }}function createSegment(name, msgObj, index) {if (arguments.length == 1) { return new XML('<' + name + '></' + name + '>'); };if (arguments.length == 2) { index = 0; };msgObj[name][index] = new XML('<' + name + '></' + name + '>');return msgObj[name][index];}function createSegmentAfter(name, segment) {var msgObj = segment;while (msgObj.parent() != undefined) { msgObj = msgObj.parent(); }msgObj.insertChildAfter(segment[0], new XML('<' + name + '></' + name + '>'));return msgObj.child(segment[0].childIndex() + 1);}function getAttachments() {return Packages.com.mirth.connect.server.controllers.Cont rollerFactory.getFactory().createMessageObjectCont roller().getAttachmentsByMessage(messageObject);}f unction addAttachment(data, type) {var attachment = Packages.com.mirth.connect.server.controllers.Cont rollerFactory.getFactory().createMessageObjectCont roller().createAttachment(data, type, messageObject);messageObject.setAttachment(true);P ackages.com.mirth.connect.server.controllers.Contr ollerFactory.getFactory().createMessageObjectContr oller().insertAttachment(attachment);
2: return attachment;
3: }
4: XML.ignoreWhitespace=true;XML.prettyPrinting=false ;var newMessage = message.replace(/xmlns:?[^=]*=[""][^""]*[""]/g, '');
5: msg = new XML(newMessage);
6: if (msg.namespace("") != undefined) { default xml namespace = msg.namespace(""); } else { default xml namespace = ''; }
7: function doFilter() { phase = 'filter'; return true; }function doTransform() { phase = 'transformer'; logger = Packages.org.apache.log4j.Logger.getLogger(phase);
8:
9:
10: var mapping;try { mapping = msg['unit'].toString(); }catch (e) { logger.error(e); mapping = '';}channelMap.put('unit', validate( mapping , '', new Array()));
LINE NUMBER: 6
DETAILS: TypeError: The prefix "soapenv" for element "soapenv:Envelope" is not bound.
at com.mirth.connect.server.mule.transformers.JavaScr iptTransformer.evaluateScript(JavaScriptTransforme r.java:398)
at com.mirth.connect.server.mule.transformers.JavaScr iptTransformer.transform(JavaScriptTransformer.jav a:296)
at org.mule.transformers.AbstractEventAwareTransforme r.doTransform(AbstractEventAwareTransformer.java:4 8)
at org.mule.transformers.AbstractTransformer.transfor m(AbstractTransformer.java:197)
at org.mule.transformers.AbstractTransformer.transfor m(AbstractTransformer.java:200)
at org.mule.impl.MuleEvent.getTransformedMessage(Mule Event.java:251)
at org.mule.routing.inbound.SelectiveConsumer.isMatch (SelectiveConsumer.java:61)
at org.mule.routing.inbound.InboundMessageRouter.rout e(InboundMessageRouter.java:79)
at org.mule.providers.AbstractMessageReceiver$Default InternalMessageListener.onMessage(AbstractMessageR eceiver.java:487)
at org.mule.providers.AbstractMessageReceiver.routeMe ssage(AbstractMessageReceiver.java:266)
at org.mule.providers.AbstractMessageReceiver.routeMe ssage(AbstractMessageReceiver.java:225)
at com.mirth.connect.connectors.vm.VMMessageReceiver. getMessages(VMMessageReceiver.java:223)
at org.mule.providers.TransactedPollingMessageReceive r.poll(TransactedPollingMessageReceiver.java:108)
at org.mule.providers.PollingMessageReceiver.run(Poll ingMessageReceiver.java:97)
at org.mule.impl.work.WorkerContext.run(WorkerContext .java:290)
at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor.runWorker(ThreadPoolExecutor.java: 1061)
at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.run(ThreadPoolExecutor.java :575)
at java.lang.Thread.run(Thread.java:662)
Can anybody give me any idea where I'm going wrong on this one? Any help will be appreciated as I've spent easily over a month trying to get this form working. Thanks!
Attached Files
File Type: xml SOAP Listener.xml (11.8 KB, 51 views)
File Type: txt SOAP Message.txt (805 Bytes, 52 views)
File Type: txt Raw Message.txt (891 Bytes, 29 views)
Reply With Quote
  #2  
Old 09-03-2012, 12:17 PM
polsonmrhc polsonmrhc is offline
What's HL7?
 
Join Date: May 2012
Location: McAlester, OK
Posts: 4
polsonmrhc is on a distinguished road
Default

OK, I turned off the stripping of namespaces. Now the message seems to pass into Mirth, but the variable mappings from the XML aren't working. A bit closer, but still no joy.
Reply With Quote
  #3  
Old 09-04-2012, 08:11 AM
narupley's Avatar
narupley narupley is offline
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,125
narupley is on a distinguished road
Default

You will just need to reference the specific namespaces you want, and optionally make sopaenv your default namespace. Look here for more info (there are also several examples in these forums):

http://www.ecma-international.org/pu...s/Ecma-357.htm
http://wso2.org/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
  #4  
Old 09-09-2012, 10:26 AM
polsonmrhc polsonmrhc is offline
What's HL7?
 
Join Date: May 2012
Location: McAlester, OK
Posts: 4
polsonmrhc is on a distinguished road
Default

Thank you for the references, Nick. But I don't know if they address the problem (and keep in mind that it may be because I'm new to XML, XML HTTP requests, etc.).

I have been able to successfully send the soap message using soapUI and have it be received and properly parsed by the Mirth channel. What seems to be the issue now is the web form itself (see the attached file - I added the .txt extension to get it to upload). I've read Ch. 18 of JavaScript: The Definitive Guide and understand everything presented in that chapter (or at least I think I do ). I've also researched multiple web sites (too many to count at this point), and I think I'm following the examples properly. But something is still missing because the Mirth channel doesn't acknowledge that it has received a message (counters, errors, etc.). Wireshark shows some differences between what is being sent from soapUI vs Firefox, but nothing that sticks out at me as a problem. I'm assuming the
Quote:
<ws:acceptMessage>
in the soap envelope makes any explicit soapAction header to be unnecessary.

Is it still an issue with namespaces? Are there issues when using Firefox 15? Do I have to actively look at the request response to have Mirth fully accept the message? I've yet to find the magic incantation. Does anybody have any clues? I've not been able to find anything in the forums on this. Thanks!
Attached Files
File Type: txt JSPDoc2.jsp.txt (5.7 KB, 31 views)
Reply With Quote
  #5  
Old 02-04-2013, 10:42 AM
sarcophyton sarcophyton is offline
OBX.2 Kenobi
 
Join Date: Jan 2012
Posts: 67
sarcophyton is on a distinguished road
Default

OK, I turned off the stripping of namespaces, and now I get ERROR-300: Transformer error
ERROR MESSAGE: Error evaluating transformer
org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.

I am doing a Message Builder step:
Message Segment = tmp['S:Body']['ns3:RespondingGateway_PRPA_IN201305UV02Request']['ns3:PRPA_IN201305UV02']['ns3:controlActProcess']['ns3:queryByParameter']['ns3arameterList']['ns3:livingSubjectName']['ns3:value']['ns3:family']
Mapping = msg['PID']['PID.5']['PID.5.1'].toString()

Thanks,
Dave
Reply With Quote
  #6  
Old 02-04-2013, 10:46 AM
narupley's Avatar
narupley narupley is offline
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,125
narupley is on a distinguished road
Default

Quote:
Originally Posted by sarcophyton View Post
OK, I turned off the stripping of namespaces, and now I get ERROR-300: Transformer error
ERROR MESSAGE: Error evaluating transformer
org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.

I am doing a Message Builder step:
Message Segment = tmp['S:Body']['ns3:RespondingGateway_PRPA_IN201305UV02Request']['ns3:PRPA_IN201305UV02']['ns3:controlActProcess']['ns3:queryByParameter']['ns3arameterList']['ns3:livingSubjectName']['ns3:value']['ns3:family']
Mapping = msg['PID']['PID.5']['PID.5.1'].toString()

Thanks,
Dave
Unfortunately the current drag-and-drop transfer handler doesn't account for namespaces present in the document. There's already an open issue for this (vote for it; the squeaky wheel gets the oil): MIRTH-1110. In the meantime, you'll have to have a preceding step that defines your Namespace objects, and then you'll need to change your Message Builder LHS to use those objects (with the ns::node syntax). Look here for more info.
__________________
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

Tags
send message, soap, soap listener, web form, 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 08:45 AM.


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