Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

XDS profile ITI-18, I wanna generate XML for a pre-defined QueryRegistry and print it

129 views
Skip to first unread message

文波

unread,
Jan 21, 2024, 4:44:16 AM1/21/24
to ipf-user
Dear everyone,
I am currently studying the IHE profiles for testing, and I came across the information on GitHub about the excellent support of IHE in the IPF framework developed by your team. Therefore, I have decided to study it. At present, I am learning about XDS, and I am attempting to implement the ITI-18 transaction using pure Java. My primary question is whether it is possible to generate a complete XML of the Message type in Java, or to generate XML for the QueryRegistry type object in the ITI-18 transaction. For example, if I have already defined a QueryRegistry object, how can I generate and view the corresponding XML format of the query message? I want to display the QueryRegistry type object that I have predefined in the Java language, and I want to generate the corresponding XML string. However, in the sample code of xds-tutorial, I only saw that after defining the QueryRegistry object, the send method is called directly. Now, I want to generate the complete SOAP_query.xml within the code. Is there a method in the IPF framework to achieve this? I want to print the generated XML.截屏2024-01-21 17.30.19.png

I would greatly appreciate any guidance or tips you could provide on this matter.

Thank you very much for your assistance. I look forward to your valuable insights.

Sincerely,

BoVane

Dmytro Rud

unread,
Jan 21, 2024, 4:47:57 AM1/21/24
to ipf-...@googlegroups.com
Hi BoVane

Please take a look at the class org.openehealth.ipf.platform.camel.ihe.xds.core.converters.XdsRenderingUtils.

Best regards
Dmytro


--
You received this message because you are subscribed to the Google Groups "ipf-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ipf-user+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ipf-user/6c636600-5d9b-4d63-9864-24be409d3bd5n%40googlegroups.com.

文波

unread,
Jan 21, 2024, 9:32:08 AM1/21/24
to ipf-user
Hello Dmytro,

Thank you very much for your help. I have successfully converted the Exchange object to XML format, but there is still a small issue. The XML I converted only contains the body part, as shown in the screenshot. How can I generate the complete SOAP XML? Do I need to include tags such as <s:Envelope>, <s:Header>, etc.? Do I need to set the header in the Message object? However, I am not sure how to correctly set the Header. Could you provide me with an example of the Header? Also, do I need to set the Exchange object? Please give me some hints.   Once again, thank you. Additionally, could you provide an example of implementing transactions related to the PIX profile? As a complete newcomer to IHE and with limited knowledge of your IPF framework, I need some examples to gradually learn it. Thank you again for your assistance.

Sincerely,

BoVane

截屏2024-01-21 22.12.17.png

截屏2024-01-21 22.11.52.png

Dmytro Rud

unread,
Jan 21, 2024, 9:57:22 AM1/21/24
to ipf-...@googlegroups.com
Hi BoVane

SOAP envelopes are created not by IPF directly, but by the Apache CXF framework -- including WS-Addressing headers.  To access the enevlope, you have to instantiate a CXF logging interceptor (see https://cxf.apache.org/docs/message-logging.html) as a bean and reference it in the ITI-18 endpoint URI as described on https://oehf.github.io/ipf-docs/docs/ihe/wsCustomInterceptors.  OTOH, all SOAP envelopes related to requests of a particular IHE transaction are very similar to each other; their only variable part is the content of the WS-Addressing SOAP header "MessageID".  Thus, the efforts of configuring and deploying a CXF interceptor may be not worth the outcome.

Information on implementing PIX transactions is provided on https://oehf.github.io/ipf-docs/docs/ihe/hl7v2/.  Thereby, IPF uses HAPI model classes as data model, but plain strings would be acceptable as well.

Best regards
Dmytro


文波

unread,
Jan 21, 2024, 9:12:20 PM1/21/24
to ipf-user
Hi Dmytro
Thank you very much for your advice, and please forgive me for being a novice in the IPF framework and IHE profiling. I now understand that the efforts of configuring and deploying a CXF interceptor may not be worth the outcome. In the IPF framework, we only need to focus on the values of the corresponding entity classes, such as the ITI-18 transaction. On the client side, we only need to focus on the values inside the QueryRegistry object, without needing to pay attention to the format of the corresponding SOAP XML message. I have a web application scenario where I have a web page that can input a series of ITI-18 transaction query conditions. I want to generate an XML in the format of RegistryStoredQueryRequest_SOAP.xml and then return it. How can I achieve this with the help of your IPF framework? Currently, my efforts are in accepting parameters passed from the frontend on the server side and setting them into the QueryRegistry object, setting them into the Message object, setting them into the Exchange object, and so on. I don't know how to proceed with generating the SOAP XML for the next step. I have looked at your framework's XDS tutorial example and found that in the test cases, the generation of the corresponding SOAP XML is hidden, and only setting the model's values is required. Please give me some hints, and once again, thank you for your enthusiastic help.

Best regards
BoVane截屏2024-01-22 10.07.16.png

Dmytro Rud

unread,
Jan 21, 2024, 10:47:35 PM1/21/24
to ipf-...@googlegroups.com
Hello BoVane

No worries, your questions are very welcome, this is what this whole mailing list is for :-)

