Search in sources :

Example 1 with ExecuteResponse

use of com.microsoft.schemas.xrm._2011.contracts.discovery.ExecuteResponseDocument.ExecuteResponse in project tdi-studio-se by Talend.

the class MSCRMClient method discoverOrganizationUrl.

private static String discoverOrganizationUrl(DiscoveryServiceStub serviceStub, String organizationUniqueName) throws RemoteException, IDiscoveryService_Execute_DiscoveryServiceFaultFault_FaultMessage {
    try {
        RetrieveOrganizationRequest request = RetrieveOrganizationRequest.Factory.newInstance();
        request.setUniqueName(organizationUniqueName);
        Execute exe = Execute.Factory.newInstance();
        exe.setRequest(request);
        ExecuteDocument exeDoc = ExecuteDocument.Factory.newInstance();
        exeDoc.setExecute(exe);
        ExecuteResponseDocument executeRespDoc = serviceStub.execute(exeDoc);
        ExecuteResponse executeResp = executeRespDoc.getExecuteResponse();
        RetrieveOrganizationResponse result = (RetrieveOrganizationResponse) executeResp.getExecuteResult();
        OrganizationDetail orgDetail = result.getDetail();
        KeyValuePairOfEndpointTypestringztYlk6OT[] keyValuePairs = orgDetail.getEndpoints().getKeyValuePairOfEndpointTypestringztYlk6OTArray();
        for (KeyValuePairOfEndpointTypestringztYlk6OT keyValuePair : keyValuePairs) {
            if (keyValuePair.getKey() == EndpointType.ORGANIZATION_SERVICE) {
                return keyValuePair.getValue();
            }
        }
    } catch (RemoteException e) {
        logger.error(e.getMessage());
        throw e;
    } catch (IDiscoveryService_Execute_DiscoveryServiceFaultFault_FaultMessage e) {
        logger.error(e.getMessage());
        throw e;
    }
    return null;
}
Also used : KeyValuePairOfEndpointTypestringztYlk6OT(org.datacontract.schemas._2004._07.system_collections_generic.KeyValuePairOfEndpointTypestringztYlk6OT) ExecuteDocument(com.microsoft.schemas.xrm._2011.contracts.discovery.ExecuteDocument) Execute(com.microsoft.schemas.xrm._2011.contracts.discovery.ExecuteDocument.Execute) ExecuteResponseDocument(com.microsoft.schemas.xrm._2011.contracts.discovery.ExecuteResponseDocument) ExecuteResponse(com.microsoft.schemas.xrm._2011.contracts.discovery.ExecuteResponseDocument.ExecuteResponse) OrganizationDetail(com.microsoft.schemas.xrm._2011.contracts.discovery.OrganizationDetail) RetrieveOrganizationRequest(com.microsoft.schemas.xrm._2011.contracts.discovery.RetrieveOrganizationRequest) RemoteException(java.rmi.RemoteException) IDiscoveryService_Execute_DiscoveryServiceFaultFault_FaultMessage(com.microsoft.schemas.xrm._2011.contracts.IDiscoveryService_Execute_DiscoveryServiceFaultFault_FaultMessage) RetrieveOrganizationResponse(com.microsoft.schemas.xrm._2011.contracts.discovery.RetrieveOrganizationResponse)

Aggregations

IDiscoveryService_Execute_DiscoveryServiceFaultFault_FaultMessage (com.microsoft.schemas.xrm._2011.contracts.IDiscoveryService_Execute_DiscoveryServiceFaultFault_FaultMessage)1 ExecuteDocument (com.microsoft.schemas.xrm._2011.contracts.discovery.ExecuteDocument)1 Execute (com.microsoft.schemas.xrm._2011.contracts.discovery.ExecuteDocument.Execute)1 ExecuteResponseDocument (com.microsoft.schemas.xrm._2011.contracts.discovery.ExecuteResponseDocument)1 ExecuteResponse (com.microsoft.schemas.xrm._2011.contracts.discovery.ExecuteResponseDocument.ExecuteResponse)1 OrganizationDetail (com.microsoft.schemas.xrm._2011.contracts.discovery.OrganizationDetail)1 RetrieveOrganizationRequest (com.microsoft.schemas.xrm._2011.contracts.discovery.RetrieveOrganizationRequest)1 RetrieveOrganizationResponse (com.microsoft.schemas.xrm._2011.contracts.discovery.RetrieveOrganizationResponse)1 RemoteException (java.rmi.RemoteException)1 KeyValuePairOfEndpointTypestringztYlk6OT (org.datacontract.schemas._2004._07.system_collections_generic.KeyValuePairOfEndpointTypestringztYlk6OT)1