Exception when using proxy generated with the WCF Web Service Reference tool: There was an error reflecting 'data'
- Dominant language
- C#
- Stars
- 1.8k
- Forks
- 576
- Avg merge
- 6d 9h
- Merged PRs (30d)
- 2
Description
Hi,
When we try to use a specific connected service (soap) proxy class in a core 2.0 app,
we receive an exception on calling any method from the class.
(This service works fine in a .NET framework app)
It looks like the .net core class has been generated with several MessageBodyMemberAttribute that have a Namespace=""
which seem to be the cause of the error.
I have included the wsdl and a sample .net core project.
The question we have is whether the problem is with the wsdl or is it a bug in the core WCF connected service tool?
Thanks,
Exception:
System.InvalidOperationException
HResult=0x80131509
Message=There was an error reflecting 'data'.
Source=System.Private.Xml
StackTrace:
at System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(XmlReflectionMember[] xmlReflectionMembers, String ns, Boolean hasWrapperElement, Boolean rpc, Boolean openModel, RecursionLimiter limiter)
at System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(String elementName, String ns, XmlReflectionMember[] members, Boolean hasWrapperElement, Boolean rpc, Boolean openModel, XmlMappingAccess access)
at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.XmlSerializerImporter.ImportMembersMapping(XmlName elementName, String ns, XmlReflectionMember[] members, Boolean hasWrapperElement, Boolean rpc, Boolean isEncoded, String mappingKey)
at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.OperationReflector.ImportMembersMapping(String elementName, String ns, XmlReflectionMember[] members, Boolean hasWrapperElement, Boolean rpc, String mappingKey)
at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.OperationReflector.LoadBodyMapping(MessageDescription message, String mappingKey, MessagePartDescriptionCollection& rpcEncodedTypedMessageBodyParts)
at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.OperationReflector.CreateMessageInfo(MessageDescription message, String key)
at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.OperationReflector.EnsureMessageInfos()
at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.EnsureMessageInfos()
at System.ServiceModel.Description.XmlSerializerOperationBehavior.CreateFormatter()
at System.ServiceModel.Description.XmlSerializerOperationBehavior.System.ServiceModel.Description.IOperationBehavior.ApplyClientBehavior(OperationDescription description, ClientOperation proxy)
at System.ServiceModel.Description.DispatcherBuilder.BindOperations(ContractDescription contract, ClientRuntime proxy, DispatchRuntime dispatch)
at System.ServiceModel.Description.DispatcherBuilder.BuildProxyBehavior(ServiceEndpoint serviceEndpoint, BindingParameterCollection& parameters)
at System.ServiceModel.Channels.ServiceChannelFactory.BuildChannelFactory(ServiceEndpoint serviceEndpoint, Boolean useActiveAutoClose)
at System.ServiceModel.ChannelFactory.OnOpening()
at System.ServiceModel.Channels.CommunicationObject.d__79.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.ServiceModel.Channels.CommunicationObject.d__78.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.ServiceModel.ChannelFactory.EnsureOpened()
at System.ServiceModel.ChannelFactory`1.CreateChannel(EndpointAddress address, Uri via)
at System.ServiceModel.ClientBase`1.get_Channel()
at CardManagementWS.CardManagementEPClient.loginAsync(String user, String password) in c:\users\com381\source\repos\msTestCaseShellWs\msTestCaseShellWs\Connected Services\CardManagementWS\Reference.cs:line 17459
at msTestCaseShellWs.Program.Main(String[] args) in c:\users\com381\source\repos\msTestCaseShellWs\msTestCaseShellWs\Program.cs:line 16
Inner Exception 1:
InvalidOperationException: The top XML element 'data' from namespace '' references distinct types CardManagementWS.WSIssueNewPayrollCardData and CardManagementWS.WSIssueNewPersonalizedPayrollCardData. Use XML attributes to specify another XML name or namespace for the element or types.
[CardManagement.wsdl.txt](https://github.com/dotnet/wcf/files/1601201/CardManagement.wsdl.txt)
[Program.cs.txt](https://github.com/dotnet/wcf/files/1601202/Program.cs.txt)
Contributor guide
Assessment
This issue has not been assessed yet.