title: Android Client : Web service - what's the correct SOAP_ACTION, METHOD_NAME, NAMESPACE, URL I should use?
body: <p>if I want to use the following Web service (help.be is just an example, let's say it does exist): <a href="http://www.help.be/webservice/webservice_help.php" rel="nofollow noreferrer">http://www.help.be/webservice/webservice_help.php</a> (it's written in PHP=client's choice, not .NET) with the following WSDL :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;definitions xmlns="http://schemas.xmlsoap.org/wsdl/" name="webservice_help" targetNamespace="http://www.help.be/webservice/webservice_help.php" xmlns:tns="http://www.help.be/webservice/webservice_help.php" xmlns:impl="http://www.help.be/webservice/webservice_help.php" xmlns:xsd1="http://www.help.be/webservice/webservice_help.php" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"&gt;
    &lt;portType name="webservice_helpPortType"&gt;
      &lt;operation name="webservice_help"&gt;
          &lt;input message="tns:Webservice_helpRequest"/&gt;
      &lt;/operation&gt;
      &lt;operation name="getLocation" parameterOrder="input"&gt;
          &lt;input message="tns:GetLocationRequest"/&gt;
          &lt;output message="tns:GetLocationResponse"/&gt;
      &lt;/operation&gt;
  
  
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;definitions xmlns="http://schemas.xmlsoap.org/wsdl/" name="webservice_help" targetNamespace="http://www.help.be/webservice/webservice_help.php" xmlns:tns="http://www.help.be/webservice/webservice_help.php" xmlns:impl="http://www.help.be/webservice/webservice_help.php" xmlns:xsd1="http://www.help.be/webservice/webservice_help.php" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"&gt;
      &lt;portType name="webservice_helpPortType"&gt;
          &lt;operation name="webservice_help"&gt;
              &lt;input message="tns:Webservice_helpRequest"/&gt;
          &lt;/operation&gt;
          &lt;operation name="getLocation" parameterOrder="input"&gt;
              &lt;input message="tns:GetLocationRequest"/&gt;
              &lt;output message="tns:GetLocationResponse"/&gt;
          &lt;/operation&gt;
  
          &lt;operation name="getStationDetail" parameterOrder="input"&gt;
              &lt;input message="tns:GetStationDetailRequest"/&gt;
              &lt;output message="tns:GetStationDetailResponse"/&gt;
          &lt;/operation&gt;
          &lt;operation name="getStationList" parameterOrder="input"&gt;
              &lt;input message="tns:GetStationListRequest"/&gt;
              &lt;output message="tns:GetStationListResponse"/&gt;
          &lt;/operation&gt;
      &lt;/portType&gt;
  
      &lt;binding name="webservice_helpBinding" type="tns:webservice_helpPortType"&gt;
          &lt;soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/&gt;
          &lt;operation name="webservice_help"&gt;
              &lt;soap:operation soapAction="urn:webservice_help#webservice_helpServer#webservice_help"/&gt;
              &lt;input&gt;
                  &lt;soap:body use="encoded" namespace="http://www.help.be/webservice/webservice_help.php" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/&gt;
              &lt;/input&gt;
          &lt;/operation&gt;
          &lt;operation name="getLocation"&gt;
              &lt;soap:operation soapAction="urn:webservice_help#webservice_helpServer#getLocation"/&gt;
              &lt;input&gt;
                  &lt;soap:body parts="input" use="encoded" namespace="http://www.help.be/webservice/webservice_help.php" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/&gt;
              &lt;/input&gt;
              &lt;output&gt;
                  &lt;soap:body parts="return" use="encoded" namespace="http://www.help.be/webservice/webservice_help.php" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/&gt;
              &lt;/output&gt;
          &lt;/operation&gt;
          &lt;operation name="getStationDetail"&gt;
              &lt;soap:operation soapAction="urn:webservice_help#webservice_helpServer#getStationDetail"/&gt;
              &lt;input&gt;
                  &lt;soap:body parts="input" use="encoded" namespace="http://www.help.be/webservice/webservice_help.php" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/&gt;
              &lt;/input&gt;
              &lt;output&gt;
                  &lt;soap:body parts="return" use="encoded" namespace="http://www.help.be/webservice/webservice_help.php" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/&gt;
              &lt;/output&gt;
          &lt;/operation&gt;
          &lt;operation name="getStationList"&gt;
              &lt;soap:operation soapAction="urn:webservice_help#webservice_helpServer#getStationList"/&gt;
              &lt;input&gt;
                  &lt;soap:body parts="input" use="encoded" namespace="http://www.help.be/webservice/webservice_help.php" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/&gt;
              &lt;/input&gt;
              &lt;output&gt;
                  &lt;soap:body parts="return" use="encoded" namespace="http://www.help.be/webservice/webservice_help.php" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/&gt;
              &lt;/output&gt;
          &lt;/operation&gt;
      &lt;/binding&gt;
  
      &lt;message name="Webservice_helpRequest"/&gt;
      &lt;message name="GetLocationRequest"&gt;
          &lt;part name="input" type="xsd:array"/&gt;
      &lt;/message&gt;
      &lt;message name="GetLocationResponse"&gt;
          &lt;part name="return" type="xsd:array"/&gt;
      &lt;/message&gt;
      &lt;message name="GetStationDetailRequest"&gt;
          &lt;part name="input" type="xsd:array"/&gt;
  
      &lt;/message&gt;
      &lt;message name="GetStationDetailResponse"&gt;
          &lt;part name="return" type="xsd:string"/&gt;
      &lt;/message&gt;
      &lt;message name="GetStationListRequest"&gt;
          &lt;part name="input" type="xsd:array"/&gt;
      &lt;/message&gt;
      &lt;message name="GetStationListResponse"&gt;
          &lt;part name="return" type="xsd:string"/&gt;
  
      &lt;/message&gt;
      &lt;service name="webservice_helpService"&gt;
          &lt;port name="webservice_helpPort" binding="tns:webservice_helpBinding"&gt;
              &lt;soap:address location="http://www.help.be/webservice/webservice_help.php"/&gt;
          &lt;/port&gt;
      &lt;/service&gt;
  &lt;/definitions&gt;
  </code></pre>
  
  <p>What is the correct <code>SOAP_ACTION, METHOD_NAME, NAMESPACE, URL</code>, I should use below ?</p>
  
  <p>I've tried with this :</p>
  
  <pre><code>public class Main extends Activity {
      /** Called when the activity is first created. */
  
      private static final String SOAP_ACTION_GETLOCATION = "getLocation";
      private static final String METHOD_NAME_GETLOCATION = "getLocation";            
      private static final String NAMESPACE = "http://www.help.be/webservice/";
      private static final String URL = "http://www.help.be/webservice/webservice_help.php";
  
      TextView tv;
  
      @SuppressWarnings("unchecked")
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          tv = (TextView)findViewById(R.id.TextView01);
  
          // --------------------------------------------------------------------------------------
          SoapObject request_location = new SoapObject(NAMESPACE, METHOD_NAME_GETLOCATION);       
          request_location.addProperty("login", "login");         // -&gt; string required 
          request_location.addProperty("password", "password");   // -&gt; string required
          request_location.addProperty("serial", "serial");       // -&gt; string required
          request_location.addProperty("language", "fr");         // -&gt; string required (available « fr,nl,uk,de ») 
          request_location.addProperty("keyword", "Braine");      // -&gt; string required
  
          // --------------------------------------------------------------------------------------
  
          SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
          //soapEnvelope.dotNet = true;                           // don't forget it for .NET WebServices !
          soapEnvelope.setOutputSoapObject(request_location);
  
  
          AndroidHttpTransport aht = new AndroidHttpTransport(URL);
  
          try { 
              aht.call(SOAP_ACTION_GETLOCATION, soapEnvelope); 
  
              // Get the SAOP Envelope back and then extract the body 
              SoapObject resultsRequestSOAP = (SoapObject) soapEnvelope.bodyIn; 
  
              Vector XXXX = (Vector) resultsRequestSOAP.getProperty("GetLocationResponse"); 
  
              int vector_size = XXXX.size(); 
              Log.i("Hub", "testat="+vector_size);
  
              tv.setText("OK");  
  
          } catch(Exception E) { 
              tv.setText("ERROR:" + E.getClass().getName() + ": " + E.getMessage());
              Log.i("Hub", "Exception E");
              Log.i("Hub", "E.getClass().getName()="+E.getClass().getName()); 
              Log.i("Hub", "E.getMessage()="+E.getMessage()); 
          } 
          // --------------------------------------------------------------------------------------
      }
  }
  </code></pre>
  
  <p>I'm not sure of the SOAP_ACTION, METHOD_NAME, NAMESPACE, URL I have to use? because soapAction is pointing to a URN instead of a traditional URL and it's PHP and not .NET ...</p>
  
  <p>also, I'm not sure if I have to use  <code>request_location.addProperty("login", "login");</code><br>
  of <code>request_location.addAttribute("login", "login");</code> ?</p>
  
  <p>=> </p>
  
  <pre><code>&lt;message name="GetLocationRequest"&gt;
  &lt;part name="input" type="xsd:array"/&gt;
  </code></pre>
  
  <p></p>
  
  <p>What would you say ?</p>
  
  <p>Txs for your help.</p>
  
  <p>H.</p>
  
  <p>EDIT : Here is some code working in PHP - I simply want to have the same but in Android/JAVA :</p>
  
  <pre><code>&lt;?php
      ini_set("soap.wsdl_cache_enabled", "0"); // disabling WSDL cache 
  
      $request['login'] = 'login';
      $request['password'] = 'password';
      $request['serial'] = 'serial';
      $request['language'] = 'fr';
  
        $client= new SoapClient("http://www.test.be/webservice/webservice_test.wsdl");    
  
      print_r( $client-&gt;__getFunctions());
  
      ?&gt;&lt;hr&gt;&lt;h1&gt;getLocation&lt;/h1&gt;
      &lt;h2&gt;Input:&lt;/h2&gt;
      &lt;?
      $request['keyword'] = 'Bruxelles';
      print_r($request);
      ?&gt;&lt;h2&gt;Result&lt;/h2&gt;&lt;?
       $result = $client-&gt;getLocation($request);
       print_r($result);   
  ?&gt;
  </code></pre>