开发者

php java web service

开发者 https://www.devze.com 2023-04-11 16:10 出处:网络
The web service is developed using java (apache axis), this web service has overloaded method. public String displayName(int studentid)

The web service is developed using java (apache axis), this web service has overloaded method.

public String displayName(int studentid)
public String displayName(string name,int grade)

as example

t开发者_开发百科hese methods exposed and can be viewed by wsdl.if php client want to access this web service methods is php capable enought to distinguish this two methds? will there be any problem in this in long run only because of method overloading?

Thanks,


Generally overloading of operation should be avoided for web services as it complicates the matter (WSDL 2.0 does not allow overloaded operations). Also having unique operation names ensures maximum interoperability with different client tools

One way

  • Use Document/Literal non wrapped style WSDL (WSDL1.1 version). This facilitates overloaded operations.
  • Make sure your WSDL accessible to the clients is of this style.

Another way but slightly complicated.

  • By default Axis does not support overaloaded operation. If you have generated WSDL for a class having overloaded operation, it will just show one opeation.
  • But there is a way out. I am not sure which axis version you are using, but you can use Custome Message Receiver. Checkout this link.
  • Here a class needs to be configured to receive the message before it reaches the actual web service method.

I understand that you are using axis, but I would suggest you to look at how elegantly this is handled in JAX-WS .

0

精彩评论

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

关注公众号