Exception: Operation xx of contract xx specifies multiple request body parameters to be serialized without any wrapper elements.

Operation ‘CreateProductCodeStock‘ of contract ‘IChileService‘ specifies multiple request body parameters to be serialized without any wrapper elements.

At most one body parameter can be serialized without wrapper elements.

Either remove the extra body parameters or set the BodyStyle property on the WebGetAttribute/WebInvokeAttribute to Wrapped.

StackTrace:

at System.ServiceModel.Description.WebHttpBehavior.TryGetNonMessageParameterType(MessageDescription message, OperationDescription declaringOperation, Boolean isRequest, Type& type)
at System.ServiceModel.Description.WebHttpBehavior.ValidateBodyStyle(OperationDescription operation, Boolean request)
at System.ServiceModel.Description.WebHttpBehavior.<>c__DisplayClass70_1.<GetRequestClientFormatter>b__1()
at System.ServiceModel.Description.WebHttpBehavior.<>c__DisplayClass70_0.<GetRequestClientFormatter>b__0()
at System.ServiceModel.Description.WebHttpBehavior.HideReplyMessage(OperationDescription operationDescription, Effect effect)
at System.ServiceModel.Description.WebHttpBehavior.GetRequestClientFormatter(OperationDescription operationDescription, ServiceEndpoint endpoint)
at System.ServiceModel.Description.WebHttpBehavior.ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
at System.ServiceModel.Description.DispatcherBuilder.ApplyClientBehavior(ServiceEndpoint serviceEndpoint, ClientRuntime clientRuntime)
at System.ServiceModel.Description.DispatcherBuilder.BuildProxyBehavior(ServiceEndpoint serviceEndpoint, BindingParameterCollection& parameters)
at System.ServiceModel.Channels.ServiceChannelFactory.BuildChannelFactory(ServiceEndpoint serviceEndpoint, Boolean useActiveAutoClose)
at System.ServiceModel.ChannelFactory.CreateFactory()
at System.ServiceModel.ChannelFactory.OnOpening()
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.ChannelFactory.EnsureOpened()
at System.ServiceModel.ChannelFactory`1.CreateChannel(EndpointAddress address, Uri via)
at System.ServiceModel.ChannelFactory`1.CreateChannel()
at WcfTest.Program.Main(String[] args) in D:\ChuckLu\Git\Edenred\WcfTest\WcfTest\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

Source:

System.ServiceModel.Web

https://forums.asp.net/t/1749250.aspx?Exception+Operation+xx+of+contract+xx+specifies+multiple+request+body+parameters+to+be+serialized+without+any+wrapper+elements+

It seems that you have created Proxy code using Add Service Reference dialog in VS, Since WCF REST Service is not based on SOAP message, so Add Service Reference doesn‘t support WCF REST Service fully, and the proxy code is missing [WebInvoke] attribute. Try creating proxy code using Add Web Reference in VS. Please check this similar post.

stackoverflow.com/questions/4346554/wcf-service-proxy-throws-exception-when-more-than-one-parameter-is-used-in-oper

It seems you have created Proxy code using Add Service Reference dialog in VS.

VS ASR dialog doesn‘t support WCF REST fully, so, the proxy code is missing [WebInvoke] attribute.

Can you try adding [WebInvoke(BodyStyle = WebMessageBodyStyle.Wrapped)] attribute on operations in client proxy?

是因为缺少了attribute导致的。

解决方法,不使用添加ServiceReference的方式获取。直接调用Service的library

时间: 2024-12-29 09:44:41

Exception: Operation xx of contract xx specifies multiple request body parameters to be serialized without any wrapper elements.的相关文章

rpm卸载包遭遇 specifies multiple packages 错误

使用 rpm删除软件时报错如下: [[email protected]]# rpm -qa |grep -i mysqlmysql-devel-5.0.95-5.el5_9mysql-devel-5.0.95-5.el5_9MySQL-shared-5.5.34-1.rhel5mysql-5.0.95-5.el5_9mysql-server-5.0.95-5.el5_9MySQL-shared-compat-5.5.34-1.rhel5perl-DBD-MySQL-3.0007-2.el5mys

eclipse不能自动编译XX.java为XX.classs

问题描述:eclipse不能自动编译XX.java为XX.classs 原因:今天下午写代码,因为需要引入jstl包,引入后发现原来项目中已经引入了,然后我又把包删除了,忘记删除java build path 中的jar包.但是一直不报错.我觉得郁闷惨了. 解决办法:将java build path 中的有错的jar包 remove掉就可以了. 总结:经验不足,慢慢积累吧.

无法定位序数XX于动态链接库XX.dll的解决办法

问题阐述: 开发环境:VS2008 使用RELEASE生成了可执行文件,发现在某些电脑上可以正常运行,但在部分电脑中运行失败提示:无法定位序数8523于动态链接库mfc90.dll 在网上查找了一些资料解决办法例如:下载MFC90.dll放入执行的文件中或者放在C:system/system32下,经过尝试无法达到目的 问题解决: 出现这个问题主要是开发机与测试机的动态链接库版本不一致引起的,解决办法:在开发机中查找动态库MFC90.DLL的位置,将其复制到测试机的相同路径的文件夹下就OK了!!

解决java.lang.RuntimeException: mapped-name is required for xxx.xxx.xxx/xx of deployment xx.war

从tomcat 7部署成功的过程部署到JBoss 5.1.0 出现了 java.lang.RuntimeException: mapped-name is required for xxx.xxx.xxx/xx of deployment  xx.war错误,将java文件中所有的@Resource注解改为@Qualifier成功解决,具体原因不是很清楚?

error: &quot;mysql&quot; specifies multiple packages

今天卸载mysql时,出现了这个问题 # rpm -e mysql error: "mysql" specifies multiple packages # rpm -q mysql mysql-5.0.95-5.el5_9 mysql-5.0.95-5.el5_9 卸载方法 方法一 # yum remove -y mysql 卸载时发现这两个mysql一个是32位的,一个是64位的 方法二 # rpm -e --allmatches --nodeps mysql 来自为知笔记(Wiz

卸载RPM包时报错specifies multiple packages

1.在卸载rpm包时报错如下 [[email protected] ~]# rpm -e cyrus-sasl-lib-2.1.22-4 error: "cyrus-sasl-lib-2.1.22-4" specifies multiple packages 2.查找结果如下: [[email protected] ~]# rpm -qa |grep cyrus-sasl-lib cyrus-sasl-lib-2.1.22-4 cyrus-sasl-lib-2.1.22-4 [[ema

卸载rpm包遭遇error: xxx specifies multiple packages

一.环境 # lsb_release -aLSB Version:    :core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarchDistributor ID: CentOSDescription:    CentOS release 5

jvm参数设置 -vmargs -Xms128M -Xmx512M -XX:PermSize=64M -XX:MaxPermSize=128M

-vmargs -Xms128M -Xmx512M -XX:PermSize=64M -XX:MaxPermSize=128M 这里有几个问题: 1. 各个参数的含义什么? 2. 为什么有的机器我将-Xmx和-XX:MaxPermSize都设置为512M之后Eclipse可以启动,而有些机器无法启动? 3. 为何将上面的参数写入到eclipse.ini文件Eclipse没有执行对应的设置? 下面我们一一进行回答 1. 各个参数的含义什么? 参数中-vmargs的意思是设置JVM参数,所以后面的其

VS Code报错Module &#39;xx&#39; has no &#39;xx&#39; member pylint(no-member)解决办法

pylint是vscode的python语法检查器,pylint是静态检查,在用第三方库的时候有些成员只有在运行代码的时候才会被建立,它就找不到成员,在设置(settings.json)里添加 "python.linting.pylintArgs": ["--generate-members"]来避免报错 VS Code报错Module 'xx' has no 'xx' member pylint(no-member)解决办法 原文地址:https://www.cn