Search code examples
javakotlinsoapwsdlwsdl2java

Error generating code from wsdl file due to invalid wsdl


I'm currently at work stuck at a problem with generating a SOAP api client code from a wsdl file. The file in question is available to the public here . The one I'm specifically looking to use is called GetListingInteraction_1.0_rivtabp20.wsdl. I know it has the dependency of three other xsd files crm_carelisting_1_0.xsd, GetListing_1_0.xsd and ws-addressing-1.0.xsd.

I'm using the package com.yupzip.wsdl2java

We're using kotlin with java 11.

Here's what the gradle.build configuration file looks like for wsdl2java:

plugins {
  id 'com.yupzip.wsdl2java' version "$wsdl2java_version"
}


wsdl2java {
wsdlsToGenerate = [
        [
                '-p', 'generated.com.test.microservice.test.resources.models.listing.getlistinginteraction',
                '-wsdlLocation', 'classpath:wsdl/GetListingInteraction_1.0_rivtabp20.wsdl', "$projectDir/src/main/resources/wsdl/GetListingInteraction_1.0_rivtabp20.wsdl"
        ],
]
wsdlDir = file("$projectDir/src/main/resources/wsdl")
cxfVersion = "3.5.5"
cxfPluginVersion = "3.5.5"

}

The error we're getting.

Failed to create java parameter for part [logicalAddress] in method [getListing] - this wsdl is invalid, please use the wsdlvalidator tool to validate this wsdl

I've gone through the wsdl file, validating, formatting etc but it all looks okay to me. I'm not very experienced with SOAP and WSDL overall and I'm sort of at a loss of what to do. We have another service that is able to generate the client code with the exact same setup in another part of the system for another SOAP api. Same versions of the wsdl2java dependency is used as well as configuration, just other wsdl files in wsdlsToGenerate.

Would anyone be so kind as to try to replicate it themselves and see if you get the same problem? And if you find a solution I would appreciate it a lot.

If you need anymore information let me know.

I've reproduced it in a small project here https://github.com/Menyten/wsdltest


Solution

  • I figured out the issue. Apparently I needed some additional arguments for the generation to work. I had a look in the pom.xml file of the original project and saw the extra arguments under wsdlOptions for the file in question