.net web service: Can't add service reference, only web reference

后端 未结 5 1213
无人及你
无人及你 2020-12-30 06:26

I have an existing project that consumes web services. One was added as a service reference, and the other as a web reference. I don\'t recall why one was added as a web ref

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-30 06:44

    Although an old post, but just want to share my experience so that it might help some one today.

    When communicating with Web services developed on platform such as Java, Phython or Ruby probably the cause of Stub/Proxy classes not being generated due to compliance issues (WS-I interoperability standard). You might encounter errors such as:

    Failed to generate code for the service reference ServiceReferenceName. Please check other error and warning messages for details...

    The actual error details you can get by using svcutil.exe of course in which case the error might look something like:

    Error: Cannot import wsdl:portType

    Its better to go with Web Service Reference for such services rather than Service Reference. (Add Service Reference -> Advanced -> Add Web Reference...)

    In case you are enthusiast about playing with XML & WSDL you might go ahead and fix the issue with binding & portType. Probably the imports & include need to be corrected if i remember correctly from last time i wasted time fixing it to make it work with Service Reference Option.

提交回复
热议问题