You need to sign in to do that
Don't have an account?
Daniel Ballinger
Salesforce generated WSDL for Apex webservice missing address complex type
The WSDL generated for an Apex Class method using the webservice keyword may be missing required complex types.
Take the example:
This will generate a WSDL with elements like:
The issue is that there is no address complex type in the WSDL tns namespace (http://soap.sforce.com/schemas/class/DFB/RetrieveOpportunity in this case).
This results in errors like:
Can this be raised as an Apex API bug?
Take the example:
global class RetrieveOpportunity { webservice static Opportunity retrieveOpportunity(Id opportunityId) { return new Opportunity(); } }
This will generate a WSDL with elements like:
<xsd:element name="BillingAddress" minOccurs="0" type="tns:address" nillable="true"/>
The issue is that there is no address complex type in the WSDL tns namespace (http://soap.sforce.com/schemas/class/DFB/RetrieveOpportunity in this case).
This results in errors like:
Error: type 'address@http://soap.sforce.com/schemas/class/RetrieveOpportunity' not found.
Source - WSDL generated from apex can't import to SoapUI (http://salesforce.stackexchange.com/q/56005/102)
Source - WSDL generated from apex can't import to SoapUI (http://salesforce.stackexchange.com/q/56005/102)
and
Error 1 Unable to import binding 'getLeadInfoBinding' from namespace 'http://soap.sforce.com/schemas/class/getLeadInfo'. App_WebReferences/WebReference/
Source - Issue with Adding reference Webservice WSDL to VS2010 (http://salesforce.stackexchange.com/q/53329/102)
The currently solution is to manually add the missing complex types to the xsd:schema with the required targetNamespace.<!-- Compound datatype: Address --> <complexType name="address"> <complexContent> <extension base="tns:location"> <sequence> <element name="city" type="xsd:string" nillable="true" /> <element name="country" type="xsd:string" nillable="true" /> <element name="countryCode" type="xsd:string" nillable="true" /> <element name="postalCode" type="xsd:string" nillable="true" /> <element name="state" type="xsd:string" nillable="true" /> <element name="stateCode" type="xsd:string" nillable="true" /> <element name="street" type="xsd:string" nillable="true" /> </sequence> </extension> </complexContent> </complexType> <!-- Compound datatype: Location --> <complexType name="location"> <sequence> <element name="latitude" type="xsd:double" nillable="true" /> <element name="longitude" type="xsd:double" nillable="true" /> </sequence> </complexType>
Can this be raised as an Apex API bug?
This has already been published as a known issue and can be tracked here: https://success.salesforce.com/issues_view?id=a1p300000008XKUAA2
All Answers
This has already been published as a known issue and can be tracked here: https://success.salesforce.com/issues_view?id=a1p300000008XKUAA2
Once, WSDL is downloaded and saved on local drive. We have to go to Salesforce and navigate to “Setup | Develop | Apex Classes”. On right hand side, you will find button named as “Generate from WSDL”. This button will generate equivalent Apex class to support Webservice call. In some Programming languages, these classes are known as Proxy classes or Stubs.