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

Rename application and configuration classes in example #80

Merged
merged 1 commit into from
Nov 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,16 @@ public HelloWorldSOAP {
```java
public class MyApplication extends Application<MyApplicationConfiguration> {

private JAXWSBundle jaxWsBundle = new JAXWSBundle();
private JAXWSBundle jswBundle = new JAXWSBundle();

@Override
public void initialize(Bootstrap<MyApplicationConfiguration> bootstrap) {
bootstrap.addBundle(jaxWsBundle);
bootstrap.addBundle(jswBundle);
}

@Override
public void run(MyApplicationConfiguration configuration, Environment environment) throws Exception {
jaxWsBundle.publishEndpoint(
jswBundle.publishEndpoint(
new EndpointBuilder("/hello", new HelloWorldSOAP()));
}

Expand All @@ -135,7 +135,7 @@ Client
Using HelloWorldSOAP web service client:

```java
HelloWorldSOAP helloWorld = jaxWsBundle.getClient(
HelloWorldSOAP helloWorld=jwsBundle.getClient(
new ClientBuilder(HelloWorldSOAP.class, "http://server/path"));
System.out.println(helloWorld.sayHello());
```
Expand Down
2 changes: 1 addition & 1 deletion dropwizard-jakarta-xml-ws-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.kiwiproject.dropwizard.jakarta.xml.ws.example.JaxWsExampleApplication</mainClass>
<mainClass>org.kiwiproject.dropwizard.jakarta.xml.ws.example.JakartaXmlWsExampleApplication</mainClass>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/cxf/bus-extensions.txt</resource>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,93 +30,93 @@
import ws.example.ws.xml.jakarta.dropwizard.kiwiproject.org.mtomservice.MtomService;
import ws.example.ws.xml.jakarta.dropwizard.kiwiproject.org.wsdlfirstservice.WsdlFirstService;

public class JaxWsExampleApplication extends Application<JaxWsExampleApplicationConfiguration> {
public class JakartaXmlWsExampleApplication extends Application<JakartaXmlWsExampleConfiguration> {

private static final Logger LOG = LoggerFactory.getLogger(JaxWsExampleApplication.class);
private static final Logger LOG = LoggerFactory.getLogger(JakartaXmlWsExampleApplication.class);

// HibernateBundle is used by HibernateExampleService
private final HibernateBundle<JaxWsExampleApplicationConfiguration> hibernate = new HibernateBundle<>(Person.class) {
private final HibernateBundle<JakartaXmlWsExampleConfiguration> hibernate = new HibernateBundle<>(Person.class) {
@Override
public DataSourceFactory getDataSourceFactory(JaxWsExampleApplicationConfiguration configuration) {
public DataSourceFactory getDataSourceFactory(JakartaXmlWsExampleConfiguration configuration) {
return configuration.getDatabaseConfiguration();
}
};

// Jakarta XML Web Services Bundle
private final JAXWSBundle<Object> jaxWsBundle = new JAXWSBundle<>();
private final JAXWSBundle<Object> anotherJaxWsBundle = new JAXWSBundle<>("/api2");
private final JAXWSBundle<Object> jwsBundle = new JAXWSBundle<>();
private final JAXWSBundle<Object> anotherJwsBundle = new JAXWSBundle<>("/api2");

public static void main(String[] args) throws Exception {
new JaxWsExampleApplication().run(args);
new JakartaXmlWsExampleApplication().run(args);
}

@Override
public void initialize(Bootstrap<JaxWsExampleApplicationConfiguration> bootstrap) {
public void initialize(Bootstrap<JakartaXmlWsExampleConfiguration> bootstrap) {
bootstrap.addBundle(hibernate);
bootstrap.addBundle(jaxWsBundle);
bootstrap.addBundle(anotherJaxWsBundle);
bootstrap.addBundle(jwsBundle);
bootstrap.addBundle(anotherJwsBundle);
}

@SuppressWarnings({ "UnusedAssignment", "java:S1854", "java:S125" })
@Override
public void run(JaxWsExampleApplicationConfiguration jaxWsExampleApplicationConfiguration, Environment environment) {
public void run(JakartaXmlWsExampleConfiguration configuration, Environment environment) {

// Hello world service
@SuppressWarnings("unused")
EndpointImpl e = jaxWsBundle.publishEndpoint(
EndpointImpl e = jwsBundle.publishEndpoint(
new EndpointBuilder("/simple", new SimpleService()));

// publishEndpoint returns javax.xml.ws.Endpoint to enable further customization.
// e.getProperties().put(...);

// Publish Hello world service again using different JAXWSBundle instance
e = anotherJaxWsBundle.publishEndpoint(
e = anotherJwsBundle.publishEndpoint(
new EndpointBuilder("/simple", new SimpleService()));

// Java first service protected with basic authentication
e = jaxWsBundle.publishEndpoint(
e = jwsBundle.publishEndpoint(
new EndpointBuilder("/javafirst", new JavaFirstServiceImpl())
.authentication(new BasicAuthentication(new BasicAuthenticator(), "TOP_SECRET")));

// WSDL first service using server side Jakarta XML Web Services handler and CXF logging interceptors.
// The server handler is defined in the wsdlfirstservice-handlerchain.xml file, via the
// HandlerChain annotation on WsdlFirstServiceImpl
e = jaxWsBundle.publishEndpoint(
e = jwsBundle.publishEndpoint(
new EndpointBuilder("/wsdlfirst", new WsdlFirstServiceImpl())
.cxfInInterceptors(new LoggingInInterceptor())
.cxfOutInterceptors(new LoggingOutInterceptor()));

// Service using Hibernate
PersonDAO personDAO = new PersonDAO(hibernate.getSessionFactory());
e = jaxWsBundle.publishEndpoint(
e = jwsBundle.publishEndpoint(
new EndpointBuilder("/hibernate",
new HibernateExampleService(personDAO))
.sessionFactory(hibernate.getSessionFactory()));

// Publish the same service again using different JAXWSBundle instance
e = anotherJaxWsBundle.publishEndpoint(
e = anotherJwsBundle.publishEndpoint(
new EndpointBuilder("/hibernate",
new HibernateExampleService(personDAO))
.sessionFactory(hibernate.getSessionFactory()));

// WSDL first service using MTOM. Invoking enableMTOM on EndpointBuilder is not necessary
// if you use @MTOM Jakarta XML Web Services annotation on your service implementation class.
e = jaxWsBundle.publishEndpoint(
e = jwsBundle.publishEndpoint(
new EndpointBuilder("/mtom", new MtomServiceImpl())
.enableMtom()
);

// A RESTful resource that invokes WsdlFirstService on localhost and uses client side Jakarta XML Web Services handler.
environment.jersey().register(new AccessWsdlFirstServiceResource(
jaxWsBundle.getClient(
jwsBundle.getClient(
new ClientBuilder<>(
WsdlFirstService.class,
"http://localhost:8080/soap/wsdlfirst")
.handlers(new WsdlFirstClientHandler()))));

// A RESTful resource that invokes MtomService on localhost
environment.jersey().register(new AccessMtomServiceResource(
jaxWsBundle.getClient(
jwsBundle.getClient(
new ClientBuilder<>(
MtomService.class,
"http://localhost:8080/soap/mtom")
Expand All @@ -125,7 +125,7 @@ public void run(JaxWsExampleApplicationConfiguration jaxWsExampleApplicationConf
// A RESTful resource that invokes JavaFirstService on localhost and uses basic authentication and
// client side CXF interceptors.
environment.jersey().register(new AccessProtectedServiceResource(
jaxWsBundle.getClient(
jwsBundle.getClient(
new ClientBuilder<>(
JavaFirstService.class,
"http://localhost:8080/soap/javafirst")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;

public class JaxWsExampleApplicationConfiguration extends Configuration {
public class JakartaXmlWsExampleConfiguration extends Configuration {

@Valid
@NotNull
Expand Down