Question
· Dec 2, 2020

SOAP DataSet with DiffGrams

Hi everyone,

I need to call a SOAP service using IRIS Interoperability and this SOAP service returns a Microsoft DataSet with a DiffGrams payload.

Do you know how to handle this kind of Objects ?

SOAP Payload Response :

<?xml version="1.0" ?>
<GetPatientsByClinicResponse>
    <GetPatientsByClinicResult>
        <xs:schema id="NewDataSet">
            <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:MainDataTable="Patients" msdata:UseCurrentLocale="true">
                <xs:complexType>
                    <xs:choice minOccurs="0" maxOccurs="unbounded">
                        <xs:element name="Patients">
                            <xs:complexType>
                                <xs:sequence>
                                    <xs:element name="LastName" type="xs:string" minOccurs="0"></xs:element>
                                    <xs:element name="FirstName" type="xs:string" minOccurs="0"></xs:element>
                                    <xs:element name="Date_x0020_of_x0020_Birth" type="xs:string" minOccurs="0"></xs:element>
                                    <xs:element name="Gender" type="xs:string" minOccurs="0"></xs:element>
                                    <xs:element name="Code" type="xs:string" minOccurs="0"></xs:element>
                                    <xs:element name="Insurance" type="xs:string" minOccurs="0"></xs:element>
                                    <xs:element name="GUID" type="xs:string" minOccurs="0"></xs:element>
                                    <xs:element name="CLINICGUID" type="xs:string" minOccurs="0"></xs:element>
                                </xs:sequence>
                            </xs:complexType>
                        </xs:element>
                    </xs:choice>
                </xs:complexType>
            </xs:element>
        </xs:schema>
        <diffgr:diffgram>
            <DocumentElement>
                <Patients diffgr:id="Patients1" msdata:rowOrder="0" diffgr:hasChanges="inserted">
                    <LastName>AGNES
                    </LastName>
                    <FirstName>Roussignol
                    </FirstName>
                    <Date_x0020_of_x0020_Birth>12/12/1975
                    </Date_x0020_of_x0020_Birth>
                    <Gender>Féminin
                    </Gender>
                    <Code>999990028
                    </Code>
                    <Insurance></Insurance>
                    <GUID>918c557f-b788-4171-a08e-4544aa5cc6ad
                    </GUID>
                    <CLINICGUID>0b3d8635-af2d-43c9-ae72-c8bd9833d18d
                    </CLINICGUID>
                </Patients>
                <Patients diffgr:id="Patients2" msdata:rowOrder="1" diffgr:hasChanges="inserted">
                    <LastName>AIX
                    </LastName>
                    <FirstName>Marius
                    </FirstName>
                    <Date_x0020_of_x0020_Birth>04/09/1972
                    </Date_x0020_of_x0020_Birth>
                    <Gender>Masculin
                    </Gender>
                    <Code>9999920024
                    </Code>
                    <Insurance></Insurance>
                    <GUID>25257261-a09c-4f2d-a710-c5bea3888086
                    </GUID>
                    <CLINICGUID>0b3d8635-af2d-43c9-ae72-c8bd9833d18d
                    </CLINICGUID>
                </Patients>
            </DocumentElement>
        </diffgr:diffgram>
    </GetPatientsByClinicResult>
</GetPatientsByClinicResponse>

From the SOAP Wizard, I get an GetPatientsByClinicResponse with one property of FME.WS.DataExchange.tns.GetPatientsByClinicResult type :


Class FME.WS.DataExchange.tns.GetPatientsByClinicResult Extends (%SerialObject, %XML.Adaptor) [ ProcedureBlock ] { Parameter ELEMENTQUALIFIED = 1; Parameter NAMESPACE = "http://tempuri.org/"; Parameter XMLNAME = "GetPatientsByClinicResult"; Parameter XMLSEQUENCE = 0; Property any As list Of %XML.String(XMLNAME = "any", XMLPROJECTION = "ANY") [ SqlFieldName = _any ]; /// ERROR: Duplicate Property name in Schema. Property any1 As %XML.String(XMLNAME = "any", XMLPROJECTION = "ANY"); }

I have seen in the documentation there is some kind of %XML.DataSet to parse this type of response like things we can do with ResultSet.

https://docs.intersystems.com/irisforhealthlatest/csp/docbook/DocBook.UI...

Do you know how i can cast my response to this kind of object, or any other method is appreciated.

Product version: IRIS 2020.4
Discussion (3)2
Log in or sign up to continue

Hi Alexender, I'll send you the WSDL in PM.

But I guess I found a workaround :

I created a new method that parse the XML with %XML.Reader and correlate the payload with my destination class :

 set reader = ##class(%XML.Reader).%New()
 // pRequest.GetPatientsByClinicResult.any.GetAt(1) <-- Header
 // pRequest.GetPatientsByClinicResult.any.GetAt(2) <-- Payload
 do reader.OpenString(pRequest.GetPatientsByClinicResult.any.GetAt(2))
 do reader.Correlate("Patients","FME.Object.Patient")

 while reader.Next(.object,.status) {
   do pResponse.Patients.Insert(object)
 }

Where FME.Object.Patient is :

Class FME.Object.Patient Extends (%SerialObject, %XML.Adaptor)
{

Property LastName As %String;

Property FirstName As %String;

Property Datex0020ofx0020Birth As %String(XMLNAME = "Date_x0020_of_x0020_Birth");

Property Gender As %String;

Property Code As %String;

Property Insurance As %String;

Property GUID As %String;

Property CLINICGUID As %String;

}