Announcement

Collapse
No announcement yet.

Can I submit xml in arg0 for mirth web service?

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

  • Can I submit xml in arg0 for mirth web service?

    Hello,

    I would like to submit xml into the standard web service listener.. is this possible? It works okay submitting a string but not xml.

    Example with string that works, creates a message with 'test123' in payload:
    Code:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.connectors.connect.mirth.com/">
       <soapenv:Header/>
       <soapenv:Body>
          <ws:acceptMessage>
             <!--Optional:-->
            <arg0>test123</arg0>
          </ws:acceptMessage>
       </soapenv:Body>
    </soapenv:Envelope>
    However this doesnt work.. I end up with an empty message:
    Code:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.connectors.connect.mirth.com/">
       <soapenv:Header/>
       <soapenv:Body>
          <ws:acceptMessage>
             <!--Optional:-->
            <arg0><t1>test123</t1></arg0>
          </ws:acceptMessage>
       </soapenv:Body>
    </soapenv:Envelope>
    I would like a message of <t1>test123</t1>... any tips on how I should do this?

  • #2
    Hello glenn71,

    from what i understand, you like to receive a string containing:

    <t1>test123</t1>

    is this correct?
    Best Regards,
    Alex Neiva

    Comment


    • #3
      Well I actually want to submit a message in xml form to mirth.

      Comment


      • #4
        Yep that's easy, just entity encode it:

        Code:
        <arg0>&lt;t1&gt;test123&lt;/t1&gt;</arg0>
        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


        • #5
          Thanks Nick,

          I have played with this approach.. is it possible to have mirth extended to accept xml (unescaped)? I am wanting to provide a service to external web service clients and it would be great if mirth could accept xml here. I was hoping that changing the data type on the channel would get mirth to accept xml.. but no luck.

          Comment


          • #6
            Hello glenn71,
            According to your intentions,you have to XML tags <![CDATA[]]>,Code as follows:
            <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.connectors.connect.mirth.com/">
            <soapenv:Header/>
            <soapenv:Body>
            <ws:acceptMessage>
            <!--Optional:-->
            <arg0>
            <![CDATA[<t1>test123</t1>]]>
            </arg0>
            </ws:acceptMessage>
            </soapenv:Body>
            </soapenv:Envelope>

            Comment


            • #7
              Originally posted by glenn71 View Post
              Thanks Nick,

              I have played with this approach.. is it possible to have mirth extended to accept xml (unescaped)? I am wanting to provide a service to external web service clients and it would be great if mirth could accept xml here. I was hoping that changing the data type on the channel would get mirth to accept xml.. but no luck.
              As Dave indicated, CDATA will work in that case.

              In general, I think you're confused about how SOAP web services work. I would suggest studying up on WSDLs/XSDs, then look at the WSDL/XSD that a default Web Service Listener exposes. Our default operation just takes in a single string, nothing more, nothing less. If you want something more complex like a well-defined XML structure, that's where you should implement your own custom web service Java class and include it on your channel.
              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


              • #8
                Thanks Nick,

                Have brushed up my soap knowledge!

                Decided to base 64 encode the xml msg and send as a single string.. then decode in the source transformer.

                Unfortunately REST is not an option client side.

                Comment


                • #9
                  If you're sending as a single string anyway, why not just entity-encode the XML and send that? That way you wouldn't have to do any decoding at all in your channel; you'd just receive the XML with entities already decoded for you.
                  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

                  Working...
                  X