title: Android ksoap2 namespace, url, soap_action, method value using wcf
body: <p>I am making application using wcf server. But there are some problems about ksoap2 method, url, soap_action, method.</p>
  
  
  
  <pre><code>-&lt;wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:tns="http://tempuri.org/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://tempuri.org/" name="ProductService"&gt;
  
  
  -&lt;wsdl:types&gt;
  
  
  -&lt;xsd:schema targetNamespace="http://tempuri.org/Imports"&gt;
  
  &lt;xsd:import namespace="http://tempuri.org/" schemaLocation="http://localhost:8000/ProductService?xsd=xsd0"/&gt;
  
  &lt;xsd:import namespace="http://schemas.microsoft.com/2003/10/Serialization/" schemaLocation="http://localhost:8000/ProductService?xsd=xsd1"/&gt;
  
  &lt;/xsd:schema&gt;
  
  &lt;/wsdl:types&gt;
  
  
  -&lt;wsdl:message name="IProductService_GetFirstName_InputMessage"&gt;
  
  &lt;wsdl:part name="parameters" element="tns:GetFirstName"/&gt;
  
  &lt;/wsdl:message&gt;
  
  
  -&lt;wsdl:message name="IProductService_GetFirstName_OutputMessage"&gt;
  
  &lt;wsdl:part name="parameters" element="tns:GetFirstNameResponse"/&gt;
  
  &lt;/wsdl:message&gt;
  
  
  -&lt;wsdl:portType name="IProductService"&gt;
  
  
  -&lt;wsdl:operation name="GetFirstName"&gt;
  
  &lt;wsdl:input message="tns:IProductService_GetFirstName_InputMessage" wsaw:Action="http://tempuri.org/IProductService/GetFirstName"/&gt;
  
  &lt;wsdl:output message="tns:IProductService_GetFirstName_OutputMessage" wsaw:Action="http://tempuri.org/IProductService/GetFirstNameResponse"/&gt;
  
  &lt;/wsdl:operation&gt;
  
  &lt;/wsdl:portType&gt;
  
  
  -&lt;wsdl:binding name="BasicHttpBinding_IProductService" type="tns:IProductService"&gt;
  
  &lt;soap:binding transport="http://schemas.xmlsoap.org/soap/http"/&gt;
  
  
  -&lt;wsdl:operation name="GetFirstName"&gt;
  
  &lt;soap:operation style="document" soapAction="http://tempuri.org/IProductService/GetFirstName"/&gt;
  
  
  -&lt;wsdl:input&gt;
  
  &lt;soap:body use="literal"/&gt;
  
  &lt;/wsdl:input&gt;
  
  
  -&lt;wsdl:output&gt;
  
  &lt;soap:body use="literal"/&gt;
  
  &lt;/wsdl:output&gt;
  
  &lt;/wsdl:operation&gt;
  
  &lt;/wsdl:binding&gt;
  
  
  -&lt;wsdl:service name="ProductService"&gt;
  
  
  -&lt;wsdl:port name="BasicHttpBinding_IProductService" binding="tns:BasicHttpBinding_IProductService"&gt;
  
  &lt;soap:address location="http://localhost:8000/ProductService"/&gt;
  
  &lt;/wsdl:port&gt;
  
  &lt;/wsdl:service&gt;
  
  &lt;/wsdl:definitions&gt;
  </code></pre>
  
  <p>this is my wsdl web page.</p>
  
  <p>I thought my ksoap2 variables are   </p>
  
  <pre><code>private final String NAMESPACE = "http:/tempuri.org/";  
  private final String URL = "http://10.118.52.133:8000/ProductService.asmx";
  private final String SOAP_ACTION = "http://tempuri.org/GetFirstName";  
  private final String METHOD_NAME = "GetFirstName";  
  </code></pre>
  
  <p>Maybe it is wrong because there was no result in my app.</p>
  
  <p>Although I already go over similar questions, I can't figure out answer.</p>
  
  <p>So anybody help me.</p>
  
  <p>Thanks.</p>
  
  <p>add my full code</p>
  
  <pre><code>package com.axis.soapaccess;   
  
  import org.ksoap2.SoapEnvelope; 
  import org.ksoap2.serialization.SoapObject; 
  import org.ksoap2.serialization.SoapPrimitive; 
  import org.ksoap2.serialization.SoapSerializationEnvelope; 
  import org.ksoap2.transport.HttpTransportSE;   
  import android.os.Bundle; 
  import android.os.Handler; 
  import android.app.Activity; 
  import android.view.Menu; 
  import android.widget.TextView;   
  
  public class MainActivity extends Activity 
  {     
      //change following variables according to the WSDL  
      private final String NAMESPACE = "http://tempuri.org/";  
      private final String URL = "http://10.118.52.133:8000/ProductService?wsdl";
      private final String SOAP_ACTION = "http://tempuri.org/GetFirstName";  
      private final String METHOD_NAME = "GetFirstName";    
      private String Webresponse = "";  
      private TextView textView;  
      private Thread thread;  
      private Handler handler = new Handler();    
  
  @Override protected void onCreate(Bundle savedInstanceState) 
  {   
      super.onCreate(savedInstanceState);   
      setContentView(R.layout.activity_main);   
      textView = (TextView) findViewById(R.id.textView1);   
      webAccess();  
  }        
  
  public void webAccess()
  {   
      thread = new Thread(){    
          public void run(){     
              try{       
                  SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);           
                  SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); 
                  envelope.dotNet = true;          
                  envelope.setOutputSoapObject(request);          
                  HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);        
                  androidHttpTransport.call(SOAP_ACTION, envelope);      ***// Error was caused by this line. Null exception***          
                  SoapPrimitive response = (SoapPrimitive)envelope.getResponse();             
                  Webresponse = response.toString();     
                  }           
              catch(Exception e){      
                  e.printStackTrace();     
                  }           
  
              handler.post(createUI);    
              }   
          };       
  
          thread.start();  
  }        
  
  final Runnable createUI = new Runnable() {   
      public void run(){   
          textView.setText(Webresponse);  
          }  
      };     
  
      @Override public boolean onCreateOptionsMenu(Menu menu) 
      {   // Inflate the menu; this adds items to the action bar if it is present.   
          getMenuInflater().inflate(R.menu.main, menu);   return true;  
      }   
  </code></pre>
  
  <p>}</p>
  
  <p>It is still now work. 
  When I debug this line(androidHttpTransport.call(SOAP_ACTION, envelope);</p>
  
  <p>values are </p>
  
  <pre><code>connection=null
  debug=false
  proxy=null
  requestDump=null
  responesDump=null
  timeout=20000
  url="http://10.118.52.133:8000/ProductService.asmx" (id=830046061280)
  xmlVersionTag=""(id=830028910544)
  
  org.ksoap2.transport.HttpTransportSE@429eaf68
  </code></pre>