Service Reference Error: Failed to generate code for the service reference

jheppinstall picture jheppinstall · Oct 20, 2010 · Viewed 119.3k times · Source

I have a Windows Service Solution and am trying to add a service reference to a Hermes(Opensource ebms message server) Web Service in VS2010.

I can find the Web Service using it's URL, but when I try and populate the Service reference I get the following errors in Visual Studio:

Error 8 Custom tool error: Failed to generate code for the service reference 'testService'.  Please check other error and warning messages for details. C:\Users\Admin\documents\visual studio 2010\Projects\MyProject\MyProject.MessageHandler\Service References\testService\Reference.svcmap 1 1 MyProject.MessageHandler


Warning 6 Custom tool warning: Cannot import wsdl:binding
Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.
XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='http://service.ebms.edi.cecid.hku.hk/']/wsdl:portType[@name='EbmsStatusQuery']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://service.ebms.edi.cecid.hku.hk/']/wsdl:binding[@name='EbmsSoapHttpStatusQuery'] C:\Users\Admin\documents\visual studio 2010\Projects\MyProject\MyProject.MessageHandler\Service References\testService\Reference.svcmap 1 1 MyProject.MessageHandler

Warning 7 Custom tool warning: Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on.
XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='http://service.ebms.edi.cecid.hku.hk/']/wsdl:binding[@name='EbmsSoapHttpStatusQuery']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://service.ebms.edi.cecid.hku.hk/']/wsdl:service[@name='EbmsMessageStatusQuery']/wsdl:port[@name='EbmsStatusQuery'] C:\Users\Admin\documents\visual studio 2010\Projects\MyProject\MyProject.MessageHandler\Service References\testService\Reference.svcmap 1 1 MyProject.MessageHandler

Warning 5 Custom tool warning: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter
Error: Schema with target namespace 'http://service.ebms.edi.cecid.hku.hk/' could not be found.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://service.ebms.edi.cecid.hku.hk/']/wsdl:portType[@name='EbmsStatusQuery'] C:\Users\Admin\documents\visual studio 2010\Projects\MyProject\MyProject.MessageHandler\Service References\testService\Reference.svcmap 1 1 MyProject.MessageHandler

Some investigation seemed to suggest it is due to svcutil.exe not been able to build the proxys due to not having permissions to a directory (possibly c:\windows\temp). I have tried assigning various access permissions, but I am not really sure which user needs the permission, or if it is just a red herring.

Any ideas would be greatly appreciated.

Thanks

Answer

Mohan picture Mohan · Aug 22, 2011

Have to uncheck the Reuse types in all referenced assemblies from Configure service reference option

Check this for details