[MOBY-dev] Problems calling a Moby service with secondary parameters

Michael Gerlich MichaelGerlich at gmx.de
Wed Sep 3 09:17:42 UTC 2008


Hi all,

I'm working on a simple java app (client) that calls some Biomoby services I
wrote (for JUnit testing). One of these, "get_DBLinks_From_Peaklist"
registered under authority "ipb-halle.de" takes additional 2 secondary
parameters that modify its query behavior and the resulting number of
outputs.

Now when I try to add both secondary parameters to the input, the service
call fails with the following message:

Exception in thread "main" org.biomoby.shared.MobyException: Service
get_DBLinks_From_Peaklist was provided 1 secondary input parameter(s), but
takes 2 (query 1).  Extra secondary parameters must have been specified
	at
org.biomoby.client.MobyRequest.convertMOBYDataToMOBYRequest(MobyRequest.java
:928)
	at
org.biomoby.client.MobyRequest.invokeService(MobyRequest.java:302)
	at
org.biomoby.client.MobyRequest.invokeService(MobyRequest.java:282)
	at
org.biomoby.client.MobyRequest.invokeService(MobyRequest.java:275)
	at test.Moby_JUnit_Tests.main(Moby_JUnit_Tests.java:86)


My code is like that:

Central worker = new CentralImpl();
templateService = new MobyService("get_DBLinks_From_Peaklist", authority);
// authority = "ipb-halle.de"
validServices = worker.findService(templateService);
		
comp = new MobyDataComposite(new MobyDataType("MSPeakRel"));
comp.put("relInt", new MobyDataInt(999));
comp.put("mz", new MobyDataFloat(273.069));

MobyDataSecondaryInstance[] secParams = new
MobyDataSecondaryInstance[validServices[0].getSecondaryInputs().length];
for (int i = 0; i < validServices[0].getSecondaryInputs().length; i++) {
	secParams[i] = new MobyDataSecondaryInstance(new
MobySecondaryData(validServices[0].getSecondaryInputs()[i].getDataType()),
validServices[0].getSecondaryInputs()[i].getDefaultValue());		}
		
		mr.setService(validServices[0]);
		mr.setInput(comp);
		mr.setSecondaryInput(secParams);
		System.out.println(mr.invokeService().toString());



The setSecondaryInput() function takes an array that consists of all
parameters and applies them to all inputs. Now there are 2 parameters and an
array of length 2 - with the default values for both parameters (I defined
default values for both parameters).

Some hints what I'm doing wrong?


Another question - my input is of type MSPeakRel and is defined as
collection. How do I manage to add multiple inputs - in this case, they
would represent a complete peaklist of (m/z value, relative intensity) for
querying a database?



Best wishes,

Michael




More information about the MOBY-dev mailing list