Announcement

Collapse
No announcement yet.

Creating a SOAP Listener for messages which don't fit the default XML schema

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

  • 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
    Last edited by ohollarens; 04-02-2015, 10:52 AM.

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

    Comment


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

      Comment


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

        Comment


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

          Comment


          • #6
            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, 10:55 AM.

            Comment

            Working...
            X