web stats
Handling SOAP response Problems with namespace - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 04-23-2007, 12:32 AM
huubvandemortel huubvandemortel is offline
OBX.2 Kenobi
 
Join Date: Apr 2007
Posts: 55
huubvandemortel
Default Handling SOAP response Problems with namespace

I'm stil having problems handling the XML syntax from a SOAP response. At the end I would like to create a configuration that read HL7-Query messages, sends the question to a SOAP, process the SOAP response and send it backup to the HL7-Questionar. Although I don't know how to configure the last step in the Query/Response channel, I try to send the SOAP response to another channel to process it.
This channel uses a channel reader to readin the SOAP-response and tries to transform it to HL7.

I'm keep getting errors on the namespace (soap)..

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>

ERROR-200: Filter error
ERROR MESSAGE: Error evaluating filter
org.mozilla.javascript.EcmaError: TypeError: error: Use of undefined namespace prefix: soap (ce5b78e9-be24-48dd-9a65-d7492eb3ed06#5)
at org.mozilla.javascript.ScriptRuntime.constructErro r(ScriptRuntime.java:3226)
at org.mozilla.javascript.ScriptRuntime.constructErro r(ScriptRuntime.java:3216)
at org.mozilla.javascript.ScriptRuntime.typeError(Scr iptRuntime.java:3232)
at org.mozilla.javascript.xmlimpl.XML.createFromJS(XM L.java:378)
at org.mozilla.javascript.xmlimpl.XML.jsConstructor(X ML.java:3050)
at org.mozilla.javascript.xmlimpl.XMLObjectImpl.execI dCall(XMLObjectImpl.java:546)
at org.mozilla.javascript.IdFunctionObject.call(IdFun ctionObject.java:124)
at org.mozilla.javascript.BaseFunction.construct(Base Function.java:310)
at org.mozilla.javascript.ScriptRuntime.newObject(Scr iptRuntime.java:2067)
at org.mozilla.javascript.gen.c137._c2(ce5b78e9-be24-48dd-9a65-d7492eb3ed06:5)
at org.mozilla.javascript.gen.c137.call(ce5b78e9-be24-48dd-9a65-d7492eb3ed06)
at org.mozilla.javascript.optimizer.OptRuntime.callNa me0(OptRuntime.java:106)
at org.mozilla.javascript.gen.c137._c0(ce5b78e9-be24-48dd-9a65-d7492eb3ed06:6)
at org.mozilla.javascript.gen.c137.call(ce5b78e9-be24-48dd-9a65-d7492eb3ed06)
at org.mozilla.javascript.ContextFactory.doTopCall(Co ntextFactory.java:337)
at org.mozilla.javascript.ScriptRuntime.doTopCall(Scr iptRuntime.java:2755)
at org.mozilla.javascript.gen.c137.call(ce5b78e9-be24-48dd-9a65-d7492eb3ed06)
at org.mozilla.javascript.gen.c137.exec(ce5b78e9-be24-48dd-9a65-d7492eb3ed06)
at com.webreach.mirth.server.mule.transformers.JavaSc riptTransformer.evaluateFilterScript(JavaScriptTra nsformer.java:268)
at com.webreach.mirth.server.mule.transformers.JavaSc riptTransformer.transform(JavaScriptTransformer.ja va:221)
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:492)
at org.mule.providers.AbstractMessageReceiver.routeMe ssage(AbstractMessageReceiver.java:271)
at org.mule.providers.AbstractMessageReceiver.routeMe ssage(AbstractMessageReceiver.java:230)
at org.mule.providers.AbstractMessageReceiver.routeMe ssage(AbstractMessageReceiver.java:225)
at com.webreach.mirth.server.mule.providers.vm.VMMess ageReceiver.getMessages(VMMessageReceiver.java:105 )
at org.mule.providers.TransactedPollingMessageReceive r.poll(TransactedPollingMessageReceiver.java:108)
at org.mule.providers.PollingMessageReceiver.run(Poll ingMessageReceiver.java:73)
at org.mule.impl.work.WorkerContext.run(WorkerContext .java:290)
at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.runTask(ThreadPoolExecutor. java:650)
at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.run(ThreadPoolExecutor.java :675)
at java.lang.Thread.run(Unknown Source)


On the source I defined a transformer step with

msg.setNamespace(new Namespace("soap","http://schemas.xmlsoap.org/soap/envelope/"));

Buit that did not work, is there anything clearly wrong here ??

Reply With Quote
  #2  
Old 04-23-2007, 12:47 AM
chrisl chrisl is offline
Mirth Employee
 
Join Date: Aug 2006
Posts: 967
chrisl is an unknown quantity at this point
Default Re: Handling SOAP response Problems with namespace

There are two options:

1. Add the msg.setNamespace code to the Filter and Transformer on each source and destination connection. You might also want to add the following line:

Code:
default xml namespace = new Namespace("soap","http://schemas.xmlsoap.org/soap/envelope/");
2. You can pre-process the message to remove the namespace qualifiers:
In your preprocessor do:
Code:
return message.replace(/<soap:/g, "<").replace(/<\/soap:/g, "</");
You might need to play with the regular expression a bit (I'm not 100% sure on the second expressions replacements) but you should get the idea.

This issue arose because Mirth strips out namespace declarations on incoming messages (so that the msg[] notation works). We are working on a fix for this behavior in 1.4.1.

-Chris
__________________
Chris Lang
Reply With Quote
  #3  
Old 09-14-2007, 08:04 AM
Urm Urm is offline
What's HL7?
 
Join Date: Sep 2007
Posts: 1
Urm
Default Re: Handling SOAP response Problems with namespace

I'm using version 1.6.1 and still have the same problem.

Actually, adding namespace declarations by script is not very firm way if working with incoming SOAP messages. There can be lot of namespaces and aliases for them are not fixed. There can be ns2, ns3 or something totally different.

And -- if Mirth cuts out namespace declarations then it must cut out uses of namespace aliases as well (of cource, this may rise other problems). But cutting something out and leaving some other thing makes XML not valid and this makes Mirth totally unusable.

Reply With Quote
  #4  
Old 09-14-2007, 10:16 AM
chrisl chrisl is offline
Mirth Employee
 
Join Date: Aug 2006
Posts: 967
chrisl is an unknown quantity at this point
Default Re: Handling SOAP response Problems with namespace

You can turn off namespace stripping quite easily.

You don't have to declare each namespace, however you do need to include the namespace when referencing elements using E4X.
__________________
Chris Lang
Reply With Quote
  #5  
Old 06-18-2009, 04:34 AM
Dagan Dagan is offline
OBX.2 Kenobi
 
Join Date: Jun 2009
Posts: 60
Dagan is on a distinguished road
Default

Hi I'm getting this error with the last version and I have tested all the different solutions I've found in the forum and I have not been able to fix it.

How can I turn off namespace stripping?
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with the namespace of an HL7 XML Doris Support 8 02-18-2009 03:29 AM
SOAP envelope namespace problem krlosnow Support 2 10-24-2008 01:12 AM
Problems with Soap Response vlewis Support 2 10-02-2008 08:20 AM
handling channel response jerchap Support 0 07-30-2008 01:52 PM
SOAP Listener namespace cord73 Support 2 05-03-2007 06:17 AM


All times are GMT -8. The time now is 09:11 AM.


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