Someone  (mka <[EMAIL PROTECTED]> is asking whether I was able to resolve the 
problem...

Well, I have to abandon this ws4ee (jndi lookup) approach, until I receive some 
re-assurance from the people who knows ws4ee technology better. There are some 
materials around, indicating that jndi lookup can be applied to the standalone 
clients as well (on the remote machine?). OK, may be, jndi has nothing to do 
with it - what can I see, there error message is created on the client side.

Now I make use of JBoss's ServiceFactoryImpl to create the service proxy 
dynamically.
This is my test class.
Please, note the mapping file location: META-INF/DataMgr-mapping.xml 
and the following way to obtain the required URL object from that resource 
location:
   mappingUrl = classloader.getResource(mappingLocation);


  | 
  | package org.imvs.qc.client;
  | 
  | import java.net.URL;
  | import java.io.File;
  | 
  | import javax.xml.rpc.Call;
  | import javax.xml.rpc.Service;
  | import javax.xml.rpc.ServiceFactory;
  | import javax.xml.rpc.JAXRPCException;
  | import javax.xml.rpc.ParameterMode;
  | import javax.xml.rpc.JAXRPCException;
  | import javax.xml.namespace.QName;
  | import java.rmi.RemoteException;
  | 
  | public class WSTestSansJNDI
  | {
  |    public  URL wsdlUrl;
  |    public  String ns;
  |    public  URL mappingUrl;
  |    private ClassLoader classloader;
  | 
  |   /**
  |    * Dynamic Proxy web service client without JNDI lookup.
  |    *
  |    * @param wsdlLocation - url of the WSDL file, e.g 
"http://myhost:8080/qc/datamgr/doIt?wsdl";
  |    * @param ns - this service's namespace,e.g. 
"http://org.imvs.qc.service.datamgr";
  |    * @param mappingLocation - actually, a resource type location of jaxrpc 
mapping file,
  |    * e.g "META-INF/DataMgr-mapping.xml"
  |    */
  | 
  | public WSTestSansJNDI(String wsdlLocation, String ns, String 
mappingLocation)
  |    {
  |       setClassLoader();
  | 
  |       this.ns = ns;
  | 
  |       try
  |       {
  |         if (wsdlLocation != null)
  |         {
  |          wsdlUrl = new URL(wsdlLocation);
  |         }
  | 
  |         if (mappingLocation != null)
  |         {
  |          mappingUrl = classloader.getResource(mappingLocation);
  | 
  |         }
  |       }
  |       catch (Exception ex)
  |       {
  |         System.out.println(ex.getMessage());
  |       }
  |    } /**
  |    * Set the class loader
  |    */
  |   public void setClassLoader()
  |   {
  |     classloader = getClass().getClassLoader();
  |   }
  | 
  |   /**
  |    * Gets the class loader
  |    *
  |    * @return ClassLoader - the class loader
  |    */
  |   public ClassLoader getClassLoader()
  |   {
  |     return classloader;
  |   }  public void test() throws Exception
  |   {
  |     try
  |     {
  |       QName serviceName = new QName(ns, "DataMgrService");
  |       QName portName = new QName(ns,"DataMgrPort");
  | 
  |       org.jboss.webservice.client.ServiceFactoryImpl factory =
  |         (org.jboss.webservice.client.ServiceFactoryImpl) 
ServiceFactory.newInstance();
  |       Service service = factory.createService(wsdlUrl, mappingUrl, null, 
serviceName, null);
  |       org.imvs.qc.service.datamgr.DataMgr port =
  |        (org.imvs.qc.service.datamgr.DataMgr) service.getPort(
  |         portName, org.imvs.qc.service.datamgr.DataMgr.class);
  | 
  |       org.imvs.qc.service.datamgr.GetInstrumentsResponse response = 
port.getInstruments(
  |         new org.imvs.qc.service.datamgr.GetInstrumentsRequest());
  | 
  |       org.imvs.qc.instrument.Instrument[] instruments =
  |         (org.imvs.qc.instrument.Instrument[]) response.getInstruments();
  | 
  |       for (int i = 0; i < instruments.length; i++)
  |       {
  |        org.imvs.qc.instrument.Instrument instr = 
(org.imvs.qc.instrument.Instrument) instruments;
  |        System.out.println(instr.toString());
  |       }
  |     }
  |     catch (RemoteException rex)
  |     {
  |       System.out.println("RemoteException");
  |       rex.printStackTrace(System.out);
  |     }
  |     catch (Exception ex)
  |     {
  |       ex.printStackTrace(System.out);
  |     }
  | 
  |    }
  | 
  |  public static void main(String[] args)
  |       throws Exception
  |    {
  |     System.out.println("WSTestSansJNDI.");
  |     System.out.println("arguments: wsdlUrl = " + args[0] + " ns=" + args[1]
  |       + " mapping=" + args[2]);
  |     WSTestSansJNDI test = new WSTestSansJNDI(args[0],args[1],args[2]);
  |     test.test();
  |    }
  | }
  | 
  | 

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3901043#3901043

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3901043


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to