Android client: web service - what is the correct SOAP_ACTION, METHOD_NAME, NAMESPACE, URL that I should use?

if I want to use the following web service (help.be is just an example, suppose it exists): http://www.help.be/webservice/webservice_help.php (it is written in PHP = client choice, not .NET) with the following WSDL:

<?xml version="1.0" encoding="UTF-8"?>
<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/">
  <portType name="webservice_helpPortType">
    <operation name="webservice_help">
      <input message="tns:Webservice_helpRequest"/>
    </operation>
    <operation name="getLocation" parameterOrder="input">
      <input message="tns:GetLocationRequest"/>
      <output message="tns:GetLocationResponse"/>
    </operation>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           What is the correct URL for SOAP_ACTION, METHOD_NAME, NAMESPACE, which should I use below? I tried with this: public class Main extends Activity {/ ** Called when the action 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 ("checkbox") @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 "); // -> the request_location.addProperty string is required (" password "," password "); // -> the request_location.addProperty string is required (" serial "," serial "); // -> the request_location string is required. addProperty ("language", "fr"); // -> a string is required ("fr, nl, uk, de" is available) request_location.addProperty ("keyword", "Braine"); // -> a string is required // ------------------------------------------------ - ------------------------------------ SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope (SoapEnvelope.VER11); // soapEnvelope .dotNet = true; // don’t forget about it for .NET WebServices! soapEnvelope.setOutputSoapObject (request_location);AndroidHttpTransport aht = new AndroidHttpTransport (URL); try {aht.call (SOAP_ACTION_GETLOCATION, soapEnvelope); // Get the SAOP envelope and 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 ());} // ---------------------------------- -------------- ------------------------------------ -}} I'm not sure about SOAP_ACTION, METHOD_NAME, NAMESPACE, the URL I should use? Because soapAction points to a URN instead of the traditional URL, and it's PHP, not .NET ... Also, I'm not sure I need to use `request_location.addProperty (" login "," login ");` from request_location.addAttribute ("login", "login"); `? => What would you say? Txs for your help. HOUR. EDIT : This is the code that works in PHP - I just want to have the same thing, but in Android / JAVA: __getFunctions ());?>} // ----------------------------------------------- - --------------------------------------}} I'm not sure about SOAP_ACTION, METHOD_NAME, NAMESPACE URL I should use? because soapAction points to a URN instead of the traditional URL, and it's PHP, not .NET ... Also, I'm not sure if I need to use `request_location.addProperty (" login "," login ");` from request_location .addAttribute ("login", "login"); `? => What would you say? Txs for your help. HOUR. EDIT: This is the code that works in PHP - I just want to have the same thing, but in Android / JAVA: __getFunctions ()); ? >} // ----------------------------------------------- - --------------------------------------}} I'm not sure about SOAP_ACTION, METHOD_NAME, NAMESPACE URL I should use? because soapAction points to a URN instead of the traditional URL, and it's PHP, not .NET ... Also, I'm not sure if I need to use `request_location.addProperty (" login "," login ");` from request_location .addAttribute ("login", "login"); `? => What would you say? Txs for your help. HOUR. EDIT: This is the code that works in PHP - I just want to have the same thing, but in Android / JAVA: __getFunctions ()); ? >I'm not sure that I need to use `request_location.addProperty (" login "," login ");` from `request_location.addAttribute (" login "," login ");`? => What would you say? Txs for your help. HOUR. EDIT: This is the code that works in PHP - I just want to have the same thing, but in Android / JAVA: __getFunctions ()); ? >I'm not sure that I need to use `request_location.addProperty (" login "," login ");` from `request_location.addAttribute (" login "," login ");`? => What would you say? Txs for your help. HOUR. EDIT: This is the code that works in PHP - I just want to have the same thing, but in Android / JAVA: __getFunctions ()); ? >

getLocation

  

Input:

  

Result

getLocation ($ request); print_r ($ result); ? >
+3
source share
1 answer
String SOAP_ACTION = "http://tempuri.org/Add"; 
        String METHOD_NAME = "Add"; 
        String NAMESPACE = "http://tempuri.org/"; 
        String URL = "http://www.html2xml.nl/Services/Calculator/Version1/Calculator.asmx"; 

The wsdl for the above example can be found at: http://www.html2xml.nl/Services/Calculator/Version1/Calculator.asmx?WSDL

In your case, METHOD_NAME = "getStationDetail" or METHOD_NAME = "getStationList" or METHOD_NAME = "getLocation"

+4
source

Source: https://habr.com/ru/post/1743509/


All Articles