Hi, Sorry for being late I was away for a while. I hope your problem is solved, if not, then I think the problem might be easy to fix since the code looks normal to me. There is an option on the server side that might casuing the problem. If you use Internet explorer, you need to rnale the option "Access data sources across domains", if not then the windows will not allow Android to pass data to the web services. Let me know if that helps, Good luck
On Tue, Jan 19, 2010 at 2:47 PM, fischchris <fischch...@gmail.com> wrote: > Hello, I too am having this problem with a .net web service and am > curious if anyone can just look at my code and give some advice. I've > followed the suggestions thus far and either way I try it I'm getting > the same thing. I have a feeling it's something simple but I just > can't figure it out. Below is my code which is probably similar to > every one elses doing this: > > I only pasted the parts that actually mean something to this > question. In my webservice method, I've changed "Num" from int to > string, when it was an int, the service would return a 0, even though > I passed in1. When it's a string, it returns an empty string. Again > like others who have posted, I can call a method with no parameters > just fine, but that doesn't help me much. Any other advice anyone can > offer would be super appreciated. I'm running out of ideas of things > to try. > > Thank you all for the posts so far. > > Cheers! > > > 1) Client code on android: > > //Web Service Variables > private static final String NAMESPACE = "https://chris1.m2mops.com > "; > private static final String URL = "https://chris1.m2mops.com/ > snowreportdata/snowreportdata.asmx"; > private static final String SOAP_ACTION = " > https://chris1.m2mops.com/ > TestWithParams"; > private static final String METHOD = "TestWithParams"; > > > public String GetTestData() > { > SoapObject request = new SoapObject(NAMESPACE, METHOD); > //How to add variables to your web service call. > request.addProperty("Num","1"); > //PropertyInfo pi = new PropertyInfo(); > //pi.setName("Num"); > //pi.setValue(1); > //request.addProperty(pi); > > //Integer PropertyCount = request.getPropertyCount(); //gets the > property count for the WS. > > > SoapSerializationEnvelope envelope = new SoapSerializationEnvelope > (SoapEnvelope.VER11); > envelope.dotNet = true; > envelope.setOutputSoapObject(request); > //HttpTransportSE androidHttpTransport = new HttpTransportSE > (URL); > HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); > androidHttpTransport.setXmlVersionTag("<?xml version=\"1.0\" > encoding= \"UTF-8\"?>"); > > try{ > androidHttpTransport.call(SOAP_ACTION, envelope); > java.lang.Object Test = > (java.lang.Object)envelope.getResponse > (); > //return "(" + PropertyCount.toString() + ")" + > Test.toString(); > return Test.toString(); > > }catch(Exception e){ > return "ERROR: " + e.getMessage(); > } > > } > > 2) Web service code: > > [WebService(Namespace = "https://chris1.m2mops.com/")] > [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] > > [WebMethod(Description = "Testing method with parameters being passed > in")] > public string TestWithParams(string Num) > { > return "Testing from WS, Value Rcvd was: " + Num; > } > > On Dec 19 2009, 7:07 am, android09 <pranav.jaja...@gmail.com> wrote: > > Hi wedyan, > > > > I had also the same problem but finally i got the solution. I have > > some steps for you, just go through it. > > 1) Remove PropertyInfo from your code and add this like: > > > > SoapObject request = new SoapObject(NAMESPACE,METHOD_NAME_TEMP); > > // if you have 2 params in .net than add property this way. Suppose, > > "sum of two integers" instead of PropertyInfo > > request.addProperty("num", str1); > > request.addProperty("b", str2); > > > > 2) Use HttpTransportSE instead of AndroidHttpTransport. and add > > androidHttpTransport.setXmlVersionTag("<?xml version=\"1.0\" encoding= > > \"UTF-8\"?>"); > > > > 3) To Display Result: > > SoapPrimitive resultString = (SoapPrimitive)soapEnvelope.getResponse > > (); > > System.out.println(resultString); > > txtView.setText("Result is : "+resultString); > > > > Now, go through the above steps and also compare your application. I > > hope you will find the solution. Let's hope. > > > > Best Luck.... > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en