[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Condor-users] Condor web service



Title: Condor web service

Hi everybody,
I'm facing some troubles again ... I try to make a web service using apache axis2 which interface the condor service.
If I run a basic web service (without condor) everythin is working well, if I lunch condor througt the java code, everything is working as well ... but if I try to make my condor job lunched by a web service ... nothing!!
The web service is ok as the service list don't find any problem ... I put the birdpath.jar and the condor.jar into the WEB-INF/lib of my tomcat server!
I know it can work out because it used to work and have no idea what I did wrong !!


the error given is:
Exception in thread "main" org.apache.axis2.AxisFault: condor/CondorScheddLocator
        at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:434)
        at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:373)
        at org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:294)
        at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:520)
        at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:500)
        at AvedClient.main(CondorClient.java:39)


here is a simple code which should work (not using special jar except for birdpath and condor)

------------------------------------------------------------- Server code
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.rmi.RemoteException;

import javax.xml.rpc.ServiceException;

import condor.UniverseType;

import birdbath.Schedd;
import birdbath.Transaction;


public class CondorTest {

        public String lunch () {
                Schedd schedd;
                try {
                        schedd = new Schedd(new URL("http://localhost:8181"));
                        Transaction xact = schedd.createTransaction();
                        xact.begin(30);
                        int cluster = xact.createCluster();
                        int job = xact.createJob(cluster);
                        File[] files = { new File("/home/jerome/cp.sub") };
                        xact.submit(cluster, job, "jerome", UniverseType.VANILLA, "/bin/cp", "cp.sub cp.copy", null, null, files);
                        xact.commit();
                        return ("op");
                } catch (MalformedURLException e) {
                        // TODO Auto-generated catch block
                        return ("pas op");
                } catch (ServiceException e) {
                        // TODO Auto-generated catch block
                        return ("pas op");
                } catch (RemoteException e) {
                        // TODO Auto-generated catch block
                        return ("pas op");
                } catch (FileNotFoundException e) {
                        // TODO Auto-generated catch block
                        return ("pas op");
                } catch (IOException e) {
                        // TODO Auto-generated catch block
                        return ("pas op");
                }

        }
       
        public static void main(String[] args) throws Exception {
                CondorTest test = new CondorTest();
                test.lunch();
        }
       
       
}



-------------------------------------------------------------------------- Client code
import java.util.Iterator;

import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;


public class CondorClient {
   
    public static OMElement createPayLoad() {
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac.createOMNamespace("http://ws.apache.org/axis2/xsd", "ns1");
        OMElement method = fac.createOMElement("echo", omNs);
        OMElement value = fac.createOMElement("value", omNs);
        value.setText("Hello , my first service utilization");
        method.addChild(value);
        return method;
    }
   
   
    public static void main(String[] args) throws Exception {
       
        ServiceClient client = new ServiceClient();
        // create option object
        Options opts = new Options();
        //setting target EPR
        opts.setTo(new EndpointReference("http://localhost:8080/axis2/services/CondorTest/lunch"));
        //Setting action ,and which can be found from the wsdl of the service
        opts.setAction("urn:echo");
        client.setOptions(opts);
        OMElement res = client.sendReceive(createPayLoad());
        System.out.println(res);
   
    }

}

thx so much for your help