Search in sources :

Example 1 with InvalidSessionFault

use of com.netsuite.webservices.v2016_2.platform.InvalidSessionFault in project components by Talend.

the class NetSuitePortTypeMockAdapterImpl method getCustomizationId.

public GetCustomizationIdResponse getCustomizationId(GetCustomizationIdRequest parameters) throws InvalidSessionFault, ExceededUsageLimitFault, UnexpectedErrorFault, ExceededRequestLimitFault, ExceededRequestSizeFault, ExceededConcurrentRequestLimitFault, InvalidCredentialsFault, InsufficientPermissionFault, ExceededRecordCountFault {
    GetCustomizationIdResponse response = null;
    if (port != null) {
        response = port.getCustomizationId(parameters);
    }
    if (response == null) {
        response = new GetCustomizationIdResponse();
        GetCustomizationIdResult result = new GetCustomizationIdResult();
        result.setStatus(createSuccessStatus());
        result.setTotalRecords(0);
        result.setCustomizationRefList(new CustomizationRefList());
        response.setGetCustomizationIdResult(result);
    }
    return response;
}
Also used : CustomizationRefList(com.netsuite.webservices.v2016_2.platform.core.CustomizationRefList) GetCustomizationIdResponse(com.netsuite.webservices.v2016_2.platform.messages.GetCustomizationIdResponse) GetCustomizationIdResult(com.netsuite.webservices.v2016_2.platform.core.GetCustomizationIdResult)

Example 2 with InvalidSessionFault

use of com.netsuite.webservices.v2016_2.platform.InvalidSessionFault in project components by Talend.

the class NetSuitePortTypeMockAdapterImpl method getList.

public GetListResponse getList(GetListRequest parameters) throws InvalidSessionFault, ExceededUsageLimitFault, UnexpectedErrorFault, ExceededRequestLimitFault, ExceededRequestSizeFault, ExceededConcurrentRequestLimitFault, InvalidCredentialsFault, InsufficientPermissionFault, ExceededRecordCountFault {
    GetListResponse response = null;
    if (port != null) {
        response = port.getList(parameters);
    }
    if (response == null) {
        response = new GetListResponse();
        ReadResponseList readResponseList = new ReadResponseList();
        readResponseList.setStatus(createSuccessStatus());
        response.setReadResponseList(readResponseList);
    }
    return response;
}
Also used : GetListResponse(com.netsuite.webservices.v2016_2.platform.messages.GetListResponse) ReadResponseList(com.netsuite.webservices.v2016_2.platform.messages.ReadResponseList)

Example 3 with InvalidSessionFault

use of com.netsuite.webservices.v2016_2.platform.InvalidSessionFault in project components by Talend.

the class NetSuitePortTypeMockAdapterImpl method getDataCenterUrls.

public GetDataCenterUrlsResponse getDataCenterUrls(GetDataCenterUrlsRequest parameters) throws InvalidSessionFault, UnexpectedErrorFault, InsufficientPermissionFault, InvalidCredentialsFault, ExceededRequestSizeFault {
    GetDataCenterUrlsResponse response = null;
    if (port != null) {
        response = port.getDataCenterUrls(parameters);
    }
    if (response == null) {
        response = new GetDataCenterUrlsResponse();
        GetDataCenterUrlsResult result = new GetDataCenterUrlsResult();
        Status status = new Status();
        status.setIsSuccess(true);
        result.setStatus(status);
        DataCenterUrls urls = new DataCenterUrls();
        urls.setWebservicesDomain(endpointAddress.toString());
        urls.setSystemDomain(endpointAddress.toString());
        result.setDataCenterUrls(urls);
        response.setGetDataCenterUrlsResult(result);
        return response;
    }
    return response;
}
Also used : Status(com.netsuite.webservices.v2016_2.platform.core.Status) GetDataCenterUrlsResponse(com.netsuite.webservices.v2016_2.platform.messages.GetDataCenterUrlsResponse) DataCenterUrls(com.netsuite.webservices.v2016_2.platform.core.DataCenterUrls) GetDataCenterUrlsResult(com.netsuite.webservices.v2016_2.platform.core.GetDataCenterUrlsResult)

Example 4 with InvalidSessionFault

use of com.netsuite.webservices.v2016_2.platform.InvalidSessionFault in project components by Talend.

the class NetSuiteClientServiceImpl method getNetSuitePort.

