# PARSE XML (WSDL) file example program

**URL:** <https://techcommunity.softwareag.com/t/parse-xml-wsdl-file-example-program/59974>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-Web-and-XML-Technology\
**Created:** [May 19, 2005, 4:13pm UTC](https://techcommunity.softwareag.com/t/parse-xml-wsdl-file-example-program/59974 "2005-05-19T16:13:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon29934956](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@anon29934956](https://techcommunity.softwareag.com/u/anon29934956)\
**Post date:** [May 19, 2005, 4:13pm UTC](https://techcommunity.softwareag.com/t/parse-xml-wsdl-file-example-program/59974/1 "2005-05-19T16:13:20Z")

</div>

Recently I’ve got a question from a customer related to the PARSE statement introduced with Natural 6. The following simle program parses an XML file - here a WSDL file and displays the xml-path etc.  
The code and the WSDL file is included below however you may parse other XML files…  
I hope you find this example program useful. 8)

With best regards,  
Michael Muenster

* * *

/\* example program PARSE-P  
/\* PARSE an arbitrary XML file  
/\* the program requires SYSWEB as steplib  
/\* the ‘qotd.wsdl’ file must be placed in the RES directory  
/\* of the library where this program ist stored.  
/\*  
DEFINE DATA LOCAL  
01 XML-DATA (A) DYNAMIC  
01 #XML-PATH (A) DYNAMIC  
01 #XML-NAME (A) DYNAMIC  
01 #XML-VALUE (A) DYNAMIC  
END-DEFINE

FORMAT LS=120 PS=40  
PERFORM W3READ-RESOURCE ’ ’ ‘qotd.wsdl’ XML-DATA

PARSE XML XML-DATA INTO PATH #XML-PATH  
NAME #XML-NAME  
VALUE #XML-VALUE  
DISPLAY #XML-PATH (AL=60) #XML-NAME (AL=15) #XML-VALUE (AL=30) \*PARSE-TYPE

END-PARSE  
END

* * *
\<?xml version="1.0"?\>

```
<message name="getQuoteRequest" />

<message name="getQuoteResponse">
	<part name="return" type="xsd:string"/>
</message>

<portType name="qotdPortType">
	<operation name="getQuote">
		<input name="getQuote" message="tns:getQuoteRequest"/>
		<output name="getQuoteResponse" message="tns:getQuoteResponse"/>
	</operation>
</portType>
<binding name="qotdBinding" type="tns:qotdPortType">
	<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
	<operation name="getQuote">
		<soap:operation soapAction="urn:xmethods-qotd#getQuote"/>
		<input>
			<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:xmethods-qotd"/>
		</input>
		<output>
			<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:xmethods-qotd"/>
		</output>
	</operation>

</binding>
<service name="qotd">
	<documentation>
     Get a Quote of the Day
  </documentation>
	<port name="qotdPort" binding="tns:qotdBinding">
		<soap:address location="http://webservices.codingtheweb.com/bin/qotd"/>
	</port>
</service>

```

---------------------------------------------

---

<div class="post-metadata">

**Author:** ![Weihnachtsbar](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/weihnachtsbar/32/146_2.png) [@Weihnachtsbar](https://techcommunity.softwareag.com/u/Weihnachtsbar)\
**Post date:** [May 19, 2005, 4:43pm UTC](https://techcommunity.softwareag.com/t/parse-xml-wsdl-file-example-program/59974/2 "2005-05-19T16:43:55Z")

</div>

Three things missing:  
1st save the xml with name “qotd.wsdl” and then drag this file to your Natural Library you are running this program from.  
2nd A steplib to library SYSWEB is necessary, otherwise W3READ-RESOURCE cannot not found.  
3rd according the documentation of W3READ-RESOURCE (can be found at the Web Technology → Natural Web Interface → Natural Web Online Documentation → Template / XSLT Processing → W3READ-RESOURCE)  
a additional #response parameter should be used to see possible errors.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 2:40pm UTC](https://techcommunity.softwareag.com/t/parse-xml-wsdl-file-example-program/59974/3 "2021-04-02T14:40:10Z")

</div>


