Skip to content
Snippets Groups Projects
Commit 3c7e6f6d authored by OZGCloud's avatar OZGCloud
Browse files

OZG-1701 add wsdl

parent 984ed4d5
Branches
Tags
No related merge requests found
...@@ -55,6 +55,11 @@ ...@@ -55,6 +55,11 @@
<!-- end::springws[] --> <!-- end::springws[] -->
<!-- Dev --> <!-- Dev -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId> <artifactId>spring-boot-configuration-processor</artifactId>
...@@ -88,16 +93,29 @@ ...@@ -88,16 +93,29 @@
<build> <build>
<finalName>${project.artifactId}</finalName> <finalName>${project.artifactId}</finalName>
<plugins> <plugins>
<!-- tag::xsd[] --> <!-- tag::wsdl/xsd[] -->
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>jaxb2-maven-plugin</artifactId> <artifactId>maven-jaxb2-plugin</artifactId>
<configuration> <configuration>
<sources> <schemaLanguage>WSDL</schemaLanguage>
<source>${project.basedir}/src/main/resources/formsolutions/formdata.xsd</source> <generatePackage>de.itvsh.kop.eingangsadapter.formsolutions</generatePackage>
</sources> <schemas>
<schema>
<fileset>
<directory>${basedir}/src/main/resources/wsdl</directory>
<includes>
<include>*.wsdl</include>
</includes>
</fileset>
</schema>
</schemas>
</configuration> </configuration>
</plugin> </plugin>
<!-- <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jaxb2-maven-plugin</artifactId>
<configuration> <sources> <source>${project.basedir}/src/main/resources/formsolutions/formdata.xsd</source>
</sources> </configuration> </plugin> -->
<!-- end::xsd[] --> <!-- end::xsd[] -->
<plugin> <plugin>
......
package de.itvsh.kop.eingangsadapter.formsolutions;
import java.time.ZonedDateTime;
import java.util.Map;
import java.util.UUID;
import org.springframework.stereotype.Component;
import de.itvsh.kop.eingangsadapter.common.formdata.Antragsteller;
import de.itvsh.kop.eingangsadapter.common.formdata.FormData;
import de.itvsh.kop.eingangsadapter.common.formdata.FormHeader;
import de.itvsh.kop.eingangsadapter.common.formdata.ZustaendigeStelle;
import de.ozg_sh.forms.formsolutions.SendFormRequest;
@Component
public class FormSolutionsMapper {
FormData map(SendFormRequest wsRequest) {
return FormData.builder() //
.id(UUID.randomUUID()) //
.header(FormHeader.builder() //
.formName(wsRequest.getFormName())
.createdAt(ZonedDateTime.now()) //
.build()) //
.antragsteller(Antragsteller.builder() //
.vorname(wsRequest.getVorname()) //
.nachname(wsRequest.getNachname()) //
.build()) //
.zustaendigeStelle(ZustaendigeStelle.builder() //
.organisationseinheitenId(wsRequest.getOrganisationseinheitenId()) //
.build()) //
.formData(Map.of("Hamstername", wsRequest.getNamedeshamsters())) //
.build();
}
}
package de.itvsh.kop.eingangsadapter.formsolutions; package de.itvsh.kop.eingangsadapter.formsolutions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ws.server.endpoint.annotation.Endpoint; import org.springframework.ws.server.endpoint.annotation.Endpoint;
import org.springframework.ws.server.endpoint.annotation.PayloadRoot; import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
import org.springframework.ws.server.endpoint.annotation.RequestPayload; import org.springframework.ws.server.endpoint.annotation.RequestPayload;
import org.springframework.ws.server.endpoint.annotation.ResponsePayload; import org.springframework.ws.server.endpoint.annotation.ResponsePayload;
import de.itvsh.kop.eingangsadapter.common.formdata.FormData;
import de.itvsh.kop.eingangsadapter.router.VorgangService;
import de.ozg_sh.forms.formsolutions.SendFormRequest;
import de.ozg_sh.forms.formsolutions.SendFormResponse;
import lombok.extern.log4j.Log4j2;
@Endpoint @Endpoint
@Log4j2
public class SendFormEndpoint { public class SendFormEndpoint {
private static final String NAMESPACE_URI = "http://forms.ozg-sh.de/formsolutions"; @PayloadRoot(namespace = WebServiceConfiguration.NAMESPACE_URI, localPart = "Request")
@Autowired
private FormSolutionsMapper mapper;
@Autowired
private VorgangService vorgangService;
@PayloadRoot(namespace = NAMESPACE_URI, localPart = "sendFormRequest")
@ResponsePayload @ResponsePayload
public SendFormResponse getFormData(@RequestPayload SendFormRequest request) { public Response receiveForm(@RequestPayload Request request) {
return buildSuccessResponse();
LOG.info("FormsolutionsRequest received: " + request.getFormName() + ";" + request.getVorname()); }
FormData formData = mapper.map(request);
vorgangService.createVorgang(formData);
SendFormResponse response = new SendFormResponse(); private Response buildSuccessResponse() {
response.setStatus("OK, alles klar " + request.getVorname()); var response = new Response();
response.setStatus("OK");
return response; return response;
} }
} }
package de.itvsh.kop.eingangsadapter.formsolutions; package de.itvsh.kop.eingangsadapter.formsolutions;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ClassPathResource;
import org.springframework.ws.config.annotation.EnableWs; import org.springframework.ws.config.annotation.EnableWs;
import org.springframework.ws.config.annotation.WsConfigurerAdapter; import org.springframework.ws.config.annotation.WsConfigurerAdapter;
import org.springframework.ws.transport.http.MessageDispatcherServlet;
import org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition; import org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition;
import org.springframework.xml.xsd.SimpleXsdSchema; import org.springframework.xml.xsd.SimpleXsdSchema;
import org.springframework.xml.xsd.XsdSchema; import org.springframework.xml.xsd.XsdSchema;
import org.springframework.xml.xsd.XsdSchemaCollection;
import org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection;
@EnableWs @EnableWs
@Configuration @Configuration
class WebServiceConfiguration extends WsConfigurerAdapter { class WebServiceConfiguration extends WsConfigurerAdapter {
@Bean(name = "formsolutions_formDatas") private static final String XSD_LOCATION = "wsdl/jsonWrap.xsd";
public DefaultWsdl11Definition defaultWsdl11Definition(XsdSchema formDataSchema) { static final String NAMESPACE_URI = "urn:JSONWrap";
DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition();
wsdl11Definition.setPortTypeName("FormDatasPort");
wsdl11Definition.setLocationUri("/ws");
wsdl11Definition.setTargetNamespace("http://forms.ozg-sh.de/formsolutions");
wsdl11Definition.setSchema(formDataSchema);
return wsdl11Definition;
}
@Bean @Bean
public XsdSchemaCollection formDataSchemata() { public ServletRegistrationBean<MessageDispatcherServlet> messageDispatcherServlet(ApplicationContext applicationContext) {
CommonsXsdSchemaCollection xsds = new CommonsXsdSchemaCollection(new ClassPathResource("formsolutions/formdata.xsd")); MessageDispatcherServlet servlet = new MessageDispatcherServlet();
xsds.setInline(false); servlet.setApplicationContext(applicationContext);
return xsds; servlet.setTransformWsdlLocations(true);
return new ServletRegistrationBean<>(servlet, "/ws/*");
} }
@Bean @Bean
public XsdSchema formDataSchema() { public XsdSchema formDataSchema() {
return new SimpleXsdSchema(new ClassPathResource("formsolutions/formdata.xsd")); return new SimpleXsdSchema(new ClassPathResource(XSD_LOCATION));
}
@Bean(name = "formsolutions_formDatas")
public DefaultWsdl11Definition defaultWsdl11Definition(XsdSchema formDataSchema) {
DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition();
wsdl11Definition.setPortTypeName("JSONWrapWebService");
wsdl11Definition.setLocationUri("/ws");
wsdl11Definition.setTargetNamespace(NAMESPACE_URI);
wsdl11Definition.setSchema(formDataSchema);
return wsdl11Definition;
} }
} }
grpc:
client:
pluto-local:
address: static://127.0.0.1:9090
negotiationType: PLAINTEXT
management:
server:
port: 8082
server:
port: 9292
kop:
adapter:
targetPlutoName: local
fallbackStrategy: DENY
routingStrategy: SINGLE
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="IOnlineAnhoerungWebServiceservice" targetNamespace="https://form-solutions.de/jsonWrap" xmlns:tns="https://form-solutions.de/jsonWrap" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jw="urn:JSONWrap">
<types>
<xsd:schema>
<xsd:import namespace="urn:JSONWrap" schemaLocation="jsonWrap.xsd"/>
</xsd:schema>
</types>
<message name="Request">
<part element="jw:Request"/>
</message>
<message name="Response">
<part element="jw:Response"/>
</message>
<portType name="JSONWrapWebService">
<operation name="json">
<input message="tns:Request"/>
<output message="tns:Response"/>
</operation>
</portType>
<binding name="JSONWrapWebServicebinding" type="tns:JSONWrapWebService">
<binding transport="http://schemas.xmlsoap.org/soap/http" xmlns="http://schemas.xmlsoap.org/wsdl/soap/"/>
<operation name="json">
<operation soapAction="urn:JSONWrapWebService#json" xmlns="http://schemas.xmlsoap.org/wsdl/soap/"/>
<input>
<body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" namespace="urn:JSONWrap"/>
</input>
<output>
<body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" namespace="urn:JSONWrap"/>
</output>
</operation>
</binding>
<service name="JSONWrapWebServiceservice">
<port name="JSONWrapWebServicePort" binding="tns:JSONWrapWebServicebinding">
<address xmlns="http://schemas.xmlsoap.org/wsdl/soap/" location="https://partnertest.form-solutions.de/soap/JSONWrap"/>
</port>
</service>
</definitions>
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:JSONWrap" xmlns:jw="urn:JSONWrap">
<xs:element name="Request">
<xs:complexType>
<xs:sequence>
<xs:element name="JSON" type="xsd:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Response">
<xs:complexType>
<xs:sequence>
<xs:element name="status" type="xsd:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
...@@ -8,6 +8,9 @@ management: ...@@ -8,6 +8,9 @@ management:
server: server:
port: 8082 port: 8082
server:
port: 9292
kop: kop:
adapter: adapter:
targetPlutoName: local targetPlutoName: local
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment