You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by du...@apache.org on 2006/01/18 16:07:48 UTC
svn commit: r370162 - in /webservices/axis/trunk/java/src/org/apache/axis:
MessageContext.java client/AxisClient.java client/Call.java
Author: dug
Date: Wed Jan 18 07:07:45 2006
New Revision: 370162
URL: http://svn.apache.org/viewcvs?rev=370162&view=rev
Log:
Couple of things:
1 - add a new call.invokeOneWay() that doesn't take any args - to match
the call.invoke(). Useful when you create the entire env manually
2 - add a new property to the msgContext that allows someone to tell
the client code to _not_ throw a fault when one is returned from
te server. This allows an app to get the soap fault as XML instead
of as some Java exception. Handy for gateways/intermediary type of
apps.
3 - create a new property isOneWay property on the MessageContext and
use it in favor of the Call one. This allows the rest of the engine
access to this information and (coming soon) will allow a service
the ability to tell the engine that the operation was a one-way
(programmatically) so the Java provider should not automatically
generate a soap envelope and instead return a 202.
Along with this are the get/set methods for this new property.
4 - make sure the msgcontext knows the true target URL when set change it
5 - remove a 'guess' in the messageContext.getPossibleOpsByQName code.
it incorrectly assumed that if the namespaces matched then it MUST
be a good matched - which just isn't the case.
Modified:
webservices/axis/trunk/java/src/org/apache/axis/MessageContext.java
webservices/axis/trunk/java/src/org/apache/axis/client/AxisClient.java
webservices/axis/trunk/java/src/org/apache/axis/client/Call.java
Modified: webservices/axis/trunk/java/src/org/apache/axis/MessageContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/src/org/apache/axis/MessageContext.java?rev=370162&r1=370161&r2=370162&view=diff
==============================================================================
--- webservices/axis/trunk/java/src/org/apache/axis/MessageContext.java (original)
+++ webservices/axis/trunk/java/src/org/apache/axis/MessageContext.java Wed Jan 18 07:07:45 2006
@@ -173,6 +173,7 @@
private String encodingStyle = Use.ENCODED.getEncoding();
private boolean useSOAPAction = false;
private String SOAPActionURI = null;
+ private boolean isOneWay = false;
/**
* SOAP Actor roles.
@@ -227,6 +228,7 @@
OperationDesc [] possibleOperations = null;
+ /* DUG - how can you possibly just guess like this???
if (serviceHandler == null) {
try {
if (log.isDebugEnabled()) {
@@ -240,8 +242,8 @@
} catch (ConfigurationException e) {
// Didn't find one...
}
-
}
+ */
if (serviceHandler != null) {
ServiceDesc desc = serviceHandler.getInitializedServiceDesc(this);
@@ -1506,5 +1508,13 @@
responseMessage.dispose();
responseMessage=null;
}
+ }
+
+ public void setIsOneWay(boolean value) {
+ isOneWay = value ;
+ }
+
+ public boolean getIsOneWay() {
+ return isOneWay ;
}
}
Modified: webservices/axis/trunk/java/src/org/apache/axis/client/AxisClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/src/org/apache/axis/client/AxisClient.java?rev=370162&r1=370161&r2=370162&view=diff
==============================================================================
--- webservices/axis/trunk/java/src/org/apache/axis/client/AxisClient.java (original)
+++ webservices/axis/trunk/java/src/org/apache/axis/client/AxisClient.java Wed Jan 18 07:07:45 2006
@@ -173,9 +173,8 @@
}
msgContext.setPastPivot(true);
- if (!msgContext.isPropertyTrue(Call.ONE_WAY)) {
- if ((handlerImpl != null) &&
- !msgContext.isPropertyTrue(Call.ONE_WAY)) {
+ if ( !msgContext.getIsOneWay() ) {
+ if (handlerImpl != null) {
try {
handlerImpl.handleResponse(msgContext);
} catch (RuntimeException ex) {
Modified: webservices/axis/trunk/java/src/org/apache/axis/client/Call.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/src/org/apache/axis/client/Call.java?rev=370162&r1=370161&r2=370162&view=diff
==============================================================================
--- webservices/axis/trunk/java/src/org/apache/axis/client/Call.java (original)
+++ webservices/axis/trunk/java/src/org/apache/axis/client/Call.java Wed Jan 18 07:07:45 2006
@@ -157,8 +157,6 @@
/** This will be true if an OperationDesc is handed to us whole */
private boolean operationSetManually = false;
- // Is this a one-way call?
- private boolean invokeOneWay = false;
private boolean isMsg = false;
// Our Transport, if any
@@ -271,14 +269,14 @@
*/
public static final String STREAMING_PROPERTY =
"axis.streaming";
-
+
/**
- * Internal property to indicate a one way call.
- * That will disable processing of response handlers.
+ * Property that allows for a client to get back a SOAP Fault as
+ * a normal soap message instead of having the engine throw an
+ * AxisFault
*/
- protected static final String ONE_WAY =
- "axis.one.way";
-
+ public static final String DONT_THROW_FAULT = "axis.dontThrowFault" ;
+
/**
* A Hashtable mapping protocols (Strings) to Transports (classes)
*/
@@ -844,6 +842,7 @@
String oldProto = tmpURL.getProtocol();
if ( protocol.equals(oldProto) ) {
this.transport.setUrl( address.toString() );
+ setProperty(MessageContext.TRANS_URL, address.toString());
return ;
}
}
@@ -862,6 +861,7 @@
Messages.getMessage("noTransport01",
protocol), null, null);
transport.setUrl(address.toString());
+ setProperty(MessageContext.TRANS_URL, address.toString());
setTransport(transport);
service.registerTransportForURL(address, transport);
}
@@ -1842,15 +1842,30 @@
*/
public void invokeOneWay(Object[] params) {
try {
- invokeOneWay = true;
+ msgContext.setIsOneWay(true);
invoke( params );
} catch( Exception exp ) {
throw new JAXRPCException( exp.toString() );
} finally {
- invokeOneWay = false;
+ msgContext.setIsOneWay(false);
}
}
+ public void invokeOneWay() {
+ try {
+ msgContext.setIsOneWay( true );
+ invoke();
+ } catch( Exception exp ) {
+ throw new JAXRPCException( exp.toString() );
+ } finally {
+ msgContext.setIsOneWay( false );
+ }
+ }
+
+ public boolean isInvokeOneWay() {
+ return msgContext.getIsOneWay();
+ }
+
/************************************************************************/
/* End of core JAX-RPC stuff */
/************************************************************************/
@@ -2410,7 +2425,7 @@
* parameter types, check for this case right now and toss a fault
* if things don't look right.
*/
- if (!invokeOneWay && operation != null &&
+ if (!msgContext.getIsOneWay() && operation != null &&
operation.getNumParams() > 0 && getReturnType() == null) {
// TCK:
// Issue an error if the return type was not set, but continue processing.
@@ -2763,7 +2778,7 @@
}
}
- if(!invokeOneWay) {
+ if ( !msgContext.getIsOneWay() ) {
invokeEngine(msgContext);
} else {
invokeEngineOneWay(msgContext);
@@ -2813,7 +2828,8 @@
//unless we don't care about the return value or we want
//a raw message back
//get the fault from the body and throw it
- throw ((SOAPFault)respBody).getFault();
+ if ( msgContext.isPropertyTrue(Call.DONT_THROW_FAULT,false) )
+ throw ((SOAPFault)respBody).getFault();
}
}
}
@@ -2827,14 +2843,14 @@
//create a new class
Runnable runnable = new Runnable(){
public void run() {
- msgContext.setProperty(Call.ONE_WAY, Boolean.TRUE);
+ msgContext.setIsOneWay(true);
try {
service.getEngine().invoke( msgContext );
} catch (AxisFault af){
//TODO: handle errors properly
log.debug(Messages.getMessage("exceptionPrinting"), af);
}
- msgContext.removeProperty(Call.ONE_WAY);
+ msgContext.setIsOneWay(false);
}
};
//create a thread to run it
@@ -2988,4 +3004,4 @@
operation = null;
operationSetManually = false;
}
-}
\ No newline at end of file
+}