0

SOAPでは、次のコードを使用して引数をwebmethod関数に渡します

@WebMethod(operationName = "replacinginstrumentname")
    public String replacinginstrumentname(@WebParam(name = "interface1_name") String interface1_name)

ここで、interface1_nameは私が渡す引数です。このため、SOAPには@webparamがあります。

しかし、RestfulGETメソッドで同じことを行うにはどうすればよいですか。どんな助けでも大歓迎です。

4

1 に答える 1

0

行く方法があります:

(1) http://your.service.com/service/interface?interface1_name=YOUR_VALUE

また

(2) http://your.service.com/service/interface/YOUR_VALUE

次に、リソースメソッドは次のようになります

ケース用 (1)

@Path("/service")
public class YourResource{

    @GET("/interface")
    public Response method(@QueryParam(name="interface1_name") String param){
        //do the job
    }
}

ケース用 (2)

@Path("/service")
public class YourResource{
    @GET("/interface/{iname}")
    public Response method(@PathParam(name="iname") String param){
        //do the job
    }
}
于 2012-04-26T14:04:44.390 に答える