There are three typical options available to you.
Pass object variables into request
This is useful if you do not have a large number of variables, or need the ability to populate only a subset of the fields in Registration_BE.
If you want to pass the variables into the request as a typical POST, you will need to do some processing to construct the complex Registration_BE
object in the first place:
public String getText(@RequestParam("reg_be.myvariable") String myvariable) {
Registration_BE reg_be = new Registration_BE(myvariable);
System.out.println("websevice:" +reg_be.myvariable);
return reg_be.myvariable;
}
And you can call it with:
http://192.168.1.1:8084/UnionClubWS/webresources/customerregistration/?reg_be.myvariable=myvalue
Or alternatively by passing in an array of variables:
public String getText(@RequestParam("reg_be.myvariable") String[] myvariables) {
Registration_BE reg_be = new Registration_BE(myvariables);
System.out.println("websevice:" +reg_be.myvariable);
return reg_be.myvariable;
}
And you can call it with:
http://192.168.1.1:8084/UnionClubWS/webresources/customerregistration/?reg_be.myvariable=myvalue1®_be.myvariable=myvalue2
Using a common data interchange format
The second option would be to pass your registration object as JSON (or XML). for this, you will need to enable the Jackson message convertor and make sure the Jackson library is in your classpath:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<mvc:annotation-driven />
</beans>
Your method would not change:
public String getText(@RequestParam("reg_be") Registration_BE reg_be ) {
System.out.println("websevice:" +reg_be.myvariable);
return reg_be.myvariable;
}
And you can now call it with:
http://192.168.1.1:8084/UnionClubWS/webresources/customerregistration/?reg_be={"myvariable":"myvalue"}
Custom message convertor
Your third, and most complex, option would be to create your own message convertor. This would give you the most flexibility (your request could take any form you like), but would involve a lot more boilerplate overhead to make it work.
Unless you have a very specific requirement on how the request packet should be constructed, I recommend you opt for one of the above options.