Help needed with SOAP Authentication

Help needed with SOAP Authentication

Postby Carlos Mora » Wed Sep 17, 2014 2: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: Select all  Expand view

      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"
Carlos Mora
 
Posts: 988
Joined: Thu Nov 24, 2005 3:01 pm
Location: Madrid, España

Re: Help needed with SOAP Authentication

Postby Enrico Maria Giordano » Wed Sep 17, 2014 2:41 pm

Carlos,

try AuthName instead of AuthUser.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8310
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Help needed with SOAP Authentication

Postby Carlos Mora » Wed Sep 17, 2014 3: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:AuthName:= '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:AuthUser:= 'user'
// No exported variable

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

So AuthName seems not to be the right name.


Image

Thanks
Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"
Carlos Mora
 
Posts: 988
Joined: Thu Nov 24, 2005 3:01 pm
Location: Madrid, España

Re: Help needed with SOAP Authentication

Postby Enrico Maria Giordano » Wed Sep 17, 2014 4:58 pm

Carlos,

can I see the exact VB sample?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8310
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Help needed with SOAP Authentication

Postby Carlos Mora » Thu Sep 18, 2014 7: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"
Carlos Mora
 
Posts: 988
Joined: Thu Nov 24, 2005 3:01 pm
Location: Madrid, España

Re: Help needed with SOAP Authentication

Postby Enrico Maria Giordano » Thu Sep 18, 2014 7:50 am

Carlos,

thank you for sharing the solution!

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8310
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Help needed with SOAP Authentication

Postby joseluispalma » 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.
joseluispalma
 
Posts: 109
Joined: Mon Apr 30, 2012 9:10 am

Re: Help needed with SOAP Authentication

Postby Carlos Mora » Thu Sep 18, 2014 3: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"
Carlos Mora
 
Posts: 988
Joined: Thu Nov 24, 2005 3:01 pm
Location: Madrid, España


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Horizon and 17 guests