1. Are you ready for the Galaxy S20? Here is everything we know so far!

SOAP with Java: Server did not recognize the value of HTTP Header SOAPAction

Discussion in 'Android Development' started by ulaskayalar, Aug 11, 2021.

  1. ulaskayalar

    ulaskayalar Lurker
    Thread Starter

    Code (Java):
    1.  EditText yoneticieposta, yoneticiparola;
    2.     Button yoneticiDGiris;
    3.     String Eposta, Parola, ReturnResult;
    4.  
    5.     /*Web Service*/
    6.     public static String URL="https://com/MCG-WS.asmx?WSDL";
    7.     public static String NAMESPACE="https://com";
    8.  
    9.     /*Login API*/
    10.     public static String SOAP_ACTION_LOGIN="https://com/LoginAPI";
    11.     public static String METHOD_NAME_LOGIN="LoginAPI";
    12.  
    13.     @Override
    14.     protected void onCreate(Bundle savedInstanceState) {
    15.         super.onCreate(savedInstanceState);
    16.         setContentView(R.layout.ylogin);
    17.  
    18.  
    19.         yoneticieposta = (EditText) findViewById(R.id.yoneticiepostaTx);
    20.         yoneticiparola = (EditText) findViewById(R.id.yoneticiparolaTx);
    21.         yoneticiDGiris = (Button) findViewById(R.id.yoneticiDGirisYapBt);
    22.         yoneticiDGiris.setOnClickListener(new View.OnClickListener() {
    23.             @Override
    24.             public void onClick(View v) {
    25.                 Eposta = yoneticieposta.getText().toString();
    26.                 Parola = yoneticiparola.getText().toString();
    27.  
    28.                 if(Eposta.isEmpty() || Parola.isEmpty()){
    29.                     Toast.makeText(YLogin.this, "E-posta veya parola kısımlarını doldurun.", Toast.LENGTH_SHORT).show();
    30.                 }else{
    31.                     new LoginAsyncTask().execute(Eposta, Parola);
    32.                 }
    33.             }
    34.         });
    35.     }
    36.  
    37.     private class LoginAsyncTask extends AsyncTask<String, Void, String> {
    38.         @Override
    39.         protected void onPreExecute() {
    40.             super.onPreExecute();
    41.         }
    42.  
    43.         @Override
    44.         protected String doInBackground(String... strings){
    45.  
    46.             SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME_LOGIN);
    47.  
    48.             PropertyInfo infoEposta = new PropertyInfo();
    49.             infoEposta.setName("eposta");
    50.             infoEposta.setType(String.class);
    51.             infoEposta.setValue(strings[0].toString());
    52.             request.addProperty(infoEposta);
    53.  
    54.             PropertyInfo infoParola = new PropertyInfo();
    55.             infoParola.setName("parola");
    56.             infoParola.setType(String.class);
    57.             infoParola.setValue(strings[1].toString());
    58.             request.addProperty(infoParola);
    59.  
    60.             SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    61.  
    62.             envelope.dotNet =true;
    63.             envelope.setOutputSoapObject(request);
    64.  
    65.             HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
    66.  
    67.             try {
    68.                 androidHttpTransport.call(SOAP_ACTION_LOGIN, envelope);
    69.  
    70.                 SoapFault error = (SoapFault)envelope.bodyIn;
    71.                 System.out.println("TTTTTTTTTTTTTT Error message : "+error.toString());
    72.  
    73.                 SoapObject result = (SoapObject)envelope.bodyIn;
    74.  
    75.                 if(result!=null){
    76.                     ReturnResult = result.getProperty(0).toString();
    77.                 }
    78.  
    79.             }
    80.             catch(Exception e){
    81.                 e.printStackTrace();
    82.                 return e.toString();
    83.             }
    84.  
    85.             return ReturnResult;
    86.         }
    87.  
    88.         @Override
    89.         protected void onPostExecute(String result) {
    90.  
    91.             if(result.equals("başarılı")){
    92.                 Intent intent = new Intent(YLogin.this, dashboard.class);
    93.                 intent.putExtra("yoneticiEposta", Eposta);
    94.                 startActivity(intent);
    95.             }else{
    96.                 Toast.makeText(YLogin.this, "E-posta veya parolanız yanlış, tekrar deneyin.", Toast.LENGTH_SHORT).show();
    97.             }
    98.         }
    99.     }
    Error message : SoapFault - faultcode: 'soap:Client' faultstring: 'Server did not recognize the value of HTTP Header SOAPAction: .' faultactor: 'null' detail: org.kxml2.kdom.Node@ab2eee9

    System.err: java.lang.ClassCastException: org.ksoap2.SoapFault cannot be cast to org.ksoap2.serialization.SoapObject at com.medcongozetim.app.YLogin$LoginAsyncTask.doInBackground(YLogin.java:92)
     


    #1 ulaskayalar, Aug 11, 2021
    Last edited: Aug 11, 2021

    1. Download the Forums for Android™ app!


      Download

       
Loading...
Similar Threads - SOAP Java Server
  1. unet
    Replies:
    0
    Views:
    292
  2. Philip1982
    Replies:
    0
    Views:
    346
  3. Emir Sanchez
    Replies:
    1
    Views:
    678
  4. Zied Orabi
    Replies:
    0
    Views:
    814
  5. DonaldDuck313
    Replies:
    0
    Views:
    704
  6. Francesco10
    Replies:
    0
    Views:
    591
  7. Frederik Frandsen
    Replies:
    0
    Views:
    961
  8. rowlanda38
    Replies:
    0
    Views:
    431
  9. Anand Suthar
    Replies:
    1
    Views:
    1,290
  10. tekir90
    Replies:
    0
    Views:
    1,374

Share This Page

Loading...