Xfire调用webservice出错

今天使用Xfire调用ws出现了报错。。
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

猜你喜欢

转载自lws0402.iteye.com/blog/1584408