using web services.

Last post 07-06-2009 7:56 AM by johnwsaunders3. 8 replies.

Sort Posts:

  • using web services.

    07-02-2009, 7:18 AM
    • Member
      1 point Member
    • zawisza
    • Member since 07-02-2009, 11:05 AM
    • Posts 8

    I am having a problem with using a web service provided by a 3rd party.

    http://www.humyo.com/Assets/StorageAPI.wsdl

    I have tried to add it as a web referance.

    But it does not expose any functionality.

    It can be accessed using PHP like this:

    <?php

    // Create the client instance
    $client = new Soapclient('http://www.humyo.com/Assets/StorageAPI.wsdl');

    // Call the SOAP method
    $auth = $client->getAuthToken('email','password','API v1.0');

    $atoken = $auth['authToken'];

    print_r($atoken);

    ?>

    Any ideas what i am doing wrong?

    A

  • Re: using web services.

    07-02-2009, 8:36 AM
    • All-Star
      91,373 point All-Star
    • SGWellens
    • Member since 01-02-2007, 9:27 PM
    • Twin Cities, MN
    • Posts 7,453
    • Moderator
      TrustedFriends-MVPs

    zawisza:
    Any ideas what i am doing wrong?
     

     

    Yes, you didn't supply enough information.  How are you doing it and are there any error messages?

    Here's what the IDE finds for you:

     

    "StorageAPIHandlerService" Description

    Methods

    • addContact ( )
      Add a contact for the user
    • addToTeamspace ( )
      Add a user to a teamspace
    • createUser ( )
      Create a new user account
    • deleteUser ( )
      Delete a user account
    • getAuthToken ( )
      Get the authentication token needed for subsequent API calls
    • getClientParameters ( )
      Get the settings for use by a client
    • getJournalSinceEx ( )
      Get file changes which occurred on or after a specified time (extended)
    • getSharing ( )
      Get the sharing settings for an object
    • getSpaceUsage ( )
      Get the total and used space for an account in bytes
    • listTeamspace ( )
      List users within a teamspace
    • listUsers ( )
      List users within an organisation
    • modifyUser ( )
      Edit a user account
    • removeFromTeamspace ( )
      Add a user to a teamspace
    • setSharing ( )
      Get or change sharing of an object

     

    Steve Wellens

    My blog
  • Re: using web services.

    07-02-2009, 10:35 AM
    • Member
      1 point Member
    • zawisza
    • Member since 07-02-2009, 11:05 AM
    • Posts 8

    here is what i do, step by step.

    1. Create a new web page.

    2. Right Click on Web Referances.

    3.  Select Add Web Refarance

    4. Type in : http://www.humyo.com/Assets/StorageAPI.wsdl

    5. Press Go, now i can see the list of functions.

    6. Name the web Referance 'humyo'.

    7. Click on Add Refarance

    At this point the web referance apears to have been added.

    8. Try to use the referance in my code. (nothing, no inteli sense in visual studio)

    9. Right clock on the web referance

    10 Select - Update Web Rererence

    Error:

    The custom tool 'MSDiscoCodeGenerator' Failed. Unable to import binding 'StorageAPUSoapBindings from namespac ' http://www.humyo.com/api

     

     

  • Re: using web services.

    07-04-2009, 4:42 AM

    Look in the output window and try to find the complete error message. Why was it unable to import that binding?

    If that doesn't work, then use the wsdl.exe tool, not in order to produce the code, but because you'll get full error messages.

    John Saunders
  • Re: using web services.

    07-04-2009, 7:19 AM
    • Member
      1 point Member
    • zawisza
    • Member since 07-02-2009, 11:05 AM
    • Posts 8

    johnwsaunders3:

    Look in the output window and try to find the complete error message. Why was it unable to import that binding?

    If that doesn't work, then use the wsdl.exe tool, not in order to produce the code, but because you'll get full error messages.

     

     

    1. There is no indication of why it was unable to import that binding. This is the entire message. As you will notice from my post it is not when the original binding is done, only when i try to update it.

    2. I don't know how wsdl.exe is used. I had a look on line. But i am not sure what i should be expecting from it.

    3. Regarding your previous message (the one you must have edited) , egarding no 8 of my post. What i mean is: that at this point i try to type in my visual studio to create an object from the referance. But the web referance is not recognised at all. The name i created when adding the referance does not at all apear when trying to type it. Also when, pressing '.' after the name, no methods are exposed. Visual Studio does not at all recognise it. I then tried to update the referance. At which point i get the error i described. Again error does not indicate reasons,it simply tells me that it is in fact unable to import the binding.

     

  • Re: using web services.

    07-04-2009, 8:46 AM
    • All-Star
      91,373 point All-Star
    • SGWellens
    • Member since 01-02-2007, 9:27 PM
    • Twin Cities, MN
    • Posts 7,453
    • Moderator
      TrustedFriends-MVPs

    I believe the system did import the binding to a proxy file, it just can't compile the proxy file (which is why there is no intellisense)

    zawisza did include the error message in his post:

    Error:

    The custom tool 'MSDiscoCodeGenerator' Failed. Unable to import binding 'StorageAPUSoapBindings from namespac ' http://www.humyo.com/api

     

    I was curious and ran wsdl on the url and got the messages below. 

     

    wsdl  http://www.humyo.com/Assets/StorageAPI.wsdl
    Microsoft (R) Web Services Description Language Utility
    [Microsoft (R) .NET Framework, Version 2.0.50727.3038]
    Copyright (C) Microsoft Corporation. All rights reserved.
    Warning: This web reference does not conform to WS-I Basic Profile v1.1.
    R2718: A wsdl:binding in a DESCRIPTION MUST have the same set of wsdl:operations
     as the wsdl:portType to which it refers.
      -  Operation 'getClientParameters' on portType 'StorageAPIHandler' from namesp
    ace 'http://www.humyo.com/Storage/API' has no matching binding.
      -  Operation 'getSpaceUsage' on portType 'StorageAPIHandler' from namespace 'h
    ttp://www.humyo.com/Storage/API' has no matching binding.
      -  Operation 'getClientParameters' on binding 'StorageAPISoapBinding' from nam
    espace 'http://www.humyo.com/Storage/API' has no matching operation on portType
    'StorageAPIHandler' from namespace 'http://www.humyo.com/Storage/API'.
      -  Operation 'getClientParameters' on binding 'StorageAPISoapBinding' from nam
    espace 'http://www.humyo.com/Storage/API' has no matching operation on portType
    'StorageAPIHandler' from namespace 'http://www.humyo.com/Storage/API'.
      -  Operation 'getSpaceUsage' on binding 'StorageAPISoapBinding' from namespace
     'http://www.humyo.com/Storage/API' has no matching operation on portType 'Stora
    geAPIHandler' from namespace 'http://www.humyo.com/Storage/API'.
      -  Operation 'getSpaceUsage' on binding 'StorageAPISoapBinding' from namespace
     'http://www.humyo.com/Storage/API' has no matching operation on portType 'Stora
    geAPIHandler' from namespace 'http://www.humyo.com/Storage/API'.

    R2706: A wsdl:binding in a DESCRIPTION MUST use the value of "literal" for the u
    se attribute in all soapbind:body, soapbind:fault, soapbind:header and soapbind:
    headerfault elements.
      -  Input element soapbind:body of operation 'getAuthToken' on portType 'Storag
    eAPISoapBinding' from namespace 'http://www.humyo.com/Storage/API'.
      -  Output element soapbind:body of operation 'getAuthToken' on portType 'Stora
    geAPISoapBinding' from namespace 'http://www.humyo.com/Storage/API'.
      -  Input element soapbind:body of operation 'getClientParameters' on portType
    'StorageAPISoapBinding' from namespace 'http://www.humyo.com/Storage/API'.
      -  Output element soapbind:body of operation 'getClientParameters' on portType
     'StorageAPISoapBinding' from namespace 'http://www.humyo.com/Storage/API'.
      -  Input element soapbind:body of operation 'createUser' on portType 'StorageA
    PISoapBinding' from namespace 'http://www.humyo.com/Storage/API'.
      -  Output element soapbind:body of operation 'createUser' on portType 'Storage
    APISoapBinding' from namespace 'http://www.humyo.com/Storage/API'.
      -  Input element soapbind:body of operation 'modifyUser' on portType 'StorageA
    PISoapBinding' from namespace 'http://www.humyo.com/Storage/API'.
      -  Output element soapbind:body of operation 'modifyUser' on portType 'Storage
    APISoapBinding' from namespace 'http://www.humyo.com/Storage/API'.
      -  Input element soapbind:body of operation 'deleteUser' on portType 'StorageA
    PISoapBinding' from namespace 'http://www.humyo.com/Storage/API'.
      -  Output element soapbind:body of operation 'deleteUser' on portType 'Storage
    APISoapBinding' from namespace 'http://www.humyo.com/Storage/API'.
      -  Input element soapbind:body of operation 'getSpaceUsage' on portType 'Stora
    geAPISoapBinding' from namespace 'http://www.humyo.com/Storage/API'.
      -  Output element soapbind:body of operation 'getSpaceUsage' on portType 'Stor
    ageAPISoapBinding' from namespace 'http://www.humyo.com/Storage/API'.
      -  Input element soapbind:body of operation 'getJournalSinceEx' on portType 'S
    torageAPISoapBinding' from namespace 'http://www.humyo.com/Storage/API'.
      -  Output element soapbind:body of operation 'getJournalSinceEx' on portType '
    StorageAPISoapBinding' from namespace 'http://www.humyo.com/Storage/API'.
      -  Input element soapbind:body of operation 'getSharing' on portType 'StorageA
    PISoapBinding' from namespace 'http://www.humyo.com/Storage/API'.
      -  Output element soapbind:body of operation 'getSharing' on portType 'Storage
    APISoapBinding' from namespace 'http://www.humyo.com/Storage/API'.
      -  Input element soapbind:body of operation 'setSharing' on portType 'StorageA
    PISoapBinding' from namespace 'http://www.humyo.com/Storage/API'.
      -  Output element soapbind:body of operation 'setSharing' on portType 'Storage
    APISoapBinding' from namespace 'http://www.humyo.com/Storage/API'.
      -  Input element soapbind:body of operation 'addContact' on portType 'StorageA
    PISoapBinding' from namespace 'http://www.humyo.com/Storage/API'.
      -  Output element soapbind:body of operation 'addContact' on portType 'Storage
    APISoapBinding' from namespace 'http://www.humyo.com/Storage/API'.
      -  Input element soapbind:body of operation 'listUsers' on portType 'StorageAP
    ISoapBinding' from namespace 'http://www.humyo.com/Storage/API'.
      -  Output element soapbind:body of operation 'listUsers' on portType 'StorageA
    PISoapBinding' from namespace 'http://www.humyo.com/Storage/API'.
      -  Input element soapbind:body of operation 'listTeamspace' on portType 'Stora
    geAPISoapBinding' from namespace 'http://www.humyo.com/Storage/API'.
      -  Output element soapbind:body of operation 'listTeamspace' on portType 'Stor
    ageAPISoapBinding' from namespace 'http://www.humyo.com/Storage/API'.
      -  Input element soapbind:body of operation 'addToTeamspace' on portType 'Stor
    ageAPISoapBinding' from namespace 'http://www.humyo.com/Storage/API'.
      -  Output element soapbind:body of operation 'addToTeamspace' on portType 'Sto
    rageAPISoapBinding' from namespace 'http://www.humyo.com/Storage/API'.
      -  Input element soapbind:body of operation 'removeFromTeamspace' on portType
    'StorageAPISoapBinding' from namespace 'http://www.humyo.com/Storage/API'.
      -  Output element soapbind:body of operation 'removeFromTeamspace' on portType
     'StorageAPISoapBinding' from namespace 'http://www.humyo.com/Storage/API'.

    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.: Unable to import binding 'StorageAPISoapBinding' from namespace 'http://w
    ww.humyo.com/Storage/API'.
      - The operation 'getClientParameters' on portType 'StorageAPIHandler' from nam
    espace 'http://www.humyo.com/Storage/API' had the following syntax error:  The o
    peration has no matching binding. Check if the operation, input and output names
     in the Binding section match with the corresponding names in the PortType secti
    on.

     

     

     

    Steve Wellens

    My blog
  • Re: using web services.

    07-04-2009, 9:10 AM

    WSDL.EXE is correct. In the getClientParameters operation, the input is named "getClientParametersRequest", but in the binding, it's named "getClientParameters".

    After the "Add Web Reference", but before doing the "Update Web Reference", check to see if you have a Reference.cs (.vb?) in the web reference folder on disk. Open it up and see if code was generated for the service at all, or for this operation.

    Also, if you're using VS2008, please try an "Add Service Reference", just to see if WCF has any better luck with this WSDL than ASMX did. See ASMX Web Services are a “Legacy Technology”.

    John Saunders
  • Re: using web services.

    07-06-2009, 5:38 AM
    • Member
      1 point Member
    • zawisza
    • Member since 07-02-2009, 11:05 AM
    • Posts 8

    johnwsaunders3:

    WSDL.EXE is correct. In the getClientParameters operation, the input is named "getClientParametersRequest", but in the binding, it's named "getClientParameters".

    After the "Add Web Reference", but before doing the "Update Web Reference", check to see if you have a Reference.cs (.vb?) in the web reference folder on disk. Open it up and see if code was generated for the service at all, or for this operation.

    Also, if you're using VS2008, please try an "Add Service Reference", just to see if WCF has any better luck with this WSDL than ASMX did. See ASMX Web Services are a “Legacy Technology”.

     

    There is no file Reference.cs (not VB) , all i have is : reference.map and StorageAPI.wdsl

    I tried using 'Add Service Reference' , interestingly enough, this does not give me any errors when doing the update, also in this case it creates a reference.cs file in the service reference folder. However the file is empty.

    Also, again i get no inteli sense when trying to use the service.

    The lack of any errors makes me think that this should work.

    Unfortunetely, if i just type in some commands it still does not compile. :(

  • Re: using web services.

    07-06-2009, 7:56 AM
    Answer

    zawisza:

    The lack of any errors makes me think that this should work.

    In general, when you run a piece of code and no errors are reported, it could mean there are no errors, or it could mean that the error reporting is broken. This is true for Visual Studio as well, and I think we've got a case of that here.

    You may not have realized it, but WSDL.EXE is pretty much the same code you run when you use "Add Web Reference". Yet one reports errors and the other does not. That's a clear failure of the error reporting.

    Similarly, SVCUTIL.EXE is the same code used when you use "Add Service Reference". I suggest you try SVCUTIL.EXE to see if you can get more error output.

    But the bottom line is that WSDL has problems. If you're able to point these problems out to the authors, then maybe they can fix it.

    John Saunders
Page 1 of 1 (9 items)