Last active
December 9, 2015 17:49
-
-
Save cjmamo/4306173 to your computer and use it in GitHub Desktop.
Demystifying Apache CXF: A Hello World App
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.opensourcesoftwareandme; | |
public class HelloWorldImpl{ | |
public String sayHi(String text) { | |
return "Hello " + text; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.opensourcesoftwareandme; | |
import javax.jws.WebParam; | |
import javax.jws.WebService; | |
@WebService(serviceName = "HelloWorld") | |
public class HelloWorldImpl{ | |
public String sayHi(@WebParam(name = "text") String text) { | |
return "Hello " + text; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
<dependencies> | |
<dependency> | |
<groupId>org.apache.cxf</groupId> | |
<artifactId>cxf-rt-frontend-jaxws</artifactId> | |
<version>${cxf.version}</version> | |
</dependency> | |
<dependency> | |
<groupId>org.apache.cxf</groupId> | |
<artifactId>cxf-rt-transports-http-jetty</artifactId> | |
<version>${cxf.version}</version> | |
</dependency> | |
</dependencies> | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mvn package; mvn exec:java -Dexec.mainClass="org.opensourcesoftwareandme.Server" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.opensourcesoftwareandme; | |
import javax.xml.ws.Endpoint; | |
public class Server { | |
public static void main(String args[]) throws Exception { | |
Endpoint.publish("http://localhost:9000/helloWorld", new HelloWorldImpl()); | |
System.out.println("Server started..."); | |
Thread.sleep(5 * 60 * 1000); | |
System.out.println("Server stopping..."); | |
System.exit(0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment