Author: dims
Date: Tue Mar 4 08:41:19 2008
New Revision: 633536
URL: http://svn.apache.org/viewvc?rev=633536&view=rev
Log:
Fix for AXIS2-3116 - JAXWS Endpoint API does not work in 1.3 RC2
Modified:
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/EndpointImpl.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/endpoint/BasicEndpointTests.java
Modified:
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/EndpointImpl.java
URL:
http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/EndpointImpl.java?rev=633536&r1=633535&r2=633536&view=diff
==============================================================================
---
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/EndpointImpl.java
(original)
+++
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/EndpointImpl.java
Tue Mar 4 08:41:19 2008
@@ -42,6 +42,8 @@
import java.io.IOException;
import java.net.URL;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executor;
@@ -162,6 +164,16 @@
* @see javax.xml.ws.Endpoint#publish(java.lang.String)
*/
public void publish(String s) {
+ int port = -1;
+ try {
+ URI uri = new URI(s);
+ port = uri.getPort();
+ } catch (URISyntaxException e) {
+ }
+ // Default to 8080
+ if(port == -1){
+ port = 8080;
+ }
ConfigurationContext ctx =
endpointDesc.getServiceDescription().getAxisConfigContext();
try {
@@ -179,7 +191,7 @@
WorkerFactory wf = new HTTPWorkerFactory();
try {
- server = new SimpleHttpServer(ctx, wf, 6060); //TODO: Add a
configurable port
+ server = new SimpleHttpServer(ctx, wf, port);
server.init();
server.start();
} catch (IOException e) {
@@ -203,11 +215,11 @@
*/
public void stop() {
try {
- server.destroy();
- } catch (IOException e) {
- e.printStackTrace();
- } catch (InterruptedException e) {
- e.printStackTrace();
+ if(server != null) {
+ server.destroy();
+ }
+ } catch (Exception e) {
+ throw ExceptionFactory.makeWebServiceException(e);
}
}
Modified:
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/endpoint/BasicEndpointTests.java
URL:
http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/endpoint/BasicEndpointTests.java?rev=633536&r1=633535&r2=633536&view=diff
==============================================================================
---
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/endpoint/BasicEndpointTests.java
(original)
+++
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/endpoint/BasicEndpointTests.java
Tue Mar 4 08:41:19 2008
@@ -35,6 +35,7 @@
ep.publish("test");
assertTrue("The endpoint was not published successfully",
ep.isPublished());
+ ep.stop();
}
public void testCreateAndPublishEndpoint() {
@@ -43,6 +44,7 @@
Endpoint ep = Endpoint.publish("test" , sample);
assertTrue("The returned Endpoint instance was null", ep != null);
assertTrue("The endpoint was not published successfully",
ep.isPublished());
+ ep.stop();
}
public void testGetBinding() throws Exception {
@@ -55,9 +57,18 @@
assertTrue("The returned Binding instance was null", bnd != null);
assertTrue("The returned Binding instance was of the wrong type (" +
bnd.getClass().getName() + "), expected SOAPBinding",
SOAPBinding.class.isAssignableFrom(bnd.getClass()));
+ ep.stop();
}
-
- @WebService
+
+ public void testCreateAndPublishOnAlternatePort() throws Exception {
+ Endpoint ep = Endpoint.create(new SampleEndpoint());
+ ep.publish("http://localhost:16060/SampleEndpoint");
+ assertTrue("The returned Endpoint instance was null", ep != null);
+ assertTrue("The endpoint was not published successfully",
ep.isPublished());
+ ep.stop();
+ }
+
+ @WebService
class SampleEndpoint {
public int foo(String bar) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]