Exposing Contract first SOAP Webservice with spring-boot and Weblogic - spring-boot

I am trying to expose Contract First SOAP Webservice with spring-boot and Weblogic. Its a Gradle based setup and i am using following dependencies for generation of JAXB classes.
jaxb 'com.sun.xml.bind:jaxb-core:2.2.11'
jaxb 'com.sun.xml.bind:jaxb-xjc:2.2.11'
jaxb 'com.sun.xml.bind:jaxb-impl:2.2.11'
jaxb 'javax.xml.bind:jaxb-api:2.2.12-b141001.1542'
compile(files(genJaxb.classesDir).builtBy(genJaxb))
I have a static response XML which i am sending as a response. The XML is first unmarshalled and then return. Now the problem here is response XML elements are coming with namespace prefixes which i want to avoid as on the client side it is causing some issue which i am not aware of as i dont have access to that system.
Could you please suggest on how i can control marshalling process used by Spring framework to avoid the prefix generation?
Thanks and Regards,
HG

Related

Spring Cloud Routing Function and SPEL Expression injection - CVE-2022-22963

I am having a springboot application and my local maven repository is having spring cloud dependencies present in it. I understand that for someone to use the CVE-2022-22963 vulnerability, the code should written to use the Spring Cloud routing function. Presence of the the spring cloud jar dependencies is alone not enough to exploit this vulnerability.
As per this link (https://sysdig.com/blog/cve-2022-22963-spring-cloud/),
The issue with CVE-2022-22963 is that it permits using HTTP request header spring.cloud.function.routing-expression parameter and SpEL expression to be injected and executed through StandardEvaluationContext.

Spring - How do I annotate properties in classes

I have a Java RESTful client that works create and I use Jackson to de/serialize the returned requests (serialize as XML).
For returned classes I don't need to do anything. For the classes I post (serialize) I use com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
Now with Spring, where the inbound requests can be JSON or XML and the return also can be JSON or XML, do I need to do the equivalent? And if so, what annotation do I use?
Spring pulls in Jackson. But the library it pulls in has com.fasterxml.jackson but not com.fasterxml.jackson.dataformat.
And... I was not aware there were different Jackson libraries. But as there are, which one does Spring use?

Generate XSD from JAXB2 annotated class, without using APT

I have an application, that my JAXB2 annotated classes are possibly stored in multiple JARs, and I am using them in my web app (which use Spring MVC with Spring OXM Jaxb2Marshaller to expose RESTful WS).
I would want to generate the XSD for all classes that is possibly be used in my WS. However, com.sun.tools.jxc.maven2:maven-jaxb-schemagen-plugin and org.codehaus.mojo:jaxb2-maven-plugin are generating by inspecting the source code of the project but I want some similar solution which base on the runtime classes, as my POJOs are stored in other JARs, which APT will not be able to scan my code.
It is fine to generate the XSD in compile time, or by running the web app. Is there any solution?
Use JAXBContext.generateSchema(...) in the runtime.
See this answer:
Is it possible to generate a XSD from a JAXB-annotated class?

Spring Boot and contract first Soap WebService

I am currently trying to develop a Soap webservice based on a wsdl I got from an external supplier. The goal is to implement this using Spring Boot. I need to provide the server implementation from the provided wsdl. However I searched all over and tried some different combinations I am stuck on how I can implement the WebService using Spring Boot.
I tried using the example given on http://spring.io/guides/gs/producing-web-service/ but this does not give me the correct result. The interfaces to implement the webservice are nog generated.
Any hints or tips on how contract first Soap webservice can be implemented using Spring Boot?
The issue I see you want to generate java objects from WSDL.
Preferable way is to use cxf-codegen-plugin for that.
Then just use spring-boot as describer in example given in question.
Hope this will help you.

Mock service as a war through maven

i have a xsd conataining the request and response, i am using this xsd to create mock service and deploying as a war through soap ui.
but How i can do the same thing using Maven without using Soap ui (i should not use maven-ant-plugin)??
Is there any plugin to do that ??

Resources