So, you created an ITI-18 request message as a Java object, you are able to convert it to an XML string (SOAP body), and now you want to put it into a SOAP envelope?  This can be done on the string level, e.g.:

String iti18RequestXmlString = XdsRenderingUtils.blabla(...);
String wsaMessageId = UUID.randomUUID().toString();
String targetEndpointUri = "https://example.com/iti18Endpoint";

String soapEnvelope = "<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:wsa=\"http://www.w3.org/2005/08/addressing/\"><soap:Header>" +
    "<wsa:MessageID>" + wsaMessageId + "</wsa:MessageID>" +
    "<wsa:ReplyTo><wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address></wsa:ReplyTo>" +
    "<wsa:To>targetEndpointUri</wsa:To>" +
    "<wsa:Action>urn:ihe:iti:2007:RegistryStoredQuery</wsa:Action>" +
"</soap:Header><soap:Body>" + iti18RequestXmlString + "</soap:Body></soap:Envelope>";

But a better approach would be, of course, to redesign the application in the way where no manual creation of SOAP envelopes would be necessary.

Best regards
Dmytro


文波

unread,
Jan 21, 2024, 11:35:49 PM1/21/24
to ipf-user
Hi Dmytro
I am learning the IPF framework in order to participate in the 2024 China IHE Connectathon. Thank you very much for your help. At the string level, I put the SOAP body into a SOAP envelope. My code is as shown in the figure below. When I compared the generated SOAP envelope with the RegistryStoredQueryRequest_SOAP.xml downloaded from the official IHE website, I found that the tags in the SOAP body are quite different. Does this difference have any impact? Can I use the XdsRenderingUtils.render(exchange) code to ensure that the generated tags are consistent with the body tag format in the RegistryStoredQueryRequest_SOAP.xml example? Once again, thank you for your help. The IHE ITI-18 Request example are as follows

RegistryStoredQueryRequest_SOAP.xml

截屏2024-01-22 12.21.21.png
截屏2024-01-22 12.25.12.png

Best regards
BoVane

Dmytro Rud

unread,
Jan 22, 2024, 12:11:42 AM1/22/24
to ipf-...@googlegroups.com
Could you please show the first 16 lines in the second screenshot as well?  If the SOAP body is an <AdHocQueryRequest> then everything is fine.

And: There is a small error in my Java snippet, instead of 
    "<wsa:To>targetEndpointUri</wsa:To>" +
it shall be
    "<wsa:To>" + targetEndpointUri + "</wsa:To>" +
 
Best regards
Dmytro

On Mon, Jan 22, 2024 at 5:35 AM 文波 <bova...@gmail.com> wrote:
Hi Dmytrong

文波

unread,
Jan 22, 2024, 1:43:21 AM1/22/24
to ipf-user
The whole XML I generate and print 
=========================================

<soap:Envelope
    xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
    xmlns:wsa="http://www.w3.org/2005/08/addressing/">
    <soap:Header>
        <wsa:MessageID>0b9d8e75-6eae-44bf-8700-c44a0a642f77</wsa:MessageID>

        <wsa:ReplyTo>
            <wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
        </wsa:ReplyTo>
        <wsa:To>targetEndpointUri</wsa:To>
        <wsa:Action>urn:ihe:iti:2007:RegistryStoredQuery</wsa:Action>
    </soap:Header>
    <soap:Body>
        <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
        <query:AdhocQueryRequest
            xmlns="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0"
            xmlns:rs="urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0"
            xmlns:xds="urn:ihe:iti:xds-b:2007"
            xmlns:query="urn:oasis:names:tc:ebxml-regrep:xsd:query:3.0"
            xmlns:lcm="urn:oasis:names:tc:ebxml-regrep:xsd:lcm:3.0"
            xmlns:rmd="urn:ihe:iti:rmd:2017"
            xmlns:xdsi="urn:ihe:rad:xdsi-b:2009">
            <query:ResponseOption returnType="LeafClass" returnComposedObjects="true"/>
            <AdhocQuery id="urn:uuid:14d4debf-8f97-4251-9a74-a90016b0af0d">
                <Slot name="$XDSDocumentEntryPatientId">
                    <ValueList>
                        <Value>'1234567'</Value>
                    </ValueList>
                </Slot>
                <Slot name="$XDSDocumentEntryStatus">
                    <ValueList>
                        <Value>('urn:oasis:names:tc:ebxml-regrep:StatusType:Approved')</Value>
                    </ValueList>
                </Slot>
            </AdhocQuery>
        </query:AdhocQueryRequest>
    </soap:Body>
</soap:Envelope>

截屏2024-01-22 12.25.12.png

Dmytro Rud

unread,
Jan 22, 2024, 1:46:40 AM1/22/24
to ipf-...@googlegroups.com
Looks good, but you have to delete the prolog string marked yellow below.

Best regards
Dmytro


文波

unread,
Jan 22, 2024, 1:55:21 AM1/22/24
to ipf-user
so even if the tags inside the SOAP XML body that I generate are different from the example provided by IHE, it should still work fine, right? It won't have any impact? I have tested it in SOAP UI, and it can indeed be sent to the server. Thank you again for your help. I will now do my best to try it out, and if I have any further questions later on, I will come back to ask you.

Best regards
BoVane
Reply all
Reply to author
Forward
0 new messages