9

Java で記述されたクライアントを使用して Microsoft CRM オンプレミス Web サービスにアクセスするための基本的な手順を示すオンライン リソースはありますか?

どの Web サービス ツールキットを使用すればよいですか?

JAXB で試してみましたが、クラスのカスタマイズが必要な WSDL 要素の命名に競合があります。正しいバインディングの修正が見つかったら、ここに投稿します。

4

4 に答える 4

8

オンプレミス バージョンの Microsoft Dynamics CRM アプリケーションは、Active Directory 認証を使用します。Microsoft Dynamics CRM Web サービスを Java から参照しようとしたことはありませんが、実行可能であると確信しています。これらは標準の Web サービスであり、他の Web サービスと同様に SOAP を介して Java から参照できるからです。

public class TestCRM {  

private static String endpointURL = "http://server:port/MSCrmServices/2007/CrmService.asmx";  
private static String userName = "username";  
private static String password = "password";  
private static String host = "server";  
private static int portport = port;  

//To make sure you are using the correct domain open ie and try to reach the service. The same domain you entered there is needed here  
private static String domain = "DOMAIN";   

private static String orgName = "THIS_IS_REQUIRED"; //this does the work....  


public static void main(String[] args) {  

    CrmServiceStub stub;  
    try {  
        stub = new CrmServiceStub(endpointURL);  
        setOptions(stub._getServiceClient().getOptions());  

        RetrieveMultipleDocument rmd = RetrieveMultipleDocument.Factory.newInstance();  
        RetrieveMultiple rm = RetrieveMultiple.Factory.newInstance();  

        QueryExpression query = QueryExpression.Factory.newInstance();  
        query.setColumnSet(AllColumns.Factory.newInstance());  
        query.setEntityName(EntityName.######.toString());  
        //query.setFilter...  

        rm.setQuery(query);  
        rmd.setRetrieveMultiple(rm);  

        //Now this is required. Without it all i got was 401s errors  
        CrmAuthenticationTokenDocument catd = CrmAuthenticationTokenDocument.Factory.newInstance();  
        CrmAuthenticationToken token = CrmAuthenticationToken.Factory.newInstance();  
        token.setAuthenticationType(0);     
        token.setOrganizationName(orgName);  
        catd.setCrmAuthenticationToken(token);  

        boolean fetchNext = true;  
        while(fetchNext){  
            RetrieveMultipleResponseDocument rmrd = stub.RetrieveMultiple(rmd,  catd, null, null);  
            RetrieveMultipleResponse rmr = rmrd.getRetrieveMultipleResponse();  
            BusinessEntityCollection bec = rmr.getRetrieveMultipleResult();  

            String pagingCookie = bec.getPagingCookie();  
            fetchNext = bec.getMoreRecords();  

            ArrayOfBusinessEntity aobe = bec.getBusinessEntities();  
            BusinessEntity[] myEntitiesAtLast = aobe.getBusinessEntityArray();  

            for(int i=0; i<myEntitiesAtLast.length; i++){  
                //cast to whatever you asked for...  
                ### myEntity = (###) myEntitiesAtLast[i];  
            }  
        }  
    }   
    catch (Exception e) {  
        e.printStackTrace();  
    }  
}  

private static void setOptions(Options options){  
    HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();  

    List authSchemes = new ArrayList();  
    authSchemes.add(HttpTransportProperties.Authenticator.NTLM);   
    auth.setAuthSchemes(authSchemes);   

    auth.setUsername(userName);  
    auth.setPassword(password);  
    auth.setHost(host);  
    auth.setPort(port);  
    auth.setDomain(domain);  
    auth.setPreemptiveAuthentication(false); //it doesnt matter...  
    options.setProperty(HTTPConstants.AUTHENTICATE, auth);  
    options.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, "true"); //i think this is good.. not required though  
} 
于 2009-07-12T11:34:01.670 に答える
4

Java-> SOAP- > MS CRM 2011オンライン:http://zsvoboda.blogspot.com/2011/03/connecting-to-microsoft-crm-2011-online.html

于 2011-03-04T19:26:13.077 に答える
1

スタブは Apache Axis2 フレームワークで作成されています。

于 2010-07-28T09:57:23.610 に答える
0

ここでリソースを見つけることができます。Dynamics CRM SDK で利用可能な例を使用することもできます。Manuel Freiholz が言ったように、Axis2 を使用する必要があります。

https://msdn.microsoft.com/en-us/library/jj602979(v=crm.5).aspx

http://blogs.msdn.com/b/dynamics-coe/archive/2013/09/21/integrating-microsoft-dynamics-crm-2011-online-with-java-and-other-non-net-clients. aspx

または、Dynamics が提供する OData インターフェイス ( https://msdn.microsoft.com/en-us/library/gg334279.aspx )を介して RESTFul Web サービスを使用できます。

于 2015-03-09T10:34:12.110 に答える