I have a very simple apex class:
global class RetrieveOpportunity {
webservice static Opportunity retrieveOpportunity(Id opportunityId) {
return new Opportunity();
}
}
I clicked the Generate WSDL button on this class, and was able to generate successfully, it created a 7,695 line xml file.
When importing this into SoapUI, I get the error:
Error: type 'address@http://soap.sforce.com/schemas/class/RetrieveOpportunity' not found.
What am I missing?
Best Answer
UPDATE: There is now a known issue for this that you can track "Generate WSDL" generates a WSDL that does not contain the definition of the compound types address and location if API version is 30.0 or above
I've seen this before
, but can't find the previous occurrence at the momentin Issue with Adding reference Webservice WSDL to VS2010.There is a problem with the generated WSDL. It has several elements defined like:
Note the
type="tns:address"
. This says there should be a complex type in the http://soap.sforce.com/schemas/class/DFB/RetrieveOpportunity namespace (which is what tns maps to).However, there isn't an "address" complex type defined in the WSDLs schema.
One option would be to define the required complex type yourself.
Here is the required definition extracted from the Partner API WSDL (v31.0) that should be added to the xsd:schema where the targetNamespace is "http://soap.sforce.com/schemas/class/DFB/RetrieveOpportunity".
I've raised this on the developer forum to see if will get picked up as a bug. Salesforce generated WSDL for Apex webservice missing address complex type