You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by takidean <ta...@hotmail.fr> on 2013/05/13 15:45:47 UTC

rest webservice can't read parameteres

Hi
i use to send many parameters in my url but i find that message body catch
only the first parameters

this is my code:

MessageResource

@GET
@Path("/id/{type}")
@Produces("text/xml")
public String getCustomer(@QueryParam("id") String n,@QueryParam("type")
String s) {
	
    return "ok";
}

/** route ***/
 <camelContext xmlns="http://camel.apache.org/schema/spring">
    <route>
        <from uri="cxfrs://bean://cc"/>
        <convertBodyTo type="java.lang.String"/>
        <process ref="abc"/>
    </route>
</camelContext>
/***Abc**/
public class Abc implements Processor{

	@Override
	public void process(Exchange exchange) throws Exception {
		// TODO Auto-generated method stub
		String m =(String) exchange.getIn().getBody();
		System.out.println("mssage ="+m);
	}

}
/*******test***/
when i send this url http://localhost:9090/cc/MessageResource/id?id=1&type=1
it only show me the id 1





--
View this message in context: http://camel.465427.n5.nabble.com/rest-webservice-can-t-read-parameteres-tp5732407.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: rest webservice can't read parameteres

Posted by takidean <ta...@hotmail.fr>.
thanks for the reply but i have to send many qyeryparams and i cant extract
them in the message body .i have to resolve  the problem from camel



--
View this message in context: http://camel.465427.n5.nabble.com/rest-webservice-can-t-read-parameteres-tp5732407p5732411.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: rest webservice can't read parameteres

Posted by Sergey Beryozkin <sb...@gmail.com>.
This is because you mistyped the type of the parameter, the 2nd 
parameter should be annotated with @PathParam instead

Sergey
On 13/05/13 14:45, takidean wrote:
> Hi
> i use to send many parameters in my url but i find that message body catch
> only the first parameters
>
> this is my code:
>
> MessageResource
>
> @GET
> @Path("/id/{type}")
> @Produces("text/xml")
> public String getCustomer(@QueryParam("id") String n,@QueryParam("type")
> String s) {
> 	
>      return "ok";
> }
>
> /** route ***/
>   <camelContext xmlns="http://camel.apache.org/schema/spring">
>      <route>
>          <from uri="cxfrs://bean://cc"/>
>          <convertBodyTo type="java.lang.String"/>
>          <process ref="abc"/>
>      </route>
> </camelContext>
> /***Abc**/
> public class Abc implements Processor{
>
> 	@Override
> 	public void process(Exchange exchange) throws Exception {
> 		// TODO Auto-generated method stub
> 		String m =(String) exchange.getIn().getBody();
> 		System.out.println("mssage ="+m);
> 	}
>
> }
> /*******test***/
> when i send this url http://localhost:9090/cc/MessageResource/id?id=1&type=1
> it only show me the id 1
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/rest-webservice-can-t-read-parameteres-tp5732407.html
> Sent from the Camel - Users mailing list archive at Nabble.com.