android - KSOAP and web server communication (PropertyInfo) -


so i'm developing android app should connect web service. connection working fine. i've tested using simple method returns "hello christian". displayed correct in app. if try parameter (name) returns "hello null".

technically i'm working android 4.2.2 , ksoap 2.6.5. web service running on oracle weblogic v12. following source code:

private final string namespace_local = "http://test.com/"; private final string url_local = "http://168.185.226.69:7001/neuesprojekt/neuerwebserviceservice"; private final string soap_action_local = "hello_action_name";     private final string method_name_local = "helloname";      private final string url_local = "http://168.185.226.21:7001/mytest/mytestwebserviceservice";   private final string soap_action_local = "hello_action_extend";    private final string method_name_local = "hello_extend";          public void localserver(view view)         {             textview text = (textview) findviewbyid(r.id.update_text);              soapobject request = new soapobject(namespace_local, method_name_local);     //      request.addproperty("name", "christian");      //      string name = "christian";     //           //      propertyinfo nameprop =new propertyinfo();     //        nameprop.name = "name";     //        nameprop.type = string.class;     //        nameprop.namespace = namespace_local;     //        nameprop.setvalue(name);     //        request.addproperty(nameprop);              soapserializationenvelope envelope = new soapserializationenvelope(soapenvelope.ver11);             envelope.setoutputsoapobject(request);             httptransportse androidhttptransport = new httptransportse(url_local);              try {                 androidhttptransport.call(soap_action_local, envelope);                 soapprimitive response = (soapprimitive)envelope.getresponse();                 log.i("myapp", response.tostring());               text.settext(response.tostring());          } catch (exception e) {             toast.maketext(this,"device or service offline",toast.length_long).show();         }     } 

i've tried add propertyinfo in 2 ways. first simple request.addproperty , long way creating propertyinfo , adding afterwards. both ways don't work. when try server tutorial (eg. celsius fahrenheit) works , returns proper answer.

here 'code' web server:

package com.test;  import javax.jws.*;  @webservice public class mytestwebservice {      @webmethod(action="hello_action")     public string hello() {         return "hello";     }      @webmethod(action="hello_action_extend")     public string hello_extend(string name)     {         return "hello "+name;     } } 

following wsdl file in case helps solve problem:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <!-- generated jax-ws ri @ http://jax-ws.dev.java.net. ri's version jax-ws ri 2.2.6hudson-86  svn-revision#12773. --> <definitions targetnamespace="http://test.com/" name="mytestwebserviceservice" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:tns="http://test.com/" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">   <types>     <xsd:schema>       <xsd:import namespace="http://test.com/" schemalocation="mytestwebserviceservice_schema1.xsd"/>     </xsd:schema>   </types>   <message name="hello">     <part name="parameters" element="tns:hello"/>   </message>   <message name="helloresponse">     <part name="parameters" element="tns:helloresponse"/>   </message>   <porttype name="mytestwebservice">     <operation name="hello">       <input wsam:action="hello_action" message="tns:hello"/>       <output wsam:action="http://test.com/mytestwebservice/helloresponse" message="tns:helloresponse"/>     </operation>   </porttype>   <binding name="mytestwebserviceportbinding" type="tns:mytestwebservice">     <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>     <operation name="hello">       <soap:operation soapaction="hello_action"/>       <input>         <soap:body use="literal"/>       </input>       <output>         <soap:body use="literal"/>       </output>     </operation>   </binding>   <service name="mytestwebserviceservice">     <port name="mytestwebserviceport" binding="tns:mytestwebserviceportbinding">       <soap:address location="replace_with_actual_url"/>     </port>   </service> </definitions> 

so hope 1 of can me because i'm quite clueless do. kind regards, christian

i'm not great @ , in fact have week got web services work.

try

envelope.dotnet = true; string name = "christian"; request.addproperty("name", name); 

or

envelope.dotnet = true; propertyinfo nameprop =new propertyinfo(); nameprop.setname("name"); nameprop.settype(string.class); nameprop.setvalue(name); request.addproperty(nameprop); 

i hope solves you


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -