FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Help needed with SOAP Authentication
Posts: 989
Joined: Thu Nov 24, 2005 03:01 PM
Help needed with SOAP Authentication
Posted: Wed Sep 17, 2014 02:19 PM
Hi everyone,

i'm trying to use a web service via MSSoap y Harbour, and it's almost done with the exception of an important detail: Authentication.
The code is the following one, but it lacks the authentication because i don't know how to write the user and password, I can't find the equivalent code of the VB sentences

Code (fw): Select all Collapse
      TRY
         oSoap := CreateObject( "MSSOAP.SoapClient30" )
         oSoap:msSoapInit( "http://localhost:8089/open/services/AbsenceFileService?wsdl" )
         // oSoap:msSoapInit( "http://user:passw@localhost:8089/open/services/AbsenceFileService?wsdl" )
         // putting the user:passwd in the url makes msSoapInit function fail
         oSoap:ClientProperty("ServerHTTPRequest")
         // the code for stablish the user and psw in VB
         // oSoap:ConnectorProperty("AuthUser" ) = 'user'
         // oSoap:ConnectorProperty("AuthPassword") = 'passwd'
         // this previous lines are the ones i haven't been able to translate into Harbour
         // Things i already tryed:

         oSoap:ConnectorProperty:AuthUser:= 'user'
         // Argument Error

         oSoap:ConnectorProperty:AuthUser( 'user' )
         // Argument Error

         oSoap:ConnectorProperty("AuthUser", 'user' )
         // Argument Error

         oSoap:ConnectorProperty("AuthUser") := 'user' 
         // Does not compiles, invalid lValue

         oSoap:ConnectorProperty("AuthUser"):Value := 'user' 
         // No exported variable

         oSoap:AuthUser:= 'user'
         // No exported variable

         MsgInfo( ValType( oSoap:ConnectorProperty("AuthUser") ) ) // -> '' ! blank string, no type, not even 'U'!

         oSoap:ConnectorProperty("AuthPassword"):Value := 'passwd'
         // Not exported variable

      CATCH oError
         MsgStop( oError )
         Quit
      END TRY


The point is: ¿How to write the equivalent sentence of VB "oSoap:ConnectorProperty("AuthUser" ) = 'user'" in Harbour ?

There is another way to access SOAP web services with authentication?

I have searched in the forum but no luck with authentication in SOAP.

Regards,
Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Help needed with SOAP Authentication
Posted: Wed Sep 17, 2014 02:41 PM

Carlos,

try AuthName instead of AuthUser.

EMG

Posts: 989
Joined: Thu Nov 24, 2005 03:01 PM
Re: Help needed with SOAP Authentication
Posted: Wed Sep 17, 2014 03:03 PM
Hi Enrico,

AFAIK, AuthName was the old name of AuthUser, before SOAP 3.0. Anyway i cheched it.

wich code option do you sugest? That is my biggest problem.

oSoap:ConnectorProperty:= 'user'

oSoap:ConnectorProperty:AuthName( 'user' )
// Argument Error

oSoap:ConnectorProperty("AuthName", 'user' )
// Argument Error

oSoap:ConnectorProperty("AuthName") := 'user'
// Does not compiles, invalid lValue

oSoap:ConnectorProperty("AuthName"):Value := 'user'
// This is differenterror! Look at the image for error description.
oSoap:= 'user'
// No exported variable

The same error (unknown property AuthName ) trying ? ValType( oSoap:ConnectorProperty('AuthName') )

So AuthName seems not to be the right name.




Thanks
Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Help needed with SOAP Authentication
Posted: Wed Sep 17, 2014 04:58 PM

Carlos,

can I see the exact VB sample?

EMG

Posts: 989
Joined: Thu Nov 24, 2005 03:01 PM
Re: Help needed with SOAP Authentication
Posted: Thu Sep 18, 2014 07:42 AM

Hi Enrico,

never mind, i found the solution.

Walter Negro was able to read and show me the layout of methods related to 'ConnectoProperty' , and the SetProperty was receiving 2 paremeters, then we realized that, to activate the 'Set', the method should be called with an underscore '_' in front of name, so that made the trick, use _ConnectorProperty.

Thanks for your support and interest,

Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Help needed with SOAP Authentication
Posted: Thu Sep 18, 2014 07:50 AM

Carlos,

thank you for sharing the solution!

EMG

Posts: 109
Joined: Mon Apr 30, 2012 09:10 AM
Re: Help needed with SOAP Authentication
Posted: Thu Sep 18, 2014 11:55 AM

Carlos,

Can you please post the full sample please?. It would be very useful for further cases.

Thank you.

Posts: 989
Joined: Thu Nov 24, 2005 03:01 PM
Re: Help needed with SOAP Authentication
Posted: Thu Sep 18, 2014 03:23 PM

José Luis,

it is there, please check the first post. The code only requires to add the underscore in the method call.

Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"

Continue the discussion