Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE] spring-soap Endopint Doesn't Import Generated Objects From jaxb2-maven-plugin #16383

Open
michellemillerh opened this issue Apr 11, 2024 · 0 comments
Labels
on-jira triaged Issues reviewed by a dev and considered valid. Will be added in Jira.

Comments

@michellemillerh
Copy link

Article and Module Links
https://www.baeldung.com/spring-boot-soap-web-service
https://github.com/eugenp/tutorials/tree/master/spring-soap

Describe the Issue
The tutorial indicates using jaxb2-maven-plugin to generate the models for a SOAP endpoint. But the objects generated by this plugin aren't imported. The existing Endpoint class imports client objects generated off a WSDL file by a different plugin, maven-jaxb-plugin, for the SOAP Client article.

On the current Spring 3 version of the repository, all that needs to be corrected is changing the import path.

Endpoint imports from maven-jaxb2-plugin generation:

import com.baeldung.springsoap.client.gen.GetCountryRequest;

Spring 2 Issues On Older Versions
For reference in case it helps anyone, prior versions of the spring-soap repo, from the time of the Java 17 upgrade until the repo was upgraded to Spring 3, used pom dependencies that result in Jakarta XML annotations on the generated classes. This is masked by the issue explained above, so the generated classes aren't even used. But if you import the XSD generated models instead, and try to use them in an Endpoint class as detailed by the tutorial, the test request in the tutorial will get an error response that says: No adapter for endpoint ... Does your endpoint implement a supported interface like MessageHandler or PayloadEndpoint?

If you're trying to get a SOAP Endpoint to work with Spring 2 and run into the issue above, you can fix this by removing the jakarta.xml.bind and org.glassfish.jaxb dependencies, and then changing the jaxb2-maven-plugin version to 2.5.0.

To Reproduce
Steps to reproduce the behavior:

  1. Follow link above. Note that the import path includes .client.

Expected Behavior
Remove .client from import path, to use XSD generated models instead of WSDL generated models.

Environment (please complete the following information):

  • OS: macOS Sonoma 14.4.1

Additional Context
The "No adapter for endpoint" error listed seems commonly associated on Stack Overflow with not generating an @XmlRootElement annotation. However, I see this annotation in the generated classes. The actual issue pre-Spring-3 was the generated classes using Jakarta vs JavaX imports.

@apeterlic apeterlic added the triaged Issues reviewed by a dev and considered valid. Will be added in Jira. label Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
on-jira triaged Issues reviewed by a dev and considered valid. Will be added in Jira.
Projects
None yet
Development

No branches or pull requests

3 participants