summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpshi2011-10-26 01:42:21 (EDT)
committermwu2011-10-26 01:42:21 (EDT)
commit9e968bf1f12e2afb82be2ee31c1709e242ac7752 (patch)
tree99f22f559f0b2382da7ca60d616202a747ee14d7
parenta902fe342eddc6348129f8b7db231d508accf79d (diff)
downloadorg.eclipse.datatools.enablement.oda-9e968bf1f12e2afb82be2ee31c1709e242ac7752.zip
org.eclipse.datatools.enablement.oda-9e968bf1f12e2afb82be2ee31c1709e242ac7752.tar.gz
org.eclipse.datatools.enablement.oda-9e968bf1f12e2afb82be2ee31c1709e242ac7752.tar.bz2
fix ted 42447, throw exception when the service and port are null
-rw-r--r--plugins/org.eclipse.datatools.enablement.oda.ws.ui/src/org/eclipse/datatools/enablement/oda/ws/ui/util/WSConsole.java8
-rw-r--r--plugins/org.eclipse.datatools.enablement.oda.ws.ui/src/org/eclipse/datatools/enablement/oda/ws/ui/wizards/OperationPage.java22
-rw-r--r--plugins/org.eclipse.datatools.enablement.oda.ws.ui/src/org/eclipse/datatools/enablement/oda/ws/ui/wizards/SOAPParametersPage.java12
-rw-r--r--plugins/org.eclipse.datatools.enablement.oda.ws.ui/src/org/eclipse/datatools/enablement/oda/ws/ui/wizards/SOAPRequestPage.java16
-rw-r--r--plugins/org.eclipse.datatools.enablement.oda.ws/src/org/eclipse/datatools/enablement/oda/ws/i18n/messages.properties4
-rw-r--r--plugins/org.eclipse.datatools.enablement.oda.ws/src/org/eclipse/datatools/enablement/oda/ws/util/WSDLAdvisor.java24
6 files changed, 67 insertions, 19 deletions
diff --git a/plugins/org.eclipse.datatools.enablement.oda.ws.ui/src/org/eclipse/datatools/enablement/oda/ws/ui/util/WSConsole.java b/plugins/org.eclipse.datatools.enablement.oda.ws.ui/src/org/eclipse/datatools/enablement/oda/ws/ui/util/WSConsole.java
index b53213b..1734f5e 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.ws.ui/src/org/eclipse/datatools/enablement/oda/ws/ui/util/WSConsole.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.ws.ui/src/org/eclipse/datatools/enablement/oda/ws/ui/util/WSConsole.java
@@ -371,10 +371,11 @@ public class WSConsole
/**
*
* @return
+ * @throws OdaException
*/
- public String getTemplate( )
+ public String getTemplate( ) throws OdaException
{
- WSDLAdvisor wsdlAdvisor=new WSDLAdvisor();
+ WSDLAdvisor wsdlAdvisor = new WSDLAdvisor( );
return wsdlAdvisor.getSOAPRequestTemplate( getPropertyValue( Constants.WSDL_URI ),
getPropertyValue( Constants.OPERATION_TRACE ) );
}
@@ -751,8 +752,9 @@ public class WSConsole
* @param queryText
* @param params
* @return
+ * @throws OdaException
*/
- public String manipulateTemplate( )
+ public String manipulateTemplate( ) throws OdaException
{
SOAPRequest soapRequest = new SOAPRequest( getPropertyValue( Constants.WS_QUERYTEXT ) );
String[] template = soapRequest.getTemplate( );
diff --git a/plugins/org.eclipse.datatools.enablement.oda.ws.ui/src/org/eclipse/datatools/enablement/oda/ws/ui/wizards/OperationPage.java b/plugins/org.eclipse.datatools.enablement.oda.ws.ui/src/org/eclipse/datatools/enablement/oda/ws/ui/wizards/OperationPage.java
index 16c7db2..def5ccf 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.ws.ui/src/org/eclipse/datatools/enablement/oda/ws/ui/wizards/OperationPage.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.ws.ui/src/org/eclipse/datatools/enablement/oda/ws/ui/wizards/OperationPage.java
@@ -413,12 +413,19 @@ public class OperationPage extends DataSetWizardPage
protected boolean canLeave( )
{
saveToModle( );
- testDirty( );
+ try
+ {
+ testDirty( );
+ }
+ catch ( OdaException e )
+ {
+ this.setErrorMessage( e.getMessage( ) );
+ }
return super.canLeave( );
}
- private void testDirty( )
+ private void testDirty( ) throws OdaException
{
if ( !WSUtil.isNull( initOperationTrace )
&& !initOperationTrace.equals( operationTrace ) )
@@ -437,7 +444,7 @@ public class OperationPage extends DataSetWizardPage
}
}
- private void regenerateTemplate( )
+ private void regenerateTemplate( ) throws OdaException
{
wsQuery = WSConsole.getInstance( ).getTemplate( );
if ( !WSUtil.isNull( wsQuery ) )
@@ -466,7 +473,14 @@ public class OperationPage extends DataSetWizardPage
IWizardPage page = super.getNextPage( );
if ( page instanceof SOAPParametersPage )
- ( (SOAPParametersPage) page ).refresh( selectionChanged );
+ try
+ {
+ ( (SOAPParametersPage) page ).refresh( selectionChanged );
+ }
+ catch ( OdaException e )
+ {
+ this.setErrorMessage( e.getMessage( ) );
+ }
selectionChanged = false;
return page;
diff --git a/plugins/org.eclipse.datatools.enablement.oda.ws.ui/src/org/eclipse/datatools/enablement/oda/ws/ui/wizards/SOAPParametersPage.java b/plugins/org.eclipse.datatools.enablement.oda.ws.ui/src/org/eclipse/datatools/enablement/oda/ws/ui/wizards/SOAPParametersPage.java
index 0f56726..2396805 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.ws.ui/src/org/eclipse/datatools/enablement/oda/ws/ui/wizards/SOAPParametersPage.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.ws.ui/src/org/eclipse/datatools/enablement/oda/ws/ui/wizards/SOAPParametersPage.java
@@ -15,6 +15,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.datatools.connectivity.oda.design.DataSetDesign;
import org.eclipse.datatools.connectivity.oda.design.ui.wizards.DataSetWizardPage;
import org.eclipse.datatools.enablement.oda.ws.soap.SOAPParameter;
@@ -407,7 +408,14 @@ public class SOAPParametersPage extends DataSetWizardPage
IWizardPage page = super.getNextPage( );
if ( page instanceof SOAPRequestPage )
- ( (SOAPRequestPage) page ).refresh( );
+ try
+ {
+ ( (SOAPRequestPage) page ).refresh( );
+ }
+ catch ( OdaException e )
+ {
+ this.setErrorMessage( e.getMessage( ) );
+ }
return page;
}
@@ -458,7 +466,7 @@ public class SOAPParametersPage extends DataSetWizardPage
WSConsole.getInstance( ).terminateSession( );
}
- void refresh( boolean refreshParameters )
+ void refresh( boolean refreshParameters ) throws OdaException
{
wsQueryText = WSConsole.getInstance( ).getTemplate( );
initViewer( refreshParameters );
diff --git a/plugins/org.eclipse.datatools.enablement.oda.ws.ui/src/org/eclipse/datatools/enablement/oda/ws/ui/wizards/SOAPRequestPage.java b/plugins/org.eclipse.datatools.enablement.oda.ws.ui/src/org/eclipse/datatools/enablement/oda/ws/ui/wizards/SOAPRequestPage.java
index 07fe222..85fd1b8 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.ws.ui/src/org/eclipse/datatools/enablement/oda/ws/ui/wizards/SOAPRequestPage.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.ws.ui/src/org/eclipse/datatools/enablement/oda/ws/ui/wizards/SOAPRequestPage.java
@@ -13,6 +13,7 @@ package org.eclipse.datatools.enablement.oda.ws.ui.wizards;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.datatools.connectivity.oda.design.DataSetDesign;
import org.eclipse.datatools.connectivity.oda.design.ui.wizards.DataSetWizardPage;
import org.eclipse.datatools.enablement.oda.ws.soap.SOAPParameter;
@@ -142,8 +143,15 @@ public class SOAPRequestPage extends DataSetWizardPage
{
if ( MessageDialog.openConfirm( null,
Messages.getString( "soapRequestPage.title.regenerateTemplate" ), //$NON-NLS-1$
- Messages.getString( "soapRequestPage.message.regenerateTemplate" ) ) ) //$NON-NLS-1$
- regenerateTemplate( );
+ Messages.getString( "soapRequestPage.message.regenerateTemplate" ) ) )
+ try
+ {
+ regenerateTemplate( );
+ }
+ catch ( OdaException e1 )
+ {
+ setErrorMessage( e1.getMessage( ) );
+ }
}
} );
@@ -202,7 +210,7 @@ public class SOAPRequestPage extends DataSetWizardPage
return length > width ? length : width;
}
- private void regenerateTemplate( )
+ private void regenerateTemplate( ) throws OdaException
{
queryText.setText( WSConsole.getInstance( ).getTemplate( ) );
parameters = WSConsole.getInstance( ).getParameters( );
@@ -276,7 +284,7 @@ public class SOAPRequestPage extends DataSetWizardPage
initFromModel( );
}
- void refresh( )
+ void refresh( ) throws OdaException
{
String value = WSConsole.getInstance( ).manipulateTemplate( );
if ( value != null )
diff --git a/plugins/org.eclipse.datatools.enablement.oda.ws/src/org/eclipse/datatools/enablement/oda/ws/i18n/messages.properties b/plugins/org.eclipse.datatools.enablement.oda.ws/src/org/eclipse/datatools/enablement/oda/ws/i18n/messages.properties
index d4511e7..0ed2bd7 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.ws/src/org/eclipse/datatools/enablement/oda/ws/i18n/messages.properties
+++ b/plugins/org.eclipse.datatools.enablement.oda.ws/src/org/eclipse/datatools/enablement/oda/ws/i18n/messages.properties
@@ -16,4 +16,6 @@
webservice.soap.fault=A SOAP error occurred.
webservice.soap.fault.faultcode=Fault code
webservice.soap.fault.faultstring=Fault string
-webservice.soap.fault.reason=Reason \ No newline at end of file
+webservice.soap.fault.reason=Reason
+service.notexist=cannot get service
+port.notexist=cannot get port \ No newline at end of file
diff --git a/plugins/org.eclipse.datatools.enablement.oda.ws/src/org/eclipse/datatools/enablement/oda/ws/util/WSDLAdvisor.java b/plugins/org.eclipse.datatools.enablement.oda.ws/src/org/eclipse/datatools/enablement/oda/ws/util/WSDLAdvisor.java
index 954bf3a..ff4990f 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.ws/src/org/eclipse/datatools/enablement/oda/ws/util/WSDLAdvisor.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.ws/src/org/eclipse/datatools/enablement/oda/ws/util/WSDLAdvisor.java
@@ -18,7 +18,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.Vector;
import javax.wsdl.Binding;
import javax.wsdl.BindingInput;
@@ -40,6 +39,8 @@ import javax.wsdl.factory.WSDLFactory;
import javax.wsdl.xml.WSDLReader;
import javax.xml.namespace.QName;
+import org.eclipse.datatools.connectivity.oda.OdaException;
+import org.eclipse.datatools.enablement.oda.ws.i18n.Messages;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
@@ -270,8 +271,10 @@ public class WSDLAdvisor
* @param wsdlURI
* @param operationTrace
* @return
+ * @throws OdaException
*/
public String getSOAPRequestTemplate( String wsdlURI, String operationTrace )
+ throws OdaException
{
String template = EMPTY_STRING;
if ( !checkOperationTrace( operationTrace ) )
@@ -289,15 +292,16 @@ public class WSDLAdvisor
}
/**
- * Generates the Response template when the system can not get the response from
- * the target wsdlURI,will use the sample data to generate the template
+ * Generates the Response template when the system can not get the response
+ * from the target wsdlURI,will use the sample data to generate the template
*
* @param wsdlURI
* @param operationTrace
* @return
+ * @throws OdaException
*/
public String getLocalSOAPResponseTemplate( String wsdlURI,
- String operationTrace )
+ String operationTrace ) throws OdaException
{
String template = EMPTY_STRING;
if ( !checkOperationTrace( operationTrace ) )
@@ -1284,9 +1288,10 @@ public class WSDLAdvisor
* @param operationTrace
* @param inOrOutput(value
* is "in" or "out")
+ * @throws OdaException
*/
private String buildBody( String wsdlURI, String operationTrace,
- String inOrOutput )
+ String inOrOutput ) throws OdaException
{
String result = enter( ) + tab( 1 ) + SOAP_BODY_START;
@@ -1303,6 +1308,7 @@ public class WSDLAdvisor
}
private static boolean isRPC( String wsdlURI, String operationTrace )
+ throws OdaException
{
boolean isRPC = false;
@@ -1310,7 +1316,15 @@ public class WSDLAdvisor
String[] opSplit = operationTrace.split( RE_DELIMITER_OPEARTION );
Service service = definition.getService( new QName( definition.getTargetNamespace( ),
opSplit[0] ) );// service
+ if ( service == null )
+ {
+ throw new OdaException( Messages.getString( "service.notexist" ) );
+ }
Port port = service.getPort( opSplit[1] );// port
+ if ( port == null )
+ {
+ throw new OdaException( Messages.getString( "port.notexist" ) );
+ }
Binding binding = port.getBinding( );
List extElements = binding.getExtensibilityElements( );