I am trying to generate Apex classes from WSDL. I was given a zipped file with one WSDL and three SXD files. After pretty much I've tried it all including consulting with Salesforce I have the final version of WSDL. I passed parsing finally and tried to generate Apex class again, now I got a different error:

Apex Generation Failed. Unable to find element for {http://svc.kp.org/hp_admn/mbr_admn/addr_validate/v2}getAddressValidationResponse

You can see the WSDL here https://gist.github.com/Miroandme/public.

I do not have a lot of experience with external application WSDLs and am not sure how to handle this part.

  • Not sure how to submit WSDL here. Looks like my file is too long. I wonder if I can attach the file. – User Miro Sep 8 '18 at 23:44
  • You could do pastebin or a github gist, if you think it'll help. If it's that big though, I'm not sure we're going to be able to help, but we can at least take a look for you, in case it's something obvious. – sfdcfox Sep 8 '18 at 23:48
  • Above is my public Gits where WSDL can be reviewed. – User Miro Sep 9 '18 at 0:13
  • Your WSDL as linked is invalid. It uses a trnheader: namespace for certain element types which isn't defined as a xmlns in the document. If you can share the unmodified WSDL it will likely be easier to resolve. – Daniel Ballinger Sep 9 '18 at 23:19

This tool WSDL Parser and Apex Generator that is part of the FuseIT SFDC Explorer includes:

Support for complex types that extend from a base class <xsd:extension base="tns:Sample">

which is one of the things that is probably tripping up the standard Salesforce tool. See An alternative to Salesforces Wsdl2Apex for calling SOAP web services in Apex from Danial Ballinger's blog for some history on this work.

Some of these capabilities may have made it into this open source WSDL2Apex project as Daniel contributed to that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.