Home » SQL & PL/SQL » SQL & PL/SQL » How to add SOAP elements to XML (Oracle 10g)
How to add SOAP elements to XML [message #680685] Mon, 01 June 2020 04:55 Go to next message
Mark70
Messages: 18
Registered: June 2020
Junior Member
I was asked to generate an XML like this:

<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http ://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <ns2:elaboraDocumentoAsync xmlns:ns2="http ://siac.csi.it/documenti/svc/1.0">
	
	........
	
	</ns2:elaboraDocumentoAsync>
</soap:Body>
</soap:Envelope>
I've tried to develop sql code like this:

...
select xmltype( 
                     replace(
                     replace(
                      xmlelement("soap-Envelope",
                      xmlelement("soap-Body",
                                 xmlconcat(
                                 document_X1,
                                 document_X2,
                                 document_X3)
                                 )).extract('/*'),
                                 'soap-Body','soap:Body')
                                 ,
                                 'soap-Envelope','soap:Envelope xmlns:soap="http ://schemas.xmlsoap.org/soap/envelope/"'))
             into RES
             from dual;
...

where document_X1, document_X2, document_X3 are XMLTYPE with tags and RES is also an XMLTYPE object
but I get this:

ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00225: end-element tag "soap:Envelopexmlns:soap" does not match start-element tag "soap:Envelope"

Thanks again!
Mark

Re: How to add SOAP elements to XML [message #680687 is a reply to message #680685] Mon, 01 June 2020 06:40 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>LPX-00225: end-element tag "soap:Envelopexmlns:soap" does not match start-element tag "soap:Envelope"
Which part of above do you NOT understand?
You must create valid XML document.
Re: How to add SOAP elements to XML [message #680688 is a reply to message #680687] Mon, 01 June 2020 07:07 Go to previous messageGo to next message
Mark70
Messages: 18
Registered: June 2020
Junior Member
Thanks , I've just solved by writing:
select xmlelement("soap:Envelope", 
                               xmlattributes('http://schemas.xmlsoap.org/soap/envelope/' AS "xmlns:soap"),
                    xmlelement("soap:Body",
                    xmlelement("ns2:elaboraDocumentoAsync",
                               xmlattributes('http://siac.csi.it/documents/svc/1.0' AS "xmlns:ns2"),
                                xmlconcat(
                                          document_X1,
                                          document_X2,
                                          document_X3
                                         )
                               )
                               )
                               ).extract('/*')                                
             into RES
             from dual;
Re: How to add SOAP elements to XML [message #680722 is a reply to message #680688] Wed, 03 June 2020 10:48 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Thanks for the feedback and solution.

Re: How to add SOAP elements to XML [message #682007 is a reply to message #680722] Fri, 25 September 2020 03:43 Go to previous message
Mark70
Messages: 18
Registered: June 2020
Junior Member
Thank you to everyone!
Previous Topic: Finding entries missing a value and listing all used values for specific data
Next Topic: How to use table functions
Goto Forum:
  


Current Time: Thu Mar 28 12:20:16 CDT 2024