Adding a WSDL file to a ASP.NET MVC Web App

Discussion in 'ASP.NET WebServices' started by malikmm, Oct 7, 2011.

  1. Hi,

    Firstly, I must apologise as I am a novice and my approach may be flawed.

    I am using MS Visual Web Developer 2010 Express on a Windows 7 Enterprise platform.

    What I want to do is add a provided 3rd party wsdl file to a C# ASP.NET MVC Web App and then consume each service. I have successfully done this in a Java environment.

    I am at the stage wher I am trying to add a Service Reference to the wsdl as follows:

    -> select Service Reference from the menu options
    -> select Advanced
    -> select Add Web Reference

    When I add the reference to my wsdl I get an access denied cannot copy message, as follows:

    There was an error downloading 'C:\temp\wsdl'.
    Access to the path 'C:\temp\wsdl' is denied.
    Access to the path 'C:\temp\wsdl' is denied.
    Access to the path 'C:\temp\wsdl' is denied.
    There was an error downloading 'C:\temp\wsdl'.
    Access to the path 'C:\temp\wsdl' is denied.
    Access to the path

    I would appreciate advice on my approach and why I am getting an access denied message. I have checked the property for the location I am going to and all seems to be fine.
     
  2. can you try to move the file 'wsdl' out from windows temp folder and try to open it again?

    make a folder in desktop or something and try to add from there see what happens
     
  3. Adding a WSDL file to a ASP.NET MVC

    Thanks for the idea:

    I have moved my files under the c drive and this is what I get:

    There was an error downloading 'C:\'.
    Access to the path 'C:\' is denied.
    Access to the path 'C:\' is denied.
    Access to the path 'C:\' is denied.
    There was an error downloading 'C:\'.
    Access to the path 'C:\' is denied.
    Access to the path 'C:\' is denied.
    Access to the path 'C:\' is denied.
     
  4. I should have added that this the same for the desktop folder:

    There was an error downloading 'D:\Users\malikmo\Desktop\test'.
    Access to the path 'D:\Users\malikmo\Desktop\test' is denied.
    Access to the path 'D:\Users\malikmo\Desktop\test' is denied.
    Access to the path 'D:\Users\malikmo\Desktop\test' is denied.
    There was an error downloading 'D:\Users\malik
     
  5. okay, just a thought; I assume you already have web reference to the project right? It should allow the wsdl to consume the service automatically so you don't need to add the service reference again
     
  6. I do not currently have a web reference at the moment. I was trying to add web reference by adding service reference, which failed.
     
  7. Ok leaving aside the reference issue, this where I have got to so far:

    After reseaching the web I found that I have to use svcutil.exe with the /mc switch to generate the WCF contracts. This will create a code file that I can add to my project. It will contain all interfaces and data types I need to create mu service. The default language is C# but you should be able to change this using /l:vb.

    svcutil /mc "WSDL file path"

    In my case, my WSDL has a supporting XSD file so I passed it in as arguments after the WSDL.

    svcutil /mc "WSDL file path" "XSD 1 file path" "XSD 2 file path" ... "XSD n file path"

    Now, I believe I need to create a class "MyService" which will implement the service interface (IServiceInterface) - or the several service interfaces - and this is my server instance.

    I have read that the class by itself doesn't really help yet - I will need to host the service somewhere. I need to either create my own ServiceHost instance which hosts the service, configure endpoints and so forth - or you can host your service inside IIS.

    Is this the correct way forward?
     

Share This Page