An exception occured whilst trying to authenticate you

Discussion in 'Developers Forum' started by mick.sterbs, Jan 8, 2009.

  1. mick.sterbs New Member

    Hi. I'm new to SOAP and trying to make a simple link between my online Kashflow database and an offline/desktop version, in RealBasic, using their SOAP objects. I'm making progress, with GetCustomers, but getting this error message returned.

    I'm absolutely sure the username/password are correct.

    Anybody any ideas what this is about? There are some other mentions of this error in the forums but they are dealing with PHP.

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
    <GetCustomersResponse xmlns="KashFlow">
    <GetCustomersResult/>
    <Status>NO</Status>
    <StatusDetail>An exception occured whilst trying to authenticate you.
    String reference not set to an instance of a String.
    Parameter name: s
    
       at System.Text.Encoding.GetBytes(String s)
       at KashFlow.wsDb.pwHash(String s)
       at KashFlow.wsDb.AuthenticateUser(String UserName, String Password, String ipaddr, String&amp; errMsg)
    </StatusDetail>
    </GetCustomersResponse>
    </soap:Body>
    </soap:Envelope>
    
    (Note I've wrapped that manually for clarity -- everything up to and including "An exception occured whilst trying to authenticate you." had no line breaks.)

    Many thanks for any help offered.

    Bruce
    (not really mick)
  2. DuaneJackson Administrator

    Hi Bruce (not really mick),

    Are you able to paste the raw XML you are sending to us?

    Duane
  3. Sandy New Member

    Hi Bruce (not really mick),

    Can you please forward me the SOAP message you're submitting to our server.

    Thanks,
  4. mick.sterbs New Member

    Hi both.

    I'm struggling to find the raw XML, because the RealBasic object doesn't expose it, and whilst I've downloaded WireShark to see if I can sniff it, I can't seem to coerce any sense out of it at all. Is there another way to get at it?

    Cheers
    Bruce

    --
  5. Sandy New Member

    Hi Bruce,

    Is RealBasic free to download and if it is, please send us a link to download it and also send us the code you're using to send the request.

    Sandy
  6. mick.sterbs New Member

    Hi Sandy

    It's free for evaluation, from realsoftware.com

    I'm using the Mac version.

    The code is literally just the below. txtReturn is a text control on a form. The code runs in the Click event of a button on the same form:

    Code:
    
      // you will need...
      Dim sock as new HTTPSecureSocket
      Dim sm as SOAPMethod
      Dim sr as SOAPResult
    
      // set it up
      sock.Secure = True
      sm = new SOAPMethod
      sm.UseSocket sock
      sm.url = "https://secure.kashflow.co.uk/api/service.asmx"
      sm.methodNamespace="https://secure.kashflow.co.uk"
      sm.action = "KashFlow/GetCustomers"
      sm.parameter("UserName") = "myusername"
      sm.parameter("Password") = "mypassword"
      
      // do it 
      sr = sm.invoke("GetCustomers")
      txtReturn.text= sr.document.tostring
    
  7. Sandy New Member

    Hi Bruce,

    Had a go and it works well for me but I made some changes. See code below

    Code:
      
      Dim sock as new HTTPSecureSocket
      Dim sm as SOAPMethod
      Dim sr as SOAPResult
      
      // set it up
      sock.Secure = True
      sm = new SOAPMethod
      sm.UseSocket sock
      sm.url = "https://secure.kashflow.co.uk/api/service.asmx"
      sm.methodNamespace="KashFlow"
      sm.action = "KashFlow/GetCustomers"
      sm.parameter("UserName") = "Username"
      sm.parameter("Password") = "Password"
      
      // do it
      sr = sm.invoke("GetCustomers")
      txtReturn.text= sr.document.tostring
      
      
    Give this a go and get back to me if you still need assistance.

    Thanks,
  8. mick.sterbs New Member

    Thanks Sandy, that's great.

    --

Share This Page