Newbie: How to access a WebService from VB.NET 2008?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 13 of 13

Thread: Newbie: How to access a WebService from VB.NET 2008?

Hybrid View

  1. #1
    Join Date
    Mar 2008
    Location
    Blaricum, The Netherlands
    Posts
    78

    Newbie: How to access a WebService from VB.NET 2008?

    Hallo all,

    I need to build a small application in VB.NET to access a Web-Service.
    It's just to proof a concept.

    The Web-Service I'm trying to access handles request against a document database. Using web-service requests I should be able to see how many documents are in the database, search for specific documents, view them, delete them, etcetera....
    The database and the web-service runs on my local machine. (And should be accessible inside our local network. But that is optional step 2.)

    I have been searching the web for a good tutorial of example project, but was unable to find something that was useful to me.
    Is the please, please someone who could help me on my way?
    I have no idea where to start.

    Friendly greetings
    Rens Duijsens
    The Netherlands

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Is the Web service already written? You just want to know how to access it? If so, see if this helps: http://msdn.microsoft.com/en-us/libr...57(VS.71).aspx
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Mar 2008
    Location
    Blaricum, The Netherlands
    Posts
    78
    Yes. The webservices do already exist.
    They are running on a machine in our local network.
    (Well, actually, it runs in en Virtual Machine on my laptop.)

    I know the ip-address of this machine.
    I known the port the webservice is listening on.
    I do not (yet) know the name of the webservices.

    I ran throught the walktrough, but stranded on "Ad a web reference".
    There is a button: Browse for webservices on local machine.
    But no button for: Browse for webservices on machine 192.168.1.133

    is there a way to find out the name(s)?

  4. #4
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    If you know the URL of the Web service, you do not need to browse for it. In the Add Web Reference dialog, simply enter the Web service URL: http://192.168.1.133/<virtual directory>/<file name>.asmx
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  5. #5
    Join Date
    Mar 2008
    Location
    Blaricum, The Netherlands
    Posts
    78
    Quote Originally Posted by Phil Weber View Post
    In the Add Web Reference dialog, simply enter the Web service URL: http://192.168.1.133/<virtual directory>/<file name>.asmx
    Yes. I know....
    But there is my challange.
    I know the part: http://192.168.1.133
    How do I find out the part: <virtual directory>/<file name>.asmx

    Help?

    Friendly greetings
    Rens

  6. #6
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Open the Web service project in Visual Studio. In Solution Explorer, right-click on the .asmx file and select View in Browser. Look at the URL in the browser's address bar.
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  7. #7
    Join Date
    Mar 2008
    Location
    Blaricum, The Netherlands
    Posts
    78
    Quote Originally Posted by Phil Weber View Post
    Open the Web service project in Visual Studio.
    I don't have the WebService project.
    I just have a server and the knowledge there are webservices running.
    I know it's running on port 2718.

    I have documentation that tells me there are options like 'DocumentSearch' and 'getDocuments', 'deleteDocuments', getDocumentDetails' and so on......

    And I have a WSDL.

    But thats is.

  8. #8
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    In order to call a Web service, you must know its URL. Is the WSDL file on the server? If so, enter its URL into the Add Web Reference dialog. Otherwise, try going into IIS Manager on the Virtual PC and look at the virtual directories. Right-click on the .asmx file and select "Browse", then look at the URL in the browser.
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  9. #9
    Join Date
    Mar 2008
    Location
    Blaricum, The Netherlands
    Posts
    78
    The URL is http://192.168.254.133:2718
    Adding a WebReference produces an error:

    Code:
      <?xml version="1.0" encoding="UTF-8" ?> 
    - <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:c14n="http://www.w3.org/2001/10/xml-exc-c14n#" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
    - <SOAP-ENV:Body>
    - <SOAP-ENV:Fault SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      <faultcode>SOAP-ENV:Client</faultcode> 
      <faultstring>HTTP GET method not implemented</faultstring> 
      </SOAP-ENV:Fault>
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>
    Any suggestions plase?

  10. #10
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    OK, it looks like Add Web Reference won't work for the Web service you're using, so let's try Plan B: Run Microsoft's wsdl.exe tool against your WSDL file to generate a proxy class. If you have VS 2008, you should find wsdl.exe in \Program Files\Microsoft SDKs\Windows\6.0A\Bin\ . From a command prompt, do this:

    wsdl /l:vb <name of WSDL file>

    Then add the resulting .vb file to your project.
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  11. #11
    Join Date
    Mar 2008
    Location
    Blaricum, The Netherlands
    Posts
    78
    Done that.
    Here is the result:
    Code:
    wsdl.exe /l:vb Collector.wsdl
    Microsoft (R) Web Services Description Language Utility
    [Microsoft (R) .NET Framework, Version 2.0.50727.1432]
    Copyright (C) Microsoft Corporation. All rights reserved.
    Warning: This web reference does not conform to WS-I Basic Profile v1.1.
    SOAP 1.1-binding is niet aangetroffen: Het Basic Profile 1.1 van WS-I bevat implementatierichtlijnen waarin wordt aanbevolen hoe een set kernwebservices samen kunnen worden gebruikt om compatibele webservices te ontwikkelen. Voor het 1.1-profiel betreft het de specificaties SOAP 1.1, WSDL 1.1, UDDI
    2.0, XML 1.0 en XML Schema.
    
    For more details on the WS-I Basic Profile v1.1, see the specification
    at http://www.ws-i.org/Profiles/BasicProfile-1.1.html.
    
    Error: Kan binding strsRepositoryDocumentServiceBindingType van naamruimte http://schemas.streamserve.com/webservice/repositorydocument/strsrepositorydocumentservice/1.0 niet importeren.
      - Kan de bewerking getDocuments niet importeren.
      - Het element http://www.w3.org/2004/08/xop/include:Include ontbreekt.
    
    If you would like more help, please type "wsdl /?".
    Okay... it has dutch texts....
    Free translation here:
    Code:
    wsdl.exe /l:vb Collector.wsdl
    Microsoft (R) Web Services Description Language Utility
    [Microsoft (R) .NET Framework, Version 2.0.50727.1432]
    Copyright (C) Microsoft Corporation. All rights reserved.
    Warning: This web reference does not conform to WS-I Basic Profile v1.1.
    SOAP 1.1-binding not found: The Basic Profile 1.1 of WS-I contains directives advising how to use a set of kernel webservices together to develop a compatible webservice. For the 1.1-profiel you would have to use SOAP 1.1, WSDL 1.1, UDDI 2.0, XML 1.0 and XML Schema.
    
    For more details on the WS-I Basic Profile v1.1, see the specification
    at http://www.ws-i.org/Profiles/BasicProfile-1.1.html.
    
    Error: Can't import binding strsRepositoryDocumentServiceBindingType of namespace  http://schemas.streamserve.com/webservice/repositorydocument/strsrepositorydocumentservice/1.0.
      - Unable to import function getDocuments.
      - The element http://www.w3.org/2004/08/xop/include:Include is missing.
    
    If you would like more help, please type "wsdl /?".
    The WSDL seems to work fine in a tool like soapUI.
    HTML Code:
    www.soapUI.org
    I'm using the Free Tool.

    I have loaded the SWDL into soapUI and have been testing wit it.
    In soapUI I'm able to send requests to the webservice and I do get responces from the webservice with usefull information.
    That's working fine.

    Help?

    Friendly greetings
    Rens

  12. #12
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Sorry, I'm out ideas. Hopefully someone else can help you.
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  13. #13
    Join Date
    Mar 2008
    Location
    Blaricum, The Netherlands
    Posts
    78
    Update:

    I did not solve this problem, but i stopped working on al solution.

    I was doing a Proof Of Concept, proofing that we could access a certain local webservice.
    I solved the POC by using soapUI. No Vb.NET

    Thanks for all the effort that was put in.

    Rens

Similar Threads

  1. Converting from access 2002 to access 97
    By wwwursa in forum Database
    Replies: 1
    Last Post: 03-07-2009, 02:20 PM
  2. Replies: 1
    Last Post: 07-01-2005, 03:53 AM
  3. using a c# class in a vb.net webservice
    By Guillaume LagacÚ in forum ASP.NET
    Replies: 1
    Last Post: 05-21-2002, 03:50 PM
  4. Create Access DB in VB.NET
    By Lee Dodd in forum VB Classic
    Replies: 1
    Last Post: 05-16-2002, 03:34 PM
  5. access vs SQL Server
    By Ray Clough in forum Database
    Replies: 7
    Last Post: 09-06-2001, 03:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center