Results 1 to 7 of 7

Thread: Problem in add web reference

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2000
    Location
    Hong Kong
    Posts
    38

    Problem in add web reference

    I am using the official release of Visual Studio on W2K. When I was exploring with the web service, I failed to add web reference to a web form. What I have done are:
    (1) Create a very simple web service and build it. I was able to use it via http://localhost/WebService1/Service1.asmx
    (2) Close this solution.
    (3) Open a new project for a new web form
    (4) add web reference by selecting this option on the project tool submenu.
    (5) On the "add web reference" window, I could only see the two UDDI items but I could not find the "web reference on local web server"
    (6) I explicitely typed in http://localhost/webservice1/Service1.asmx on the address box and were able to get to the HTML view of this web service interface. Then I pressed the add web reference button to add it and the solution explorer showed a web reference folder added.
    (7) But when I add code to reference to the service in the web form, the Intellisense could not find the web service.

    Could anyone tell me what I have done wrongly ?

  2. #2
    Frenzied Member Shawn N's Avatar
    Join Date
    Dec 2001
    Location
    Houston
    Posts
    1,631
    Have you tried writing coding against the web service? Just because VS doesn't pick it up doesn't mean it you can't.
    Please rate my post.

  3. #3
    Lively Member
    Join Date
    Feb 2001
    Location
    KL Malaysia
    Posts
    64
    Hmmm that is pretty fuzzy. I always though you can only add a web reference if everything is under the same solution. But from what I understand from your post, you have two solutions, one with the web form and the other with the web control?

  4. #4

    Thread Starter
    Member
    Join Date
    Oct 2000
    Location
    Hong Kong
    Posts
    38
    Thanks for your reply. I did try to write code to use the web service. What I wrote was :

    dim objService as new WebService1.Service1
    intX = objService.Add(intA, intB)

    where Add is the simple web service being tested.

    The function was not resolved and failed during execution.

    Yes, I did call the web service from web form of another solution. However, I tried to use it in the same solution as suggested but the result was the same.

    I think web services should be able to be used no matter in which solution it is, as long as the SOAP contract can be obtained.

    Now it seemed that the add web reference wizard in Visual Studio did not work.

  5. #5
    Member
    Join Date
    Mar 2002
    Posts
    40
    It should be localhost.Service1

    Please refer to the Solution Explorer. Expand the Web Reference node. You should see something like this (if you haven't rename anything yet)

    Code:
    + Web Reference
       + localhost (*)
          + Service1.wsdl
          + Reference.map
    Note:
    (*) You can rename "localhost" to anything you want. For example, you can rename it to "WebService". In this case you refer your web service like this, "Webservice.Service1". You can also rename it to "MyProject.KillerService". Now you refer to your service like this, "MyProject.KillerService.Service1".

    So, if you have more than one Web Service, you could name them like this,

    Code:
    + Web Reference
       + MyService.Killer
          + Service1.wsdl
          + Reference.map
       + MyService.Eraser
          + Service2.wsdl
          + Reference.map
       + MyService.Cleanser
          + Service3.wsdl
          + Reference.map
    Hope this help.

  6. #6

    Thread Starter
    Member
    Join Date
    Oct 2000
    Location
    Hong Kong
    Posts
    38
    Hi, programatix,

    Thank you.

    Your suggestion worked! I added the "localhost" in front for it to resolve the reference and the web service method was found.

  7. #7
    Member
    Join Date
    Mar 2002
    Posts
    40

    Wink

    You're most welcome.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width