protected NetSuitePortType getNetSuitePort(String defaultEndpointUrl, String account) throws NetSuiteException {
    try {
        URL wsdlLocationUrl = this.getClass().getResource("/wsdl/2016.2/netsuite.wsdl");
        NetSuiteService service = new NetSuiteService(wsdlLocationUrl, NetSuiteService.SERVICE);
        List<WebServiceFeature> features = new ArrayList<>(2);
        if (isMessageLoggingEnabled()) {
            features.add(new LoggingFeature());
        }
        NetSuitePortType port = service.getNetSuitePort(features.toArray(new WebServiceFeature[features.size()]));
        BindingProvider provider = (BindingProvider) port;
        Map<String, Object> requestContext = provider.getRequestContext();
        requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, defaultEndpointUrl);
        GetDataCenterUrlsRequest dataCenterRequest = new GetDataCenterUrlsRequest();
        dataCenterRequest.setAccount(account);
        DataCenterUrls urls = null;
        GetDataCenterUrlsResponse response = port.getDataCenterUrls(dataCenterRequest);
        if (response != null && response.getGetDataCenterUrlsResult() != null) {
            urls = response.getGetDataCenterUrlsResult().getDataCenterUrls();
        }
        if (urls == null) {
            throw new NetSuiteException(new NetSuiteErrorCode(NetSuiteErrorCode.CLIENT_ERROR), NetSuiteRuntimeI18n.MESSAGES.getMessage("error.couldNotGetWebServiceDomain", defaultEndpointUrl));
        }
        String wsDomain = urls.getWebservicesDomain();
        String endpointUrl = wsDomain.concat(new URL(defaultEndpointUrl).getPath());
        requestContext.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);
        requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointUrl);
        return port;
    } catch (WebServiceException | MalformedURLException | InsufficientPermissionFault | InvalidCredentialsFault | InvalidSessionFault | UnexpectedErrorFault | ExceededRequestSizeFault e) {
        throw new NetSuiteException(new NetSuiteErrorCode(NetSuiteErrorCode.CLIENT_ERROR), NetSuiteRuntimeI18n.MESSAGES.getMessage("error.failedToInitClient", e.getLocalizedMessage()), e);
    }
}
Also used : InsufficientPermissionFault(com.netsuite.webservices.v2016_2.platform.InsufficientPermissionFault) InvalidCredentialsFault(com.netsuite.webservices.v2016_2.platform.InvalidCredentialsFault) MalformedURLException(java.net.MalformedURLException) WebServiceException(javax.xml.ws.WebServiceException) GetDataCenterUrlsResponse(com.netsuite.webservices.v2016_2.platform.messages.GetDataCenterUrlsResponse) ArrayList(java.util.ArrayList) DataCenterUrls(com.netsuite.webservices.v2016_2.platform.core.DataCenterUrls) NetSuiteException(org.talend.components.netsuite.client.NetSuiteException) UnexpectedErrorFault(com.netsuite.webservices.v2016_2.platform.UnexpectedErrorFault) BindingProvider(javax.xml.ws.BindingProvider) InvalidSessionFault(com.netsuite.webservices.v2016_2.platform.InvalidSessionFault) URL(java.net.URL) NetSuitePortType(com.netsuite.webservices.v2016_2.platform.NetSuitePortType) NetSuiteErrorCode(org.talend.components.netsuite.NetSuiteErrorCode) NetSuiteService(com.netsuite.webservices.v2016_2.platform.NetSuiteService) LoggingFeature(org.apache.cxf.feature.LoggingFeature) WebServiceFeature(javax.xml.ws.WebServiceFeature) GetDataCenterUrlsRequest(com.netsuite.webservices.v2016_2.platform.messages.GetDataCenterUrlsRequest) ExceededRequestSizeFault(com.netsuite.webservices.v2016_2.platform.ExceededRequestSizeFault)

Aggregations

DataCenterUrls (com.netsuite.webservices.v2016_2.platform.core.DataCenterUrls)2 GetDataCenterUrlsResponse (com.netsuite.webservices.v2016_2.platform.messages.GetDataCenterUrlsResponse)2 ExceededRequestSizeFault (com.netsuite.webservices.v2016_2.platform.ExceededRequestSizeFault)1 InsufficientPermissionFault (com.netsuite.webservices.v2016_2.platform.InsufficientPermissionFault)1 InvalidCredentialsFault (com.netsuite.webservices.v2016_2.platform.InvalidCredentialsFault)1 InvalidSessionFault (com.netsuite.webservices.v2016_2.platform.InvalidSessionFault)1 NetSuitePortType (com.netsuite.webservices.v2016_2.platform.NetSuitePortType)1 NetSuiteService (com.netsuite.webservices.v2016_2.platform.NetSuiteService)1 UnexpectedErrorFault (com.netsuite.webservices.v2016_2.platform.UnexpectedErrorFault)1 CustomizationRefList (com.netsuite.webservices.v2016_2.platform.core.CustomizationRefList)1 GetCustomizationIdResult (com.netsuite.webservices.v2016_2.platform.core.GetCustomizationIdResult)1 GetDataCenterUrlsResult (com.netsuite.webservices.v2016_2.platform.core.GetDataCenterUrlsResult)1 Status (com.netsuite.webservices.v2016_2.platform.core.Status)1 GetCustomizationIdResponse (com.netsuite.webservices.v2016_2.platform.messages.GetCustomizationIdResponse)1 GetDataCenterUrlsRequest (com.netsuite.webservices.v2016_2.platform.messages.GetDataCenterUrlsRequest)1 GetListResponse (com.netsuite.webservices.v2016_2.platform.messages.GetListResponse)1 ReadResponseList (com.netsuite.webservices.v2016_2.platform.messages.ReadResponseList)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1