如何解决错误? "Server did not recognize the value of HTTP Header SOAPAction"

How to solve the error? "Server did not recognize the value of HTTP Header SOAPAction"

我可以使用 Get Post 等网络服务。我可以在本地主机上毫无问题地使用它。但是,当我尝试通过 android 应用程序使用它时,我遇到了这个错误。

Web服务端需要做哪些设置?因为我在java和android这边做了很多事情,但是错误并没有消失。

错误消息:SoapFault - 错误代码:'soap:Client' 错误字符串:'System.Web.Services.Protocols.SoapException:服务器无法识别 HTTP Header SOAPAction 的值:https://api.example.com/LoginAPI.

public class YLogin extends AppCompatActivity {
 EditText yoneticieposta, yoneticiparola;
 Button yoneticiDGiris;
 String Eposta, Parola, ReturnResult;

 /*Web Service*/
 public static String URL="https://api.example.com/MCG-WS.asmx?WSDL";
 public static String NAMESPACE="https://api.example.com";

 /*Login API*/
 public static String SOAP_ACTION_LOGIN="https://api.example.com/LoginAPI";
 public static String METHOD_NAME_LOGIN="LoginAPI";

 @Override
 protected void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.ylogin);

     TrustManager[] trustAllCerts = new TrustManager[]{
             new X509TrustManager() {
                 public java.security.cert.X509Certificate[] getAcceptedIssuers() {
                     return null;
                 }
                 public void checkClientTrusted(
                         java.security.cert.X509Certificate[] certs, String authType) {
                 }
                 public void checkServerTrusted(
                         java.security.cert.X509Certificate[] certs, String authType) {
                 }
             }
     };


     try {
         SSLContext sc = SSLContext.getInstance("SSL");
         sc.init(null, trustAllCerts, new java.security.SecureRandom());
         HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
     } catch (Exception e) {
     }


     try {
         java.net.URL url = new URL("https://api.example.com/MCG-WS.asmx");
     } catch (MalformedURLException e) {
     }

     yoneticieposta = (EditText) findViewById(R.id.yoneticiepostaTx);
     yoneticiparola = (EditText) findViewById(R.id.yoneticiparolaTx);
     yoneticiDGiris = (Button) findViewById(R.id.yoneticiDGirisYapBt);
     yoneticiDGiris.setOnClickListener(new View.OnClickListener() {
         @Override
         public void onClick(View v) {
             Eposta = yoneticieposta.getText().toString();
             Parola = yoneticiparola.getText().toString();

             if(Eposta.isEmpty() || Parola.isEmpty()){
                 Toast.makeText(YLogin.this, "E-posta veya parola kısımlarını doldurun.", Toast.LENGTH_SHORT).show();
             }else{
                 new LoginAsyncTask().execute(Eposta, Parola);
             }
         }
     });
 }

 private class LoginAsyncTask extends AsyncTask<String, Void, String> {
     @Override
     protected void onPreExecute() {
         super.onPreExecute();
     }

     @Override
     protected String doInBackground(String... strings){

         SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME_LOGIN);

         PropertyInfo infoEposta = new PropertyInfo();
         infoEposta.setName("eposta");
         infoEposta.setType(String.class);
         infoEposta.setValue(strings[0].toString());
         request.addProperty(infoEposta);

         PropertyInfo infoParola = new PropertyInfo();
         infoParola.setName("parola");
         infoParola.setType(String.class);
         infoParola.setValue(strings[1].toString());
         request.addProperty(infoParola);

         SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

         envelope.dotNet =true;
         envelope.setOutputSoapObject(request);

         HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

         try {
             androidHttpTransport.call(SOAP_ACTION_LOGIN, envelope);

             SoapFault error = (SoapFault)envelope.bodyIn;
             System.out.println("TTTTTTTTTTTTTT Error message : "+error.toString());

             SoapObject result = (SoapObject)envelope.bodyIn;

             if(result!=null){
                 ReturnResult = result.getProperty(0).toString();
             }

         }
         catch(Exception e){
             e.printStackTrace();
             return e.toString();
         }

         return ReturnResult;
     }

     @Override
     protected void onPostExecute(String result) {

         if(result.equals("başarılı")){
             Intent intent = new Intent(YLogin.this, dashboard.class);
             intent.putExtra("yoneticiEposta", Eposta);
             startActivity(intent);
         }else{
             Toast.makeText(YLogin.this, "E-posta veya parolanız yanlış, tekrar deneyin.", Toast.LENGTH_SHORT).show();
         }
     }
 }

}

我更新了这部分代码。问题已解决。

 /*Web Service*/
        public static String URL="https://api.example.com/MCG-WS.asmx?WSDL";
        public static String NAMESPACE="http://tempuri.org";
    
    
        /*Login API*/
        public static String SOAP_ACTION_LOGIN="http://tempuri.org/LoginAPI";
        public static String METHOD_NAME_LOGIN="LoginAPI";


if (envelope.bodyIn instanceof SoapFault) {
                    SoapFault error = (SoapFault) envelope.bodyIn;
                    System.out.println("TTTTTTTTTTTTTT Error message : " + error.toString());
                }
                if (envelope.bodyIn instanceof SoapObject) {
                    SoapObject result = (SoapObject) envelope.bodyIn;
                    if(result!=null){
                        ReturnResult = result.getProperty(0).toString();
                    }
                }