Overview
This project contains optimations related to building JAX-WS requests.
Getting Started
See how to add this library to your project here https://search.maven.org/artifact/dk.bankdata.jaxws/gateway
Prerequisites
This library needs Java 8 or higher to function correctly
Author
- Kenneth Bøgedal - bogedal
License
This project is licensed under the MIT License
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
Usage
In the following section there will be provided code examples of each part of this library
System environment and dependencies
For this library to function you need to do the following:
-
add these dependencies to your gradle.build file
compile(group: 'org.apache.cxf', name: 'cxf-rt-frontend-jaxws', version: '3.3.3')
compile(group: 'org.apache.cxf', name: 'cxf-rt-transports-http', version: '3.3.3')
-
define these system environment variables:
SOAP_SCHEME
SOAP_HOST
SOAP_PORT
Application
In the Application class you need to configure the gateway. ei. which soap endpoints needs to be cached
import dk.bankdata.jaxws.gateway.cache.JaxWsCache;
@ApplicationScoped
@ApplicationPath("/")
public class RestApplication extends Application {
@Inject
private JaxWsCache jaxWsCache;
@PostConstruct
public void initialize() {
jaxWsCache
.port(SomeService.class, SomeServicePortType.class)
.port(SomeService.class, SomeServiceOtherPortType.class)
.port(SomeOtherService.class, SomeOtherPortType.class);
}
@Override
public Set<Class<?>> getClasses() {
...
}
@Override
public Set<Object> getSingletons() {
...
}
}
Get cached ports
To get the cached ports you need to annotate your porttype like this:
@RequestScoped
public class SomeServiceClient {
@Inject @JaxWsEndpoint
JaxWsGateway<SomeServicePortType> gateway;
public SomeResponse getSomething(SomeRequest request, InputHeader inputHeader) {
try {
return gateway.port().getSomething(request, inputHeader);
} catch (Exception e) {
...
}
}
}
```