[209411] Axis2 client unable to get WSDL in end-to-end scenario.
diff --git a/bundles/org.eclipse.jst.ws.axis2.consumption.core/src/org/eclipse/jst/ws/axis2/consumption/core/command/Axis2WebservicesServerCommand.java b/bundles/org.eclipse.jst.ws.axis2.consumption.core/src/org/eclipse/jst/ws/axis2/consumption/core/command/Axis2WebservicesServerCommand.java
index e673038..f9acee7 100644
--- a/bundles/org.eclipse.jst.ws.axis2.consumption.core/src/org/eclipse/jst/ws/axis2/consumption/core/command/Axis2WebservicesServerCommand.java
+++ b/bundles/org.eclipse.jst.ws.axis2.consumption.core/src/org/eclipse/jst/ws/axis2/consumption/core/command/Axis2WebservicesServerCommand.java
@@ -11,6 +11,7 @@
* -------- -------- -----------------------------------------------------------
* 20070110 168762 sandakith@wso2.com - Lahiru Sandakith, Initial code to introduse the Axis2
* runtime to the framework for 168762
+ * 20080114 209411 sandakith@wso2.com - Lahiru Sandakith, Fix for the 209411, ?wsdl not update
*******************************************************************************/
package org.eclipse.jst.ws.axis2.consumption.core.command;
@@ -34,12 +35,9 @@
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
- //Copy the axis2 libs in to this client project
- //TODO No Need to copy the axis2 libs after the introduction of the facet
- // Check wether the facet is present and if not pop up a warning
IStatus status = Status.OK_STATUS;
model.setWebProjectName(project);
return status;
}
-
+
}
diff --git a/bundles/org.eclipse.jst.ws.axis2.consumption.core/src/org/eclipse/jst/ws/axis2/consumption/core/messages/Axis2ConsumptionUI.properties b/bundles/org.eclipse.jst.ws.axis2.consumption.core/src/org/eclipse/jst/ws/axis2/consumption/core/messages/Axis2ConsumptionUI.properties
index 5bc511c..120df03 100644
--- a/bundles/org.eclipse.jst.ws.axis2.consumption.core/src/org/eclipse/jst/ws/axis2/consumption/core/messages/Axis2ConsumptionUI.properties
+++ b/bundles/org.eclipse.jst.ws.axis2.consumption.core/src/org/eclipse/jst/ws/axis2/consumption/core/messages/Axis2ConsumptionUI.properties
@@ -15,6 +15,7 @@
# 20070517 187307 sandakith@wso2.com - Lahiru Sandakith
# 20070518 187311 sandakith@wso2.com - Lahiru Sandakith, Fixing test resource addition
# 20070601 190505 pmoogk@ca.ibm.com - Peter Moogk
+# 20080116 sandakith@wso2.com - Lahiru Sandakith, Introduced for the Fix 209411
###############################################################################
@@ -38,3 +39,4 @@
ERROR_INVALID_WSDL_FILE_READ_WRITEL=Exception occurred while reading or writing WSDL {0}
ERROR_CODEGEN_EXCEPTION=Exception occurred while code generation for WSDL {0}
ERROR_JUNIT_JAR_NOT_FOUND=Exception occurred while copying junit.jar
+ERROR_WSDL_PING_TIME_OUT=Could not retriew the WSDL, Timeout occurred..
diff --git a/bundles/org.eclipse.jst.ws.axis2.consumption.core/src/org/eclipse/jst/ws/axis2/consumption/core/messages/Axis2ConsumptionUIMessages.java b/bundles/org.eclipse.jst.ws.axis2.consumption.core/src/org/eclipse/jst/ws/axis2/consumption/core/messages/Axis2ConsumptionUIMessages.java
index 0610327..cc3d2ef 100644
--- a/bundles/org.eclipse.jst.ws.axis2.consumption.core/src/org/eclipse/jst/ws/axis2/consumption/core/messages/Axis2ConsumptionUIMessages.java
+++ b/bundles/org.eclipse.jst.ws.axis2.consumption.core/src/org/eclipse/jst/ws/axis2/consumption/core/messages/Axis2ConsumptionUIMessages.java
@@ -16,6 +16,7 @@
* 20070518 187311 sandakith@wso2.com - Lahiru Sandakith, Fixing test resource addition
* 20070601 190505 pmoogk@ca.ibm.com - Peter Moogk
* 20070824 200515 sandakith@wso2.com - Lahiru Sandakith, NON-NLS move to seperate file
+ * 20080116 sandakith@wso2.com - Lahiru Sandakith, Introduced for the Fix 209411
*******************************************************************************/
package org.eclipse.jst.ws.axis2.consumption.core.messages;
@@ -50,6 +51,7 @@
public static String ERROR_INVALID_WSDL_FILE_READ_WRITEL;
public static String ERROR_CODEGEN_EXCEPTION;
public static String ERROR_JUNIT_JAR_NOT_FOUND;
+ public static String ERROR_WSDL_PING_TIME_OUT;
static {
NLS.initializeMessages(BUNDLE_NAME, Axis2ConsumptionUIMessages.class);
diff --git a/bundles/org.eclipse.jst.ws.axis2.consumption.core/src/org/eclipse/jst/ws/axis2/consumption/core/utils/ServicePingUtil.java b/bundles/org.eclipse.jst.ws.axis2.consumption.core/src/org/eclipse/jst/ws/axis2/consumption/core/utils/ServicePingUtil.java
new file mode 100644
index 0000000..0801b5f
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.axis2.consumption.core/src/org/eclipse/jst/ws/axis2/consumption/core/utils/ServicePingUtil.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2007 WSO2 Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * WSO2 Inc. - initial API and implementation
+ * yyyymmdd bug Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20080116 sandakith@wso2.com - Lahiru Sandakith, Introduced for the Fix 209411
+ * WSDL retrieval issue
+ *******************************************************************************/
+package org.eclipse.jst.ws.axis2.consumption.core.utils;
+
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+
+import org.eclipse.jst.ws.axis2.consumption.core.messages.Axis2ConsumptionUIMessages;
+
+/**
+ * Utility class for the service ping
+ */
+public class ServicePingUtil {
+ /**
+ * WSDL Retrieve Timeout
+ */
+ int timeTORetrieveWSDL = 10000 ; // Default is 10 sec
+
+ /**
+ * Utility method to connect to a particular URL
+ * @param url
+ */
+ public void connectToURL(String urlString) throws Exception{
+ URL url = new URL(urlString);
+ long start = System.currentTimeMillis();
+ while (true) {
+ try {
+ URLConnection urlCon;
+ urlCon = url.openConnection();
+ // TODO handle the HTTPS scenario as well.
+ if (urlCon instanceof HttpURLConnection) {
+ HttpURLConnection httpCon = (HttpURLConnection)urlCon;
+ httpCon.setDoOutput(true);
+ httpCon.setDoInput(true);
+ httpCon.setUseCaches(false);
+ httpCon.setRequestMethod("GET");
+ HttpURLConnection.setFollowRedirects(true);
+ httpCon.setReadTimeout(timeTORetrieveWSDL);
+ httpCon.connect();
+ Thread.sleep(1000);
+ httpCon.disconnect();
+ } else {
+ // Do nothing
+ // Assume that this is in the local file system
+ }
+ break;
+ } catch (IOException e) {
+ if(System.currentTimeMillis() - start >= timeTORetrieveWSDL){
+ throw new IOException(Axis2ConsumptionUIMessages.ERROR_WSDL_PING_TIME_OUT);
+ }
+ Thread.sleep(1000);
+ }
+ }
+ }
+
+ /**
+ * Set the WSDL read timeout
+ * @param timeTORetrieveWSDL
+ */
+ public void setTimeTORetrieveWSDL(int timeTORetrieveWSDL) {
+ this.timeTORetrieveWSDL = timeTORetrieveWSDL;
+ }
+
+}
diff --git a/bundles/org.eclipse.jst.ws.axis2.creation.ui/src/org/eclipse/jst/ws/internal/axis2/creation/ui/wsrt/Axis2CheckWSDLCommand.java b/bundles/org.eclipse.jst.ws.axis2.creation.ui/src/org/eclipse/jst/ws/internal/axis2/creation/ui/wsrt/Axis2CheckWSDLCommand.java
new file mode 100644
index 0000000..cb4d3ac
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.axis2.creation.ui/src/org/eclipse/jst/ws/internal/axis2/creation/ui/wsrt/Axis2CheckWSDLCommand.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * yyyymmdd bug Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20080129 209411 kathy@ca.ibm.com - Kathy Chan
+ *******************************************************************************/
+package org.eclipse.jst.ws.internal.axis2.creation.ui.wsrt;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jst.ws.axis2.consumption.core.utils.ServicePingUtil;
+import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
+
+public class Axis2CheckWSDLCommand extends AbstractDataModelOperation{
+
+ private Axis2WebService ws_;
+
+ private String wsdlURI_;
+
+ public Axis2CheckWSDLCommand() {
+ }
+
+ public Axis2CheckWSDLCommand(Axis2WebService ws) {
+ ws_ = ws;
+
+ }
+
+ public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable )
+ {
+
+ wsdlURI_ = ws_.getWebServiceInfo().getWsdlURL();
+ try {
+ ServicePingUtil servicePingUtil = new ServicePingUtil();
+ servicePingUtil.connectToURL(wsdlURI_);
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ } catch (Exception e) {
+ if (e instanceof IOException) {
+ try {
+ throw new ExecutionException(e.getMessage());
+ } catch (ExecutionException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ } else {
+ e.printStackTrace();
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+
+
+ public String getWsdlURI() {
+ return wsdlURI_;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.axis2.creation.ui/src/org/eclipse/jst/ws/internal/axis2/creation/ui/wsrt/Axis2WebService.java b/bundles/org.eclipse.jst.ws.axis2.creation.ui/src/org/eclipse/jst/ws/internal/axis2/creation/ui/wsrt/Axis2WebService.java
index a76c231..23a4479 100644
--- a/bundles/org.eclipse.jst.ws.axis2.creation.ui/src/org/eclipse/jst/ws/internal/axis2/creation/ui/wsrt/Axis2WebService.java
+++ b/bundles/org.eclipse.jst.ws.axis2.creation.ui/src/org/eclipse/jst/ws/internal/axis2/creation/ui/wsrt/Axis2WebService.java
@@ -12,6 +12,7 @@
* 20070110 168762 sandakith@wso2.com - Lahiru Sandakith, Initial code to introduse the Axis2 runtime to the framework for 168762
* 20070425 183046 sandakith@wso2.com - Lahiru Sandakith
* 20070815 187840 sandakith@wso2.com - Lahiru Sandakith
+ * 20080129 209411 kathy@ca.ibm.com - Kathy Chan
*******************************************************************************/
package org.eclipse.jst.ws.internal.axis2.creation.ui.wsrt;
@@ -30,8 +31,6 @@
import org.eclipse.jst.ws.axis2.creation.core.command.Axis2WSDL2JavaCommand;
import org.eclipse.jst.ws.axis2.creation.core.command.Axis2WebservicesServerCommand;
import org.eclipse.jst.ws.axis2.creation.core.data.DataModel;
-//import org.eclipse.jst.ws.internal.axis2.creation.ui.command.Page1ComesUpBeforeThisBUCommand;
-//import org.eclipse.jst.ws.internal.axis2.creation.ui.command.Page1ComesUpBeforeThisTDCommand;
import org.eclipse.wst.command.internal.env.core.ICommandFactory;
import org.eclipse.wst.command.internal.env.core.SimpleCommandFactory;
import org.eclipse.wst.common.environment.IEnvironment;
@@ -112,6 +111,13 @@
public ICommandFactory run(IEnvironment env, IContext ctx, ISelection sel,
String project, String earProject)
{
- return null;
+ Vector commands = new Vector();
+
+
+ commands.add(new Axis2CheckWSDLCommand(this));
+
+
+ return new SimpleCommandFactory(commands);
+
}
}