Real Software Forums
http://forums.realsoftware.com/

NilObjectexception with SOAP
http://forums.realsoftware.com/viewtopic.php?f=2&t=47334
Page 1 of 1

Author:  jcgarrido [ Tue Mar 19, 2013 12:33 pm ]
Post subject:  NilObjectexception with SOAP

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

Author:  timhare [ Tue Mar 19, 2013 2:51 pm ]
Post subject:  Re: NilObjectexception with SOAP

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.

Author:  jcgarrido [ Wed Mar 20, 2013 2:10 am ]
Post subject:  Re: NilObjectexception with SOAP

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.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/