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 15:56:07 UTC
svn commit: r370155 -
/webservices/axis/trunk/java/src/org/apache/axis/client/Service.java
Author: dug
Date: Wed Jan 18 06:56:06 2006
New Revision: 370155
URL: http://svn.apache.org/viewcvs?rev=370155&view=rev
Log:
Add the ability for a client to set the client engine's config file
directly w/o having to manually create a new FileProvider. Basically
a util method but a handy one.
Modified:
webservices/axis/trunk/java/src/org/apache/axis/client/Service.java
Modified: webservices/axis/trunk/java/src/org/apache/axis/client/Service.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/src/org/apache/axis/client/Service.java?rev=370155&r1=370154&r2=370155&view=diff
==============================================================================
--- webservices/axis/trunk/java/src/org/apache/axis/client/Service.java (original)
+++ webservices/axis/trunk/java/src/org/apache/axis/client/Service.java Wed Jan 18 06:56:06 2006
@@ -19,6 +19,7 @@
import org.apache.axis.AxisEngine;
import org.apache.axis.EngineConfiguration;
import org.apache.axis.configuration.EngineConfigurationFactoryFinder;
+import org.apache.axis.configuration.FileProvider;
import org.apache.axis.encoding.TypeMappingRegistryImpl;
import org.apache.axis.utils.ClassUtils;
import org.apache.axis.utils.Messages;
@@ -42,6 +43,8 @@
import javax.xml.rpc.ServiceException;
import javax.xml.rpc.encoding.TypeMappingRegistry;
import javax.xml.rpc.handler.HandlerRegistry;
+import java.io.File;
+import java.io.FileInputStream;
import java.io.InputStream;
import java.io.Serializable;
import java.lang.reflect.Constructor;
@@ -803,6 +806,20 @@
*/
public void setEngineConfiguration(EngineConfiguration config) {
this.config = config;
+ }
+
+ public void setClientConfig(String filename) throws Exception {
+ InputStream input = null ;
+ if ( (new File(filename)).exists() )
+ input = new FileInputStream( filename );
+ else {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ input = cl.getResourceAsStream( filename );
+ }
+ if ( input == null ) throw new Exception("Can't locate: " + filename );
+ FileProvider config = new FileProvider( input );
+ setEngineConfiguration( config );
+ setEngine( getAxisClient() );
}
/**