7

This question is for people who've done quite a lot of integration's.

If you were given a WSDL file how do you read it. I mean what method to be called , what should be the input parameter/what is the expected output.I'm looking for a better approach to understand, do you look in to XML tags (Operations/Messages) or the generated Apex classes.

Thanks!!

1 Answer 1

10

Probably the easiest way to understand what methods are defined in a WSDL and what their respective parameters are is to start with a tool like SoapUI.

You can import the WSDL and it will generate sample requests that correspond to the available methods.

SoapUI Requests

That will give you a good starting point.

In terms of the raw WSDL, try starting with the operation elements. E.g.

<operation name="convertLead">
    <documentation>convert a set of leads</documentation>
    <input  message="tns:convertLeadRequest"/>
    <output message="tns:convertLeadResponse"/>
    <fault  message="tns:UnexpectedErrorFault" name="UnexpectedErrorFault"/>
</operation>

The input will be the type that holds the request parameters and the output the response parameters.

Then you will need to jump to the corresponding message to get the actual parameter type.

<message name="convertLeadRequest">
    <part element="tns:convertLead" name="parameters"/>
</message>
<message name="convertLeadResponse">
    <part element="tns:convertLeadResponse" name="parameters"/>
</message>

Which gives the type being used.

<element name="convertLead">
    <complexType>
        <sequence>
            <element name="leadConverts" type="tns:LeadConvert" minOccurs="0" maxOccurs="unbounded"/>
        </sequence>
    </complexType>
</element>

It will be a case of following the type definitions down until you find simple types.

Understanding the namespace prefix notation that is used in XML is also useful.

2
  • Amazing, for me SoapUI instantly fixed the issue I had. I was troubleshooting a soap msg sent via SalesForce which has horrible limited debugging of outbound requests. You have no full return response so if the code is breaking you can't see the error returned at all. With SoapUI I could instantly import the WDSL file and see the response of my code. Highly recommended for Salesforce users using Outbound Messages!
    – AdamJones
    Commented May 9, 2017 at 14:22
  • @AdamJones Not being able to access the entire fault message can be really frustrating. Please vote for the idea SOAPFault Information for Apex Commented May 9, 2017 at 19:27

You must log in to answer this question.

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