Answered by:
WCF proxy generation using SVCUTIL

Question
-
Hi
I was trying to generate WCF service proxy using SVCUTIL. This was working perfect till recently. However, not sure if after upgrading to 4.5 framework when I try to generate proxy, I get the below errors. Service proxy generation works great with Visual studio.
Error: There was a validation error on a schema generated during export: Source: Line: 1 Column: 55734 Validation Error: The global element 'http://schemas.microsoft.com/2003/10/Se rialization/:unsignedLong' has already been declared. Error: There was a validation error on a schema generated during export: Source: Line: 1 Column: 55808 Validation Error: The global element 'http://schemas.microsoft.com/2003/10/Se rialization/:unsignedShort' has already been declared. Error: There was a validation error on a schema generated during export: Source: Line: 1 Column: 55865 Validation Error: The global element 'http://schemas.microsoft.com/2003/10/Se rialization/:char' has already been declared. Error: There was a validation error on a schema generated during export: Source: Line: 1 Column: 56004 Validation Error: The global element 'http://schemas.microsoft.com/2003/10/Se rialization/:duration' has already been declared. Error: There was a validation error on a schema generated during export: Source: Line: 1 Column: 56333 Validation Error: The global element 'http://schemas.microsoft.com/2003/10/Se rialization/:guid' has already been declared. Error: There was a validation error on a schema generated during export: Source: Line: 1 Column: 56568 Validation Error: The global attribute 'http://schemas.microsoft.com/2003/10/ Serialization/:FactoryType' has already been declared. Error: There was a validation error on a schema generated during export: Source: Line: 1 Column: 56606 Validation Error: The global attribute 'http://schemas.microsoft.com/2003/10/ Serialization/:Id' has already been declared. Error: There was a validation error on a schema generated during export: Source: Line: 1 Column: 56648 Validation Error: The global attribute 'http://schemas.microsoft.com/2003/10/ Serialization/:Ref' has already been declared. Error: There was a validation error on a schema generated during export: Source: Line: 1 Column: 55892 Validation Error: The simpleType 'http://schemas.microsoft.com/2003/10/Serial ization/:char' has already been declared. Error: There was a validation error on a schema generated during export: Source: Line: 1 Column: 56035 Validation Error: The simpleType 'http://schemas.microsoft.com/2003/10/Serial ization/:duration' has already been declared. Error: There was a validation error on a schema generated during export: Source: Line: 1 Column: 56360 Validation Error: The simpleType 'http://schemas.microsoft.com/2003/10/Serial ization/:guid' has already been declared. Error: There was a validation error on a schema generated during export: Source: Line: 1 Column: 57310 Validation Error: The global element 'http://schemas.microsoft.com/2003/10/Se rialization/Arrays:ArrayOfstring' has already been declared. Error: There was a validation error on a schema generated during export: Source: Line: 1 Column: 57531 Validation Error: The global element 'http://schemas.microsoft.com/2003/10/Se rialization/Arrays:ArrayOfint' has already been declared. Error: There was a validation error on a schema generated during export: Source: Line: 1 Column: 57095 Validation Error: The complexType 'http://schemas.microsoft.com/2003/10/Seria lization/Arrays:ArrayOfstring' has already been declared. Error: There was a validation error on a schema generated during export: Source: Line: 1 Column: 57344 Validation Error: The complexType 'http://schemas.microsoft.com/2003/10/Seria lization/Arrays:ArrayOfint' has already been declared.
I run SvcUtil from visual studio 2012 command prompt. Any ideas please.
Thanks,
Mallikarjun
Thanks, Mallikarjun
Saturday, March 23, 2013 11:45 AM
Answers
-
Hi Mallkarjun
Yes you can. You do this with the /namespace or /n option. This could also have been set in your "Add service reference" under "Advanced...". This might explain the difference in behavior.
ServiceModel Metadata Utility Tool (Svcutil.exe)
http://msdn.microsoft.com/en-us/library/aa347733.aspxYou can also try to exclute types.
/excludeType:<type>
Hope this helps.
Br,
JAXN
Please mark posts as answers/helpful if it answers your question/or helped you solve your problem.
MCTS: .NET Framework 4, Service Communication Applications- Marked as answer by Haixia_Xie Monday, April 1, 2013 6:14 AM
Monday, March 25, 2013 6:06 AM
All replies
-
I have encountered the errors above when trying to combine to svc endpoints into a single proxy. Is this the case? If so, you might find that the generated proxy is usable.
The error indicates that the types have already been declared (notice they are base types from the framework and not types defined in your service).
Jeff
Sunday, March 24, 2013 8:50 PM -
Hi,
There is a single service for which I am trying to generate proxy. Based on the errors I can notice that the types were already defined. Not sure what can be the issue.
Is there any way that I can provide a fixed namespace for the generated proxy? Like all the types inside the proxy should be under XXX.YYY
Thanks
Thanks, Mallikarjun
Monday, March 25, 2013 5:10 AM -
Hi Mallkarjun
Yes you can. You do this with the /namespace or /n option. This could also have been set in your "Add service reference" under "Advanced...". This might explain the difference in behavior.
ServiceModel Metadata Utility Tool (Svcutil.exe)
http://msdn.microsoft.com/en-us/library/aa347733.aspxYou can also try to exclute types.
/excludeType:<type>
Hope this helps.
Br,
JAXN
Please mark posts as answers/helpful if it answers your question/or helped you solve your problem.
MCTS: .NET Framework 4, Service Communication Applications- Marked as answer by Haixia_Xie Monday, April 1, 2013 6:14 AM
Monday, March 25, 2013 6:06 AM