Salesforce Apex: Referencing external schemas error in a wsdlToApex

Varun   Varun 1164 Views
In while creating Apex class from wsdl (wsdlToApex) sometime we encounter error like :

Error: Failed to parse wsdl: Found schema import from location https://*.xsd. External schema import not supported."

Actually in wsdl to apex
xsd:import and wsdl:import are not supported.

Now in order to resole it we need to all referenced schema contents and  paste it inside wsdl file.
Perform following steps to resolve this issue.
1. Open the WSDL file with a text editor like editplus or notepad++
2. Inside <wsdl:types> (just after last <schema>) paste each referenced .xsd file text content. just copy & paste only <schema></schema> portion from xsd file.
3. Once all schemas content are in the WSDL then comment or remove all <xsd:import> as we don't need them now.