org.codehaus.xfire.fault.XFireFault: There must be a method name element.
调用代码如下:
Service service = new ObjectServiceFactory().create(MyTest.class); XFireProxyFactory factory = new XFireProxyFactory(XFireFactory.newInstance().getXFire()); String helloURL = "http://220.249.111.121//services/AAS"; String cmd = ""; try { MyTest my = (MyTest)factory.create(service, helloURL); System.out.println(my.doDelete(cmd)); } catch (MalformedURLException e) { e.printStackTrace(); }
根据wsdl创建的相应接口如下:
interface MyTest { String doDelete(String param); String doDTest(String param); String doConfig(String param); String doCheck(String param); }
最后发现是url的问题,如果是通过 ObjectServiceFactory、XFireProxyFactory方式来动态生成的,需要把访问路径的WSDL去掉,类似于
http://www.12580sky.com/xfire/demoCommonService?WSDL
改成
http://www.12580sky.com/xfire/demoCommonService