码迷,mamicode.com
首页 > Web开发 > 详细

XFile客户端调用JDK1.6+的webserivce时参数为null

时间:2015-04-17 20:32:41      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:

     Webservice的服务端用JDK1.6+自带的Webservice做的,客户端用的是XFile的webservice调用的,但是传过来的参数为NULL.

     XFile的调用方式是:

     String wsdl = "http://192.168.1.112:8088/testService?wsdl";

      try {

          Client client = new Client(new URL(wsdl));

          String result = client.invoke("test", new Object[]{"hello"});

      } catch (MainformedURLException e) {

           e.printStackTrace();

      } catch (Exception e) {

           e.printStackTrace();

      }

     服务端的代码如:

     接口:

     public interface ITest  {

           public String test(String str);

     }

     实现类:

     @WebService(name="test",  serviceName = "test") 

     @SOAPBinding(stype = SOAPBinding.Style.RPC)  

      public class TestImpl implements ITest {

          @Override

          public String test(String str) {

              System.out.println(str);

          }

      }

      

      解决办法:

      在服务端的实现类上加上:@SOAPBinding(stype = SOAPBinding.Style.RPC)  

      代码变成:

      

     @WebService(name="test",  serviceName = "test") 

     @SOAPBinding(stype = SOAPBinding.Style.RPC)  

      public class TestImpl implements ITest {

          @Override

          public String test(String str) {

              System.out.println(str);

          }

      }

    JDK1.6+自带的Webservice非常强大,而且不用我们额外引入jar包,而且应该将来会越来越强大,所以推荐大家使用。

XFile客户端调用JDK1.6+的webserivce时参数为null

标签:

原文地址:http://blog.csdn.net/achilles12345/article/details/45101037

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!