cxf客户端调用.net webservice,报错:“无法识别请求元素”
我客户端和服务器端分别写在两台机子上。.net为服务器端 ip192.168.0.105
cxf为客户端
.net代码为:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
namespace App3
{
/// <summary>
/// WebService1 的摘要说明
/// </summary>
[WebService(Namespace = " http://192.168.0.105/app1/WebService1.asmx")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]
[ToolboxItem(false)]
public class WebService1 : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld(String str)
{
return "Hello," + str;
}
}
}
java中是使用cxf+spring+struts2
接口代码:
package com.ruiri.common;
import javax.jws.WebService;
@WebService
public inte易做图ce Hello {
public String HelloWorld(String str);
}
接口实现:
package com.ruiri.common;
import javax.jws.WebService;
@WebService(endpointInte易做图ce = "com.ruiri.common.Hello")
public class HelloImpl implements com.ruiri.common.Hello {
public String HelloWorld(String str) {
return str;
}
}
bean.xml文件
<bean id="client" class="com.ruiri.common.Hello" factory-bean="clientFactory" factory-method="create"/>
<bean id="clientFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
<property name="serviceClass" value="com.ruiri.common.Hello"/>
<property name="address" value="http://192.168.0.105/app1/WebService1.asmx"/>
</bean>
客户端主程序
@Controller
public class TestAction extends BaseAction {
private String str;
@Override
public String execute() throws Exception {
WebApplicationContext ac = WebApplicationContextUtils
.getRequiredWebApplicationContext(Constant.Global_SC); //可以不用理解
Hello hello = (Hello) ac.getBean("client"); //得到实例
str = hello.HelloWorld("cheng");
return SUCCESS;
}
public String getStr() {
return str;
}
public void setStr(String str) {
this.str = str;
}
}
报这样的错:
org.apache.cxf.binding.soap.SoapFault: 无法识别请求元素 <HelloWorld xmlns='http://common.ruiri.com/'>
是不是哪里没有配置好,或者说配置好了,但是客户端主程序没写好,请指教一下!
谢谢
--------------------编程问答-------------------- --------------------编程问答-------------------- 我也碰到一样的问题,唉
补充:Java , Java EE