Поддерживает ли NetSuite Apache Axis 2.0? - PullRequest
0 голосов
/ 24 июня 2019

Я пытаюсь подключить систему NetSuite с помощью SOAP WebServices. Я использовал ось Apache 1.7.9 для создания заглушек Java из WSDL 2019.

Я пытался получить записи сотрудников, используя метод поиска, но получая исключение ниже.

Caused by: java.lang.Exception: org.apache.axis2.databinding.ADBException: Unsupported type urn:core_2019_1.platform.webservices.netsuite.com BooleanCustomFieldRef

Итак, возникает вопрос, является ли это причиной Apache Axis2. NetSuite все еще не поддерживает Apache Axis 2?

package com.org;


import java.rmi.RemoteException;

import org.apache.axis2.AxisFault;

import com.netsuite.webservices.lists.employees_2019_1.EmployeeSearch;
import com.netsuite.webservices.platform.common_2019_1.EmployeeSearchBasic;
import com.netsuite.webservices.platform.core_2019_1.Passport;
import com.netsuite.webservices.platform.core_2019_1.RecordRef;
import com.netsuite.webservices.platform.core_2019_1.SearchStringField;
import com.netsuite.webservices.platform.core_2019_1.TokenPassport;
import com.netsuite.webservices.platform.core_2019_1.TokenPassportSignature;
import com.netsuite.webservices.platform.core_2019_1.types.RecordType;
import com.netsuite.webservices.platform.core_2019_1.types.SearchStringFieldOperator;
import com.netsuite.webservices.platform.messages_2019_1.ApplicationInfo;
import com.netsuite.webservices.platform.messages_2019_1.ApplicationInfoE;
import com.netsuite.webservices.platform.messages_2019_1.Login;
import com.netsuite.webservices.platform.messages_2019_1.LoginRequest;
import com.netsuite.webservices.platform.messages_2019_1.LoginResponseE;
import com.netsuite.webservices.platform.messages_2019_1.PartnerInfo;
import com.netsuite.webservices.platform.messages_2019_1.PartnerInfoE;
import com.netsuite.webservices.platform.messages_2019_1.Search;
import com.netsuite.webservices.platform.messages_2019_1.SearchPreferences;
import com.netsuite.webservices.platform.messages_2019_1.SearchPreferencesE;
import com.netsuite.webservices.platform.messages_2019_1.SearchRequest;
import com.netsuite.webservices.platform.messages_2019_1.SearchResponseE;
import com.netsuite.webservices.platform_2019_1.ExceededConcurrentRequestLimitFault;
import com.netsuite.webservices.platform_2019_1.ExceededRecordCountFault;
import com.netsuite.webservices.platform_2019_1.ExceededRequestLimitFault;
import com.netsuite.webservices.platform_2019_1.ExceededRequestSizeFault;
import com.netsuite.webservices.platform_2019_1.ExceededUsageLimitFault;
import com.netsuite.webservices.platform_2019_1.InsufficientPermissionFault;
import com.netsuite.webservices.platform_2019_1.InvalidAccountFault;
import com.netsuite.webservices.platform_2019_1.InvalidCredentialsFault;
import com.netsuite.webservices.platform_2019_1.InvalidSessionFault;
import com.netsuite.webservices.platform_2019_1.InvalidVersionFault;
import com.netsuite.webservices.platform_2019_1.NetSuiteService;
import com.netsuite.webservices.platform_2019_1.NetSuiteServiceStub;
import com.netsuite.webservices.platform_2019_1.UnexpectedErrorFault;

public class Client {



    public static void main(String[] args) {

         Passport passport = new Passport();
         passport.setAccount("ASDfsdfsadf");
         passport.setEmail("sdfsdfdsf");
         passport.setPassword("asdfsdf");

         com.netsuite.webservices.platform.messages_2019_1.Passport passport1 = new com.netsuite.webservices.platform.messages_2019_1.Passport();
         passport1.setPassport(passport);

         ApplicationInfo appInfo = new ApplicationInfo();
         appInfo.setApplicationId("sdfdsfdsfsdf");
         ApplicationInfoE  ai = new ApplicationInfoE();
         ai.setApplicationInfo(appInfo);

         LoginRequest lr = new LoginRequest();
         lr.setPassport(passport);

         Login login = new Login();

         login.setLogin(lr);

         Search search = new Search();
         SearchRequest searchRequest= new SearchRequest();
         searchRequest.setSearchRecord(createEmployeeSearch());
         search.setSearch(searchRequest);

         com.netsuite.webservices.platform.messages_2019_1.TokenPassport token = new com.netsuite.webservices.platform.messages_2019_1.TokenPassport();
         TokenPassport tp = new TokenPassport();
         tp.setAccount("sdfsdfsdf");
         tp.setConsumerKey("dfdsfsdfsdfsdf");
         tp.setToken("Token Based Integration");
         tp.setNonce("nonce");

         TokenPassportSignature tps = new TokenPassportSignature();
         tps.setString("Suraj");
         tps.setAlgorithm("Algo");
         tp.setSignature(tps);
         token.setTokenPassport(tp);

         PartnerInfoE pre = new PartnerInfoE();
         pre.setPartnerInfo(new PartnerInfo());

         SearchPreferencesE spe = new SearchPreferencesE();
         spe.setSearchPreferences(new SearchPreferences());

        try {
            NetSuiteService ns = new NetSuiteServiceStub("https://"+passport.getAccount()+".suitetalk.api.netsuite.com/services/NetSuitePort_2019_1");
            try {
                try {
                    SearchResponseE se = ns.search(search, passport1, null, ai, pre, spe );
                    System.out.println(se.getSearchResponse().getSearchResult().getTotalRecords());
                } catch (ExceededConcurrentRequestLimitFault | ExceededRecordCountFault | ExceededRequestSizeFault
                        | ExceededUsageLimitFault e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        } catch (AxisFault e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

    private static EmployeeSearch createEmployeeSearch()
    {
        EmployeeSearchBasic employeeSearch = new EmployeeSearchBasic();
        SearchStringField emplEntityID = new SearchStringField();
        emplEntityID.setOperator(SearchStringFieldOperator.isNot);
        emplEntityID.setSearchValue("");
        employeeSearch.setEntityId(emplEntityID);

        RecordRef emplRec = new RecordRef();
        emplRec.setType(RecordType.employee);
        RecordRef[] emplRecArray = new RecordRef[1];
        emplRecArray[0] = emplRec;
        EmployeeSearch searchEmployee= new EmployeeSearch();
        searchEmployee.setBasic(employeeSearch);

        return searchEmployee;

    }

}
...