开发者

Glassfish - Deploying a WSDL with 2 functions of the same name

i am using Netbeans to create a Web Service and the code is written in java. My problems arises from creating 2 functions that will be accessible by a client. The functions look alike by name but their parameters are different.

When building the web service(int a war file) i get no complaints. However when deploying the war file onto a glassfish server renders errors that would make me conclude that glassfish somehow is getting confused about 2 functions of the same name without looking into the parameter list. Is this a common occurrence and is there a workaround?

For example:

@WebMethod() public Long startMission(@WebParam(name="session") Session session, String name{ ..... }

@WebMethod() public Long startMission(@WebParam(name="session") Session session, Long num{ ..... }

The error on the glassfish server comes back to me and tells me that the 2nd StartMission function does not contain an entry point for parameter @Long num - which tells me that it does not recognize 2 functions of the same name. Perhaps i am thinking about this开发者_如何学C the wrong way. Any help, options, suggestions would be appreciated. thanks!


You can distinguish between the two methods by specifying the operation that they correspond to. This is done by specifying the operationName member value for the WebMethod annotation.

For example,

@WebMethod(operationName='startMissionWithName') public Long startMission(@WebParam(name="session") Session session, String name{ ..... }

@WebMethod(operationName='startMissionWithId') public Long startMission(@WebParam(name="session") Session session, Long num{ ..... }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