Возникла проблема при публикации запроса из нескольких частей с использованием Retrofit - PullRequest
0 голосов
/ 20 января 2020

URL-адрес работает нормально на Почтальоне - возвращает ResponseCode 200, но через приложение ResponseCode всегда 500

Retrofit / android с использованием - -

        implementation 'androidx.appcompat:appcompat:1.1.0'
        implementation 'com.squareup.retrofit2:retrofit:2.6.1'
        implementation 'com.squareup.retrofit2:converter-gson:2.6.1'

Метод запроса содержит:

MultipartBody.Builder builder = new MultipartBody.Builder().setType(MultipartBody.FORM);
builder.addFormDataPart("Name", strName)
                .addFormDataPart("Tin", strTin)
                .addFormDataPart("Description", strDesc)
                .addFormDataPart("MobileHotline", strMobile)
                .addFormDataPart("Telephone", strPhone)
                .addFormDataPart("FaxNumber", strFax)
                .addFormDataPart("Email", strEmail)
                .addFormDataPart("WebSite", strWeb)
                .addFormDataPart("DivisionName", strProvin)
                .addFormDataPart("DivisionCode", strProvinCode)
                .addFormDataPart("CityName", strCity)
                .addFormDataPart("CityCode", strCityCode)
                .addFormDataPart("LocalityName", strBaran)
                .addFormDataPart("LocalityCode", strBaraCode)
                .addFormDataPart("StreetName", strStreet)
                .addFormDataPart("BuildingNumber", strBuiltNo)
                .addFormDataPart("BuildingName", strBuildName)
                .addFormDataPart("Floor", strFloor)
                .addFormDataPart("IndustryCode", strIndusId)
                .addFormDataPart("IndustryName", strIndusName)
                .addFormDataPart("BusinessTypeCode", strBussId)
                .addFormDataPart("BusinessTypeName", strBussName)
                .addFormDataPart("ProductInterest", strProductIn)
                .addFormDataPart("LeadSourceCode", strLeadSourceCode)
                .addFormDataPart("LeadSourceName", strLeadSource)
                .addFormDataPart("ReferredByEmployeeFullName", strLoginEmp)
                .addFormDataPart("ReferredByEmployeeCode", strLoginEmpCode);

RequestBody requestBody = builder.build();

GetDataInterface service = RetrofitInstance.getRetrofitInstance("TWO").create(GetDataInterface.class);

Call<ResponseBody> call = service.postLeadCreate(requestBody);
        call.enqueue(new Callback<ResponseBody>() {
            @Override
            public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
                Constant.dismissDialog();
                Log.d("Response----", "onResponse: response code: retrofit: " + response.code());
            }

            @Override
            public void onFailure(Call<ResponseBody> call, Throwable t) {
                Log.d("Response----", "onResponse: Faliure");
            }
        });

И интерфейс API

@POST("Api/CreateLead")
    Call<ResponseBody> postLeadCreate(@Body RequestBody file);

Не удалось выяснить проблему!

...