none
Create Service Reference Error - "not recognized as a known document type"

    Question

  • Hi

    I'm trying to create a service reference in Visual Studio 2010 but am getting the below error. Does any one have any suggestions as to how to solve it?

    The URL is https://api.datamarket.azure.com/Data.ashx/Uk.Gov/TravelAdvisoryService/LatestTravelNewsFromFco

    VS asks for username and password both of which I provide, these are correct because when used in a browser I get authenticated and can see the feed data.

    Thank you

     

    The document at the url https://api.datamarket.azure.com/Data.ashx/Uk.Gov/TravelAdvisoryService/LatestTravelNewsFromFco was not recognized as a known document type.
    The error message from each known type may help you fix the problem:
    - Report from 'XML Schema' is 'The root element of a W3C XML Schema should be <schema> and its namespace should be 'http://www.w3.org/2001/XMLSchema'.'.
    - Report from 'DISCO Document' is 'Discovery document at the URL https://api.datamarket.azure.com/Data.ashx/Uk.Gov/TravelAdvisoryService/LatestTravelNewsFromFco could not be found.'.
      - The document format is not recognized (the content type is 'application/atom+xml').
    - Report from 'WSDL Document' is 'There is an error in XML document (2, 2).'.
      - <feed xmlns='http://www.w3.org/2005/Atom'> was not expected.
    Metadata contains a reference that cannot be resolved: 'https://api.datamarket.azure.com/Data.ashx/Uk.Gov/TravelAdvisoryService/LatestTravelNewsFromFco'.
    The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Basic Realm=""'.
    The remote server returned an error: (401) Unauthorized.
    If the service is defined in the current solution, try building the solution and adding the service reference again.

    Saturday, May 07, 2011 11:44 AM

Answers

All replies

  • try to use the command line:

    svcutil.exe "http://address here..."

    do this from the VS command line.


    http://webservices20.blogspot.com/
    WCF Security, Interoperability And Performance Blog
    Saturday, May 07, 2011 4:06 PM
  • Hi

    Thanks for the reply. I have tried that but cannot work out how to pass a username and password to svcutil. Is there an option for that?

    Saturday, May 07, 2011 4:30 PM
  • in this case open the wsdl in IE and save it to the local disk. then svcutil from there.
    http://webservices20.blogspot.com/
    WCF Security, Interoperability And Performance Blog
    Saturday, May 07, 2011 6:58 PM
  • Ok, I've downloaded the wsdl...

    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <service xml:base="https://api.datamarket.azure.com/Data.ashx/Uk.Gov/TravelAdvisoryService/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns="http://www.w3.org/2007/app">
      <workspace>
        <atom:title>Default</atom:title>
        <collection href="BritishEmbassiesAndHighCommissions">
          <atom:title>BritishEmbassiesAndHighCommissions</atom:title>
        </collection>
        <collection href="DetailedFcoTravelAdvice">
          <atom:title>DetailedFcoTravelAdvice</atom:title>
        </collection>
        <collection href="LatestTravelNewsFromFco">
          <atom:title>LatestTravelNewsFromFco</atom:title>
        </collection>
      </workspace>
    </service>

     

    And then run...

     

    "%windir%\Microsoft.NET\Framework\v3.5\DataSvcUtil.exe" /dataservicecollection /version:2.0 /language:CSharp /out:TravelAdvisorService.cs /uri:c:/TravelAdvisoryService-

    but am getting...


    error 7001: Expected an absolute, well formed http URL without a query or fragme
    nt.
    Parameter name: serviceRoot

    Generation Complete -- 1 errors, 0 warnings

     

    Whats wrong?

     

    Sunday, May 08, 2011 12:41 PM
  • you are not using a wsdl / wcf. you are using odata / wcf data services.

    ask in the odata forum:

    http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataservices/threads/


    http://webservices20.blogspot.com/
    WCF Security, Interoperability And Performance Blog
    • Marked as answer by Yi-Lun Luo Friday, May 13, 2011 9:15 AM
    Sunday, May 08, 2011 6:37 PM
  • Gee thanks.  So this is a dead end for those of us who come here later asking the same question.  

     

    I'm trying to figure out how to use RIA Services through WCF so that I can have a WPF application use the same service as a Silverlight application.  I'm really frustrated--


    Nah, forget it.  You philistines are just going to make me start a new thread.  So that's what I'm going to do.   And I'm not going to give this thread the link to that thread's answer, because you guys suck!

    Mostly kidding. :p

    Tuesday, July 12, 2011 3:21 PM