exception:operation XX of contract XX specifies multiple request body parameters to being serialized without any wrapper ele ments.

Source: Internet
Author: User

Operation ' Createproductcodestock ' of contract ' Ichileservice ' specifies multiple request body parameters to be serialized Without any wrapper elements.

At the 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 had created Proxy code using ADD Service Reference dialog in VS, Since WCF REST Service was 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 the this similar post.

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

It seems created Proxy code using ADD Service Reference dialog in VS.

VS ASR Dialog doesn ' t support for 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?

Because of the lack of attribute caused.

Workaround, do not use Add ServiceReference method to get. Call the service's library directly

exception:operation XX of contract XX specifies multiple request body parameters to being serialized without any wrapper ele ments.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.