Announcement

Collapse
No announcement yet.

Handling SOAP response Problems with namespace

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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 ??


  • #2
    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&#039;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

    Comment


    • #3
      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.

      Comment


      • #4
        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

        Comment


        • #5
          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?

          Comment

          Working...
          X