[MOBY-l] MobyRequest or CentralImpl ?

Benjamin Good bmg at sfu.ca
Thu May 20 03:56:49 UTC 2004


 Hi Paul,

 I'm trying to get your method running but am having some trouble 
creating the mobyInputData for my request.  Running with Martin's method 
I built the query object directly as a string of xml as shown below. 
 I've been trying to create a MobyData instance, but am getting a bit 
lost.    What is the best procedure for creating a useful MobyData object ?

Sorry for being a little slow on the uptake here, but I'm sure a 
complete example would also be helpful for others in the future.

cheers
-Ben

    private String mobyQuery(String ns, String query){
        return "<?xml version='1.0' encoding='UTF-8'?> "+
        "<moby:MOBY xmlns:moby='http://www.biomoby.org/moby-s'>" +
              "<moby:Query>" +
                  "<moby:queryInput moby:articleName=''>"+
                        "<moby:Simple>"+
                            "<Object namespace='"+ns+"' id=\""+query+"\"/>"+
                        "</moby:Simple>"+
                    "</moby:queryInput>"+
               "</moby:Query>"+
        "</moby:MOBY>";
    }



Paul Gordon wrote:

> Benjamin Good wrote:
>
>> Hello,
>>
>> When I want to execute a moby service from my java client, it seems 
>> that there are two choices present in cvs,  the invokeService() 
>> method from the MobyRequest class and the doCall method from the 
>> CentralImpl class.
>>
>>  Any opinions about which one I should be using ?
>
>
> MobyRequest is designed specifically for this purpose.  If you look at 
> the ChangeLog, there is an example:
>
>    // Assumes you already have a service (mobyService) and data 
> (mobyInputData) around
>    mobyRequest = new MobyRequest(new CentralImpl());
>    mobyRequest.setDebugMode(true);
>    mobyRequest.setService(mobyService);
>    mobyRequest.setInput((MobyDataInstance[]) mobyInputData);
>    try{
>        mobyRequest.invokeService();
>    } catch(MobyException mobye){
>        System.err.println("Failure in MOBY protocol: " + mobye);
>    } catch(SOAPException soape){
>        System.err.println("Failure in SOAP transaction: " + soape);
>    } catch(NOSuccessException nse){
>        System.err.println("Failure in MOBY logic (input was not 
> acceptable " +
>                           "for this service)" + nse);
>    }
>
>
> You can reuse the MobyRequest object as many times as you like...
>
>>
>> thanks
>> -Ben
>>
>> _______________________________________________
>> moby-l mailing list
>> moby-l at biomoby.org
>> http://biomoby.org/mailman/listinfo/moby-l
>>
>
>
> _______________________________________________
> moby-l mailing list
> moby-l at biomoby.org
> http://biomoby.org/mailman/listinfo/moby-l
>
>





More information about the moby-l mailing list