How to send SOAP with MTOM to TTT in java

319 views
Skip to first unread message

Nan Zhang

unread,
Mar 6, 2014, 1:41:10 PM3/6/14
to transport-t...@googlegroups.com
  Hi, I am doing some study on 170.314(b)(2) Transitions of Care (Inpatient), now I have organized the SOAP message, at first I put the base64 encoded CCDA document content in the SOAP message, I used HttpsURLConnection to send the SOAP message:

    URL url = new URL(urlStr);
    HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
    conn.setRequestProperty("Content-type", "application/soap+xml; charset=utf-8");
    conn.setDoInput(true);
    conn.setDoOutput(true);
    configSSLSocketFactory(conn, clPassword, clKeyStorePath, clKeyStorePath);

    OutputStream requestStream = conn.getOutputStream();
    requestStream.write(soapMessage.getBytes());
    requestStream.close();

  But the TTT validator kept showing the error:"ERROR: Request Message is SIMPLE SOAP but MTOM is required &&&& ITI TF Volumes 2a and 2b ".
  I haven't used MTOM before, after searching on the net, I assume the MTOM is a mechanism that people send a message with a attachment with the request. So now I update the SOAP message below, I use a <xop:Include> instead of document content, and I value the base64 encoded document content to a String variable, but now I don't know how to send the soap message with the attachment(document content). Could you please help me figure out how to do it in java, thank you?

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  <env:Header>
  ...
  </env:Header>
  <env:Body>
    <ihe:ProvideAndRegisterDocumentSetRequest xmlns:ihe="urn:ihe:iti:xds-b:2007" 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">
      <lcm:SubmitObjectsRequest>
        <rim:RegistryObjectList>
......
          <rim:Classification classificationNode="urn:uuid:a54d6aa5-d40d-43f9-88c5-b4633d873bdd" classifiedObject="2.16.840.1.113883.3.72.POCD_HD000040" id="02d8276c-eab0-4150-ba1a-9204488d9501"/>
          <rim:Association associationType="urn:oasis:names:tc:ebxml-regrep:AssociationType:HasMember" id="4200ca61-bb64-4388-acad-1be40a5b162b" sourceObject="2.16.840.1.113883.3.72.POCD_HD000040" targetObject="2.16.840.1.113883.3.72">
            <rim:Slot name="SubmissionSetStatus">
              <rim:ValueList>
                <rim:Value>Original</rim:Value>
              </rim:ValueList>
            </rim:Slot>
          </rim:Association>
        </rim:RegistryObjectList>
      </lcm:SubmitObjectsRequest>
      <ihe:Document id="2.16.840.1.113883.3.72">
        <xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:86af51ce-b68e-4418-aab5-6d70945e65e9"/>
      </ihe:Document>
    </ihe:ProvideAndRegisterDocumentSetRequest>
  </env:Body>
</env:Envelope>

Gerardin, Antoine D.

unread,
Mar 7, 2014, 10:09:17 AM3/7/14
to vood...@gmail.com, transport-t...@googlegroups.com
Below is a example of a valid soap message with xop attachments.
Usually people relies on soap libraries like CXF or Axis2 to generate valid content for them.

POST /axis2/services/MyService HTTP/1.1
Content-Type: multipart/related; boundary="MIMEBoundary_b1c4f73e49a629418af7916b6c4423cf87bfc1f8ca7f357d"; type="application/xop+xml"; start="<0.a1c4f73e49a629418af7916...@apache.org>"; start-info="application/soap+xml"; action="urn:echo"
User-Agent: Axis2
Host: 127.0.0.1:7979
Transfer-Encoding: chunked

93c
--MIMEBoundary_b1c4f73e49a629418af7916b6c4423cf87bfc1f8ca7f357d
Content-Type: application/xop+xml; charset=UTF-8; type="application/soap+xml"
Content-Transfer-Encoding: binary
Content-ID: <0.a1c4f73e49a629418af7916...@apache.org>

<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"><wsa:To>http://127.0.0.1:7979/axis2/services/MyService</wsa:To><wsa:MessageID>urn:uuid:158ab321-b017-472d-afcb-b06aebc3c769</wsa:MessageID><wsa:Action>urn:echo</wsa:Action></soapenv:Header><soapenv:Body><ns1:echo xmlns:ns1="http://echoService"><ns1:value><ns1:image><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:1.91c4f73e49a629418af7916...@apache.org" /></ns1:image></ns1:value></ns1:echo></soapenv:Body></soapenv:Envelope>
--MIMEBoundary_b1c4f73e49a629418af7916b6c4423cf87bfc1f8ca7f357d
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
Content-ID: <1.91c4f73e49a629418af7916...@apache.org>

<?xml version="1.0" encoding="UTF-8"?>
<sample>
<description>
An embedded image file.
</description>

<image name="stop.png" encoding="base64"
source="FamFamFam"
href="http://www.famfamfam.com/lab/icons/silk/">
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQ
CAYAAAAf8/9hAAAABGdBTUEAAK/INwWK
6QAAABl0RVh0U29mdHdhcmUAQWRvYmUg
SW1hZ2VSZWFkeXHJZTwAAAJOSURBVDjL
pZI9T1RBFIaf3buAoBgJ8rl6QVBJVNDC
ShMLOhBj6T+wNUaDjY0WmpBIgYpAjL/A
ShJ+gVYYYRPIony5IETkQxZ2770zc2fG
YpflQy2MJzk5J5M5z/vO5ESstfxPxA4e
rL4Zuh4pLnoaiUZdq7XAGKzRJVbIBZ3J
PLJaD9c/eCj/CFgZfNl5qK5q8EhTXdxx
LKgQjAFr0NK0ppOpt9n51D2gd2cmsvOE
lVcvOoprKvuPtriNzsY8rH+H0ECoQEg4
WklY1czP8akZby51p6G3b6QAWBl43llS
VTlUfuZE3NmYh9Vl0HkHSuVq4ENFNWFd
C+uJ5JI/9/V2Y//rkShA1HF6yk/VxJ0f
07CcgkCB7+fSC8Dzcy7mp4l9/khlUzwe
caI9hT+wRrsOISylcsphCFLl1RXIvBMp
YDZJrKYRjHELACNEgC/KCQQofWBQ5nuV
64UAP8AEfrDrQEiLlJD18+p7BguwfAoB
UmKEsLsAGZSiFWxtgWWP4gGAkuB5YDRW
ylKAKIDJZBa1H8Kx47C1Cdls7qLnQTZf
fQ+20lB7EiU1ent7sQBQ6+vdq2PJ5dC9
ABW1sJnOQbL5Qc/HpNOYehf/4lW+jY4v
h2tr3fsWafrWzRtlDW5f9aVzjUVj72Fm
CqzBypBQCKzbjLp8jZUPo7OZyYm7bYkv
w/sAAFMd7V3lp5sGqs+fjRcZhVYKY0xu
pwysfpogk0jcb5ucffbbKu9Esv1Kl1N2
+Ekk5rg2DIXRmog1Jdr3F/Tm5mO0edc6
MSP/CvjX+AV0DoH1Z+D54gAAAABJRU5E
rkJggg==
</image>
</sample>
45

--MIMEBoundary_b1c4f73e49a629418af7916b6c4423cf87bfc1f8ca7f357d--

0

________________________________________
From: transport-t...@googlegroups.com <transport-t...@googlegroups.com> on behalf of vood...@gmail.com <vood...@gmail.com>
Sent: Thursday, March 06, 2014 12:08 PM
To: transport-t...@googlegroups.com
Subject: How to send SOAP with MTOM to TTT in java

Hi, I am doing some study on 170.314(b)(2) Transitions of Care (Inpatient), now I have organized the SOAP message, at first I put the base64 encoded CCDA document content in the SOAP message, I used HttpsURLConnection to send the SOAP message:

URL url = new URL(urlStr);
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
conn.setRequestProperty("Content-type", "application/soap+xml; charset=utf-8");
conn.setDoInput(true);
conn.setDoOutput(true);
configSSLSocketFactory(conn, clPassword, clKeyStorePath, clKeyStorePath);

OutputStream requestStream = conn.getOutputStream();
requestStream.write(soapMessage.getBytes());
requestStream.close();

But the TTT validator kept showing the error:"ERROR: Request Message is SIMPLE SOAP but MTOM is required &&&& ITI TF Volumes 2a and 2b ".

I haven't used MTOM before, after searching on the net, I assume the MTOM is a mechanism that people send a message with a attachment with the request. So now I update the SOAP message below, I use a <xop:Include> instead of document content, and I value the base64 encoded document content to a String variable, but now I don't know how to send the soap message with the attachment(document content). Could anyone help me figure out how to do it in java, thank you?

--
You received this message because you are subscribed to the Google Groups "Transport Testing Tool" group.
To unsubscribe from this group and stop receiving emails from it, send an email to transport-testing...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Message has been deleted

Nan Zhang

unread,
Mar 7, 2014, 11:04:50 AM3/7/14
to transport-t...@googlegroups.com, antoine....@nist.gov
Thank you for your help, and I'm going to see if I can do something with Axis2.


On Friday, March 7, 2014 9:09:17 AM UTC-6, Gerardin, Antoine D. wrote:
Below is a example of a valid soap message with xop attachments.
Usually people relies on soap libraries like CXF or Axis2 to generate valid content for them.

POST /axis2/services/MyService HTTP/1.1
Content-Type: multipart/related; boundary="MIMEBoundary_b1c4f73e49a629418af7916b6c4423cf87bfc1f8ca7f357d"; type="application/xop+xml"; start="<0.a1c4f73e49a629418af7916b6c4423cf87bfc1f...@apache.org>"; start-info="application/soap+xml"; action="urn:echo"


User-Agent: Axis2
Host: 127.0.0.1:7979
Transfer-Encoding: chunked

93c
--MIMEBoundary_b1c4f73e49a629418af7916b6c4423cf87bfc1f8ca7f357d
Content-Type: application/xop+xml; charset=UTF-8; type="application/soap+xml"
Content-Transfer-Encoding: binary

Content-ID: <0.a1c4f73e49a629418af7916b6c4423cf87bfc1f...@apache.org>

<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"><wsa:To>http://127.0.0.1:7979/axis2/services/MyService</wsa:To><wsa:MessageID>urn:uuid:158ab321-b017-472d-afcb-b06aebc3c769</wsa:MessageID><wsa:Action>urn:echo</wsa:Action></soapenv:Header><soapenv:Body><ns1:echo xmlns:ns1="http://echoService"><ns1:value><ns1:image><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:1.91c4f73e49a629418af7916b6c4423cf87bfc1f...@apache.org" /></ns1:image></ns1:value></ns1:echo></soapenv:Body></soapenv:Envelope>


--MIMEBoundary_b1c4f73e49a629418af7916b6c4423cf87bfc1f8ca7f357d
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary

To unsubscribe from this group and stop receiving emails from it, send an email to transport-testing-tool+unsub...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages