Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello guys, this question may be a little long. I tried to create a method to use this WebService, however i get the error. I can use others webservice fine, but i did not created them(the method on android) Im pretty new so i would like some help.

W/System.err: SoapFault - faultcode: 'soap:Server' faultstring: 'Server was unable to process request. ---> Object reference not set to an instance of an object.' faultactor: 'null' detail: org.kxml2.kdom.Node@107d094
W/System.err: at org.ksoap2.serialization.SoapSerializationEnvelope.parseBody(SoapSerializationEnvelope.java:147)
W/System.err: at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:140)
W/System.err: at org.ksoap2.transport.Transport.parseResponse(Transport.java:118)
W/System.err: at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:275)
W/System.err: at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:118)
W/System.err: at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:113)
W/System.err: at org.tempuri.WsCambioCotacaoSoap.validateCoupon(WsCambioCotacaoSoap.java:1004)
W/System.err: at com.rendimento.cotacao.home.onlineStore.payment.PurchaseDetailsActivity$1.run(PurchaseDetailsActivity.java:235)
W/System.err: at java.lang.Thread.run(Thread.java:761)

// line 1004 is : _ht.call("http://tempuri.org/ValidateCoupon", _envelope);

Thats all the info i got. I'm deeply sorry for the very very long question, but i really need some help here. Im a beginner i don't even know where to start, i created that method based on another webservice method that was already created(my supervisor told me to do) i can't ask him for help, because he said he knows nothing about android so i would have to google some. Can anyone help me please?

What I have tried:

I tried calling the WebService in a more simplier way, but it just crashes the app, this one atleast make the app run. (My supervisor told me to make this method based on another one created)
Posted
Updated 2-Dec-16 4:03am
v3
Comments
Richard MacCutchan 2-Dec-16 10:23am    
Chances are that the variable _envelope is null. Check the Android studio logs, or use adb to get more information.
Member 12883247 2-Dec-16 12:41pm    
Hello Richard, thank you for your reply. Following Griff's sugestion i used the Debugger and checked the _envelope as you mentioned and i got this: _envelope = {SoapSerializationEnvelope@4836}

_envelope.bodyOut = {SoapObject@4835}

_envelope.bodyIn = null

_ht.responseDump = <soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:body><soap:fault><faultcode>soap:Server<faultstring>Server was unable to process request. ---> Object reference not set to an instance of an object.<detail>
Richard MacCutchan 2-Dec-16 13:16pm    
Unfortunately that still does not tell us which object is null. You need to look deeper into all the objects and their properties that are being referenced.
Member 12883247 3-Dec-16 13:25pm    
Ok Richard, got it. Thank you for your help :)

1 solution

This is one of the most common problems we get asked, and it's also the one we are least equipped to answer, but you are most equipped to answer yourself.

Let me just explain what the error means: You have tried to use a variable, property, or a method return value but it contains null - which means that there is no instance of a class in the variable.
It's a bit like a pocket: you have a pocket in your shirt, which you use to hold a pen. If you reach into the pocket and find there isn't a pen there, you can't sign your name on a piece of paper - and you will get very funny looks if you try! The empty pocket is giving you a null value (no pen here!) so you can't do anything that you would normally do once you retrieved your pen. Why is it empty? That's the question - it may be that you forgot to pick up your pen when you left the house this morning, or possibly you left the pen in the pocket of yesterdays shirt when you took it off last night.

We can't tell, because we weren't there, and even more importantly, we can't even see your shirt, much less what is in the pocket!

Back to computers, and you have done the same thing, somehow - and we can't see your code, much less run it and find out what contains null when it shouldn't.
But you can - and Visual Studio will help you here. Run your program in the debugger and when it fails, VS will show you the line it found the problem on. You can then start looking at the various parts of it to see what value is null and start looking back through your code to find out why. So put a breakpoint at the beginning of the method containing the error line, and run your program from the start again. This time, VS will stop before the error, and let you examine what is going on by stepping through the code looking at your values.

But we can't do that - we don't have your code, we don't know how to use it if we did have it, we don't have your data. So try it - and see how much information you can find out!
 
Share this answer
 
Comments
Member 12883247 2-Dec-16 10:14am    
Thanks for the reply Griff. That was a pretty solid explanation. I could try debugging it with VS, however i`m using Android Studio, and i can`t Download VS here(at least i think i can`t) Is there a way to debug it using Android Studio? I could try paste the codes here but i don`t think that would help. Thank you again for the reply Griff!
OriginalGriff 2-Dec-16 10:21am    
Well ... yes ... I'm surprised you haven;t found it yet, the debugger is teh most important bit of kit in an IDE!
https://developer.android.com/studio/debug/index.html
Member 12883247 2-Dec-16 12:43pm    
Hello Griff, sorry for bothering you again, i followed your suggestion and used the Debbuger, and i got this: _envelope = {SoapSerializationEnvelope@4836}

_envelope.bodyOut = {SoapObject@4835}

_envelope.bodyIn = null

_ht.responseDump = <soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:body><soap:fault><faultcode>soap:Server<faultstring>Server was unable to process request. ---> Object reference not set to an instance of an object.<detail>

I don't know if this helps in any way. Well, i appreciate you for atleast presenting me to Debbuger its a cool feature
OriginalGriff 2-Dec-16 13:59pm    
Use the debugger to find out what is null - from there you can start working out why!
Member 12883247 3-Dec-16 13:27pm    
Ok Griff, thank you for helping me out

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900