No announcement yet.

Handling SOAP response Problems with namespace

  • 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=""
    xmlns:xsd="" xmlns:xsi="">

    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(
    at org.mozilla.javascript.ScriptRuntime.constructErro r(
    at org.mozilla.javascript.ScriptRuntime.typeError(Scr
    at org.mozilla.javascript.xmlimpl.XML.createFromJS(XM
    at org.mozilla.javascript.xmlimpl.XML.jsConstructor(X
    at org.mozilla.javascript.xmlimpl.XMLObjectImpl.execI dCall(
    at org.mozilla.javascript.BaseFunction.construct(Base
    at org.mozilla.javascript.ScriptRuntime.newObject(Scr
    at org.mozilla.javascript.gen.c137._c2(ce5b78e9-be24-48dd-9a65-d7492eb3ed06:5)
    at org.mozilla.javascript.optimizer.OptRuntime.callNa me0(
    at org.mozilla.javascript.gen.c137._c0(ce5b78e9-be24-48dd-9a65-d7492eb3ed06:6)
    at org.mozilla.javascript.ContextFactory.doTopCall(Co
    at org.mozilla.javascript.ScriptRuntime.doTopCall(Scr
    at org.mozilla.javascript.gen.c137.exec(ce5b78e9-be24-48dd-9a65-d7492eb3ed06)
    at com.webreach.mirth.server.mule.transformers.JavaSc riptTransformer.evaluateFilterScript(JavaScriptTra
    at com.webreach.mirth.server.mule.transformers.JavaSc riptTransformer.transform(JavaScriptTransformer.ja va:221)
    at org.mule.transformers.AbstractEventAwareTransforme r.doTransform( 8)
    at org.mule.transformers.AbstractTransformer.transfor m(
    at org.mule.transformers.AbstractTransformer.transfor m(
    at org.mule.impl.MuleEvent.getTransformedMessage(Mule
    at org.mule.routing.inbound.SelectiveConsumer.isMatch (
    at org.mule.routing.inbound.InboundMessageRouter.rout e(
    at org.mule.providers.AbstractMessageReceiver$Default InternalMessageListener.onMessage(AbstractMessageR
    at org.mule.providers.AbstractMessageReceiver.routeMe ssage(
    at org.mule.providers.AbstractMessageReceiver.routeMe ssage(
    at org.mule.providers.AbstractMessageReceiver.routeMe ssage(
    at com.webreach.mirth.server.mule.providers.vm.VMMess ageReceiver.getMessages( )
    at org.mule.providers.TransactedPollingMessageReceive r.poll(
    at .java:290)
    at eadPoolExecutor$Worker.runTask(ThreadPoolExecutor. java:650)
    at eadPoolExecutor$ :675)
    at Source)

    On the source I defined a transformer step with

    msg.setNamespace(new Namespace("soap",""));

    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:

    default xml namespace = new Namespace("soap","[url]"[/url]);
    2. You can pre-process the message to remove the namespace qualifiers:
    In your preprocessor do:
    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 Lang


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


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


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