0

I am totally beginner in SOAP services. I create my first SOAP services and now Team Lead gave me task to make somehow (I dont know how) is it possible that user create XML file as template and store data from database into this XML file. I try to found something in google but I can't.

<DataTable xmlns="http://tempuri.org/">
  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" id="NewDataSet">
    <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:MainDataTable="AKONTAS" msdata:UseCurrentLocale="true">
      <xs:complexType>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:element name="AKONTAS" msprop:BaseTable.0="AKONTAS">
            <xs:complexType>
              <xs:sequence>
                <xs:element name="A_KONTO" msprop:BaseColumn="A_KONTO" msprop:OraDbType="126" type="xs:string" minOccurs="0" />
                <xs:element name="NAZIV" msprop:BaseColumn="NAZIV" msprop:OraDbType="126" type="xs:string" minOccurs="0" />
                <xs:element name="SIFRA_RAD" msprop:BaseColumn="SIFRA_RAD" msprop:OraDbType="104" type="xs:string" minOccurs="0" />
                <xs:element name="OPSTINA" msprop:BaseColumn="OPSTINA" msprop:OraDbType="104" type="xs:string" minOccurs="0" />
                <xs:element name="MB" msprop:BaseColumn="MB" msprop:OraDbType="126" type="xs:string" minOccurs="0" />
                <xs:element name="ULICA" msprop:BaseColumn="ULICA" msprop:OraDbType="126" type="xs:string" minOccurs="0" />
                <xs:element name="BROJ" msprop:BaseColumn="BROJ" msprop:OraDbType="126" type="xs:string" minOccurs="0" />
                <xs:element name="PBROJ" msprop:BaseColumn="PBROJ" msprop:OraDbType="126" type="xs:string" minOccurs="0" />
                <xs:element name="MJESTO" msprop:BaseColumn="MJESTO" msprop:OraDbType="126" type="xs:string" minOccurs="0" />
                <xs:element name="PORESKI" msprop:BaseColumn="PORESKI" msprop:OraDbType="126" type="xs:string" minOccurs="0" />
                <xs:element name="TRANSAKCIJ" msprop:BaseColumn="TRANSAKCIJ" msprop:OraDbType="126" type="xs:string" minOccurs="0" />
                <xs:element name="INTERNET" msprop:BaseColumn="INTERNET" msprop:OraDbType="126" type="xs:string" minOccurs="0" />
                <xs:element name="EMAIL" msprop:BaseColumn="EMAIL" msprop:OraDbType="126" type="xs:string" minOccurs="0" />
                <xs:element name="KONTAKT" msprop:BaseColumn="KONTAKT" msprop:OraDbType="126" type="xs:string" minOccurs="0" />
                <xs:element name="TELEFON" msprop:BaseColumn="TELEFON" msprop:OraDbType="126" type="xs:string" minOccurs="0" />
                <xs:element name="FAKS" msprop:BaseColumn="FAKS" msprop:OraDbType="126" type="xs:string" minOccurs="0" />
                <xs:element name="DAT_UNOS" msprop:BaseColumn="DAT_UNOS" msprop:OraDbType="106" type="xs:dateTime" minOccurs="0" />
                <xs:element name="PDVMB" msprop:BaseColumn="PDVMB" msprop:OraDbType="126" type="xs:string" minOccurs="0" />
                <xs:element name="VRSTA_KLIJENTA" msprop:BaseColumn="VRSTA_KLIJENTA" msprop:OraDbType="126" type="xs:string" minOccurs="0" />
                <xs:element name="DRZAVA" msprop:BaseColumn="DRZAVA" msprop:OraDbType="126" type="xs:string" minOccurs="0" />
              </xs:sequence>
            </xs:complexType>
          </xs:element>
        </xs:choice>
      </xs:complexType>
    </xs:element>
  </xs:schema>
  <diffgr:diffgram xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <NewDataSet xmlns="">
      <AKONTAS diffgr:id="AKONTAS1" msdata:rowOrder="0">
        <A_KONTO>515534</A_KONTO>
        <NAZIV>Hanny Moon</NAZIV>
        <SIFRA_RAD>12366</SIFRA_RAD>
        <MB>1234567891011</MB>
        <DAT_UNOS>2005-12-07T00:00:00+01:00</DAT_UNOS>
      </AKONTAS>
    </NewDataSet>
  </diffgr:diffgram>
</DataTable>
stuartd
  • 70,509
  • 14
  • 132
  • 163

1 Answers1

0

In general you could define a SOAP message with all your attributes. However, I think it is quite common to define just one SOAP parameter and this parameter contains again a whole XML-File. This embedded XML-File can be whatever you like to have. Here is an example of such a SOAP request.

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://..." xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  <SOAP-ENV:Body>
    <ns1:Runnings>
      <param0 xsi:type="xsd:string"><![CDATA[
<DSS>
    <runner id="1">
        <run id="1"><track>1</track><period>9.475</period></run>
        <run id="2"><track>1</track><period>8.3</period></run>
    </runner>
    <runner id="2">
        <run id="1"><track>2</track><period>15.475</period></run>
        <run id="2"><track>2</track><period>12.3</period></run>
    </runner>
</DSS>
]]>
      </param0>
    </ns1:Runnings>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

The embedded XML request must be enclose by <![CDATA[ ... ]]> or you have to escape <>&" (you can use HTF.ESCAPE_SC), i.e. your SOAP request could look like this:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://..." xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  <SOAP-ENV:Body>
    <ns1:Runnings>
      <param0 xsi:type="xsd:string">&lt;DSS&gt;
    &lt;runner id="1"&gt;
        &lt;run id="1"&gt;&lt;track&gt;1&lt;/track&gt;&lt;period&gt;9.475&lt;/period&gt;&lt;/run&gt;
        &lt;run id="2"&gt;&lt;track&gt;1&lt;/track&gt;&lt;period&gt;8.3&lt;/period&gt;&lt;/run&gt;
    &lt;/runner&gt;
    &lt;runner id="2"&gt;
        &lt;run id="1"&gt;&lt;track&gt;2&lt;/track&gt;&lt;period&gt;15.475&lt;/period&gt;&lt;/run&gt;
        &lt;run id="2"&gt;&lt;track&gt;2&lt;/track&gt;&lt;period&gt;12.3&lt;/period&gt;&lt;/run&gt;
    &lt;/runner&gt;
&lt;/DSS&gt;</param0>
    </ns1:Runnings>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Or you can wrap the embedded XML as BASE64 string (see Base64 encoding and decoding in oracle) with UTL_RAW.CAST_TO_VARCHAR2(UTL_ENCODE.BASE64_ENCODE(UTL_RAW.CAST_TO_RAW( ... ))), would be like this:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://..." xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  <SOAP-ENV:Body>
    <ns1:Runnings>
      <param0 xsi:type="xsd:string">PERTUz4KCTxydW5uZXIgaWQ9IjEiPgoJCTxydW4gaWQ9IjEiPjx0cmFjaz4xPC90
cmFjaz48cGVyaW9kPjkuNDc1PC9wZXJpb2Q+PC9ydW4+CgkJPHJ1biBpZD0iMiI+
PHRyYWNrPjE8L3RyYWNrPjxwZXJpb2Q+OC4zPC9wZXJpb2Q+PC9ydW4+Cgk8L3J1
bm5lcj4KCTxydW5uZXIgaWQ9IjIiPgoJCTxydW4gaWQ9IjEiPjx0cmFjaz4yPC90
cmFjaz48cGVyaW9kPjE1LjQ3NTwvcGVyaW9kPjwvcnVuPgoJCTxydW4gaWQ9IjIi
Pjx0cmFjaz4yPC90cmFjaz48cGVyaW9kPjEyLjM8L3BlcmlvZD48L3J1bj4KCTwv
cnVubmVyPgo8L0RTUz4=</param0>
    </ns1:Runnings>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Wernfried Domscheit
  • 54,457
  • 9
  • 76
  • 110
  • Basically this is sa SOAP service which return XML data when user input ID, if ID exsist in db it return XML of data from database like (name, surname, city, phone, email etc) And right now, I need to design this XML in my own and It should work same as current one. In this field It needs to save data from database 00123 TEST 123 –  Sep 26 '19 at 13:07