I want to build a SaopUI like tool in salesforce.So I need to access the ''Parse WSDL'' api of salesforce.

Or how can I parse the WSDL file or Apex class in order to extract the methods of web service that endpoint supports. What should be the optimized way?

2 Answers 2


This is very similar to the Parse WSDL file using Apex code question, so I'll repost a similar answer.

I'm not aware of a current implementation to handle this natively in Apex. However, the basic parts are available for parsing XML documents using Dom.Document and Dom.XMLNode or XmlStreamReader.


Once you have an understanding of the required XML SOAP structure you can build up the Request using the HTTP Classes.

One challenge with consuming and then calling random WSDLs will be handling the remote site settings. You won't be able to callout to a new endpoint unless it is specified there.

I don't know more than the Dreamforce 14 description, but the following session may be of interest:

Building Callouts Without WSDL2Apex and Apex Parsers

On the Force.com platform, there are two ways of building Apex callout modules to invoke external web services and to retrieve data out of the responses. However, each approach has pitfalls that can slow down the whole development process. Join us to learn a different approach when developing callout code. The core part in this approach is a strategy design pattern consisting of one generic XML parser and one JSON parser. Based on the content-type HTTP header at run time, one of them will be utilized to parse any SOAP, XML or JSON stream returned from service endpoint. The parser also stores data values in a map structure. Developers can then use a set of simple API methods and XPath strings to retrieve any values out of the map directly.


I got so frustrated with trying to use XMLStreamReader & Dom.Document to parse an XML file using Apex, I ended up writing my own tiny XPath interpreter. It's proven to be very useful for me - it gives you an insanely easy way to find an element in the DOM. Internally it uses Dom.Document.

Give it a try, and please let me know of any bugs or suggestions.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .