System.InvalidOperationException: The XML element * from namespace * references a references a method and a type - by Ngu Soon Hui

Status : 

  By Design<br /><br />
		The product team believes this item works according to its intended design.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 470482 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 6/25/2009 7:19:09 PM
Access Restriction Public


The proxy class generated by wsdl.exe will throw exception in constructor if there are two methods with the same complex time.

This issue has been raised here:
Sign in to post a comment.
Posted by Microsoft on 6/29/2009 at 7:09 PM
We're no longer making enhancements to ASMX; we continue to support its existing functionality, but where possible, we recommend using WCF instead.

I tried importing this wsdl using WCF (svcutil.exe), and it found a different problem: both operations have the exact same action. Indeeed, looking further, it appears that both operations (processList and policyModel) also have the exact same message types.

This means that there is no way to distinguish, when a message is received, which operation it corresponds to. If you received this WSDL from a third party, then they have a bug in their WSDL, and you may want to notify them so they can fix it.
Posted by Ngu Soon Hui on 6/29/2009 at 6:03 PM
Also, renaming ( or in anyway modifying) WSDL may not be a good idea because it's originated from third party..
Posted by Ngu Soon Hui on 6/29/2009 at 5:58 PM
Thanks. But this WSDL is a valid WSDL in the sense that it can run for PHP web client.

Don;t you think that the WSDL should be enhanced in this regard?
Posted by Microsoft on 6/29/2009 at 4:01 PM
The provided WSDL is attempting to use the same element for two different purposes: as the name of a data element (xs:element) and the name of an operation (wsdl:operation).

You can apply the workaround indicated in the exception message: "Change the method's message name using WebMethodAttribute or change the type's root element using the XmlRootAttribute."

Or, you can change your XSD and WSDL to avoid this problem:
1. Rename the element
2. Rename the operation
3. Move the WSDL into a different targetNamespace from the XSD

For more help on creating XSD and WSDL, you may want to ask on the MSDN forums at

Dan Glick
Software Development Engineer, Connected Framework
Posted by Microsoft on 6/29/2009 at 2:14 AM
Thanks for your feedback. We are routing this bug to the product unit who works on that specific feature area. The team will review this issue and make a decision on whether they will fix it or not for the next release.

Thank you,
Visual Studio Product Team