Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Tue Nov 21, 2017 10:55 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: NilObjectexception with SOAP
PostPosted: Tue Mar 19, 2013 12:33 pm 
Offline

Joined: Wed Feb 08, 2012 9:33 am
Posts: 9
I get a NilObjectexception invoking a soap call (to use a SAP webservice) with authentication.
I can make a working call ussing soapui, but setting authentycation type preemptive. If this parameter is setting as default (global http settings) it doesn't work. I read that this means that autentication must be done at header.
I analized raw data of soapui and authentication parameter is the same that mine (in watch window, at the right of the screen).
I know that action parameter is empty, but is also empty in soapui request.
I don't know what to do. Some ideas?

Dim sm as SoapMethod
Dim sr as SOAPResult
Dim WS as new HTTPSocket

// create SOAPMethod and define parameters
sm = New SoapMethod
sm.UseSocket (WS)

WS.SetRequestHeader "Authorization","Basic " + EncodeBase64("MYUSER:MYPWD")
sm.parameter("Werks") = SELF.t_Werks.Text
sm.parameter("Lgort") = SELF.t_Lgort.Text
sm.parameter("Ean") = SELF.t_Ean.Text
sm.parameter("Exid") = SELF.t_Exidv.Text
sm.parameter("Charg") = SELF.t_Charg.Text
sm.parameter("Meins") = SELF.t_Meins.Text
sm.parameter("Quantity") = SELF.t_Quantity.Text
sm.parameter("Encodeur") = SELF.t_Encodeur.Text
sm.parameter("Zzdate") = SELF.t_Zzdate.Text
sm.parameter("Zzuzeit") = SELF.t_Zzuzeit.Text

// set method properties
sm.methodNamespace = "MYNAMESPACE"
sm.action = ""
sm.url="MYULR"
// execute function
sr = sm.invoke("Myfunc") 'HERE I GET NILOBJECTEXCEPTION


Top
 Profile  
Reply with quote  
 Post subject: Re: NilObjectexception with SOAP
PostPosted: Tue Mar 19, 2013 2:51 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
This seems to be a limitation with the Soap classes. They work for simple requests, but nothing complex. And I've never been able to get them to work with authentication. Use an HTTPSocket, build the XML for the soap yourself, and Post it to the service. You'll get a string containing the xml response, which you can parse.


Top
 Profile  
Reply with quote  
 Post subject: Re: NilObjectexception with SOAP
PostPosted: Wed Mar 20, 2013 2:10 am 
Offline

Joined: Wed Feb 08, 2012 9:33 am
Posts: 9
I'll try it.
Somebody knows where to find a example?
I got the XML text for the request from sopapui, I only need to know how to made a call.
Thanks a lot.
Regards.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group