0

PHP 言語を使用して Microsoft Dynamics CRM 2015 を処理するコードを実装する必要があります。動的 CRM と Microsoft サービスにまったく慣れていないため、非 .NET 言語に関する優れたドキュメントがないため、かなり注意が必要です。

私がする必要があるのは、PHP API を作成して、Dynamic CRM 2015 の「連絡先」および「アカウント」テーブルの行を読み取り、追加することです。

グーグルで調べたところ、認証部分の主要部分は 4 つの主要なステップで実行する必要があることがわかりました (Girish Raja のブログから取得)。

1 - Pass in the device credentials and get a PUID. The device credentials is a randomly generated string that satisfies Live ID schema. You can generate one from this tool: Create CRM 2011 Beta Device
    POST login.live.com/ppsecure/DeviceAddCredential.srf
    Get the PUID from response   

2- Pass the device credentials
    POST login.live.com/liveidSTS.srf
    Get the device CiperData (BinaryDAToken)  

3- Pass the WLID username, password and device BinaryDAToken
    POST login.live.com/liveidSTS.srf
    Get the security tokens (2 CipherValues) & X509SubjectKeyIdentifier 

4- Do CRUD with the web service by passing X509SubjectKeyIdentifier, 2 CipherValues and the SOAP request (with data payload)
    POST yourorganization.api.crm.dynamics.com/XRMServices/2011/Organization.svc
    Get the result from the CRUD response and parse XML to get the data you need 

最初のポイントを無事に通過し、DeviceAddCredential.srf から puid を取得しましたが、2 番目のポイントを取得する方法がないようです。「入力されたパスワードと保存されたパスワードが一致しません」というメッセージが何度も出てきます。

私は実際に Ben Speakman の dynamicsClient クラスを使用していますが、これは 2011 年のクラスであるため、ログイン手順に何か問題があるのではないかと推測しています(たとえば、CURLOPT_SSLVERSION をアップグレードするコードで別の問題を修正する必要がありました)。

デバイス資格情報の取得を試みる getBinaryDAToken 関数を次に示します。私がよくわからないのは、URLがhttps://login.live.com/liveidSTS.srfを使用していることです。私の推測では、認証サービスが login.live.com から移動した可能性があり、login.live.com の代わりに呼び出すべき Office 365 製品用の同様のサービスがあります。

login.microsoftonline.com/extSTS.srf を使用する他のスクリプトもありますが、さらに古い URL に見えます。

この認証手順について教えてください。どうもありがとう!

private function getBinaryDAToken(){

        $deviceCredentialsSoapTemplate = '
        <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
            <s:Header>
                <a:Action s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue</a:Action>
                <a:MessageID>
                    urn:uuid:'.$this->messageid.'
                </a:MessageID>
                <a:ReplyTo><a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address></a:ReplyTo>
                <VsDebuggerCausalityData xmlns="http://schemas.microsoft.com/vstudio/diagnostics/servicemodelsink">uIDPoy9Ez+P/wJdOhoN2XNauvYcAAAAAK0Y6fOjvMEqbgs9ivCmFPaZlxcAnCJ1GiX+Rpi09nSYACQAA</VsDebuggerCausalityData>
                <a:To s:mustUnderstand="1">https://login.live.com/liveidSTS.srf</a:To>
                <o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
                    <u:Timestamp u:Id="_0">
                        <u:Created>'.$this->currentTime.'Z</u:Created>
                        <u:Expires>'.$this->nextDayTime.'Z</u:Expires>
                    </u:Timestamp>
                    <o:UsernameToken u:Id="devicesoftware">
                        <o:Username>'.$this->deviceUserName.'</o:Username>
                        <o:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">
                            '.$this->devicePassword.'
                        </o:Password>
                    </o:UsernameToken>
                </o:Security>
            </s:Header>
            <s:Body>
                <t:RequestSecurityToken xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust">
                    <wsp:AppliesTo xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
                        <a:EndpointReference>
                            <a:Address>http://passport.net/tb</a:Address>
                        </a:EndpointReference>
                    </wsp:AppliesTo>
                    <t:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</t:RequestType>
                </t:RequestSecurityToken>
            </s:Body>
        </s:Envelope>';

        return $this->doCurl("/liveidSTS.srf" , "login.live.com" , "https://login.live.com/liveidSTS.srf", $deviceCredentialsSoapTemplate);



    }

更新: Campey に感謝します。新しいログイン URL はhttps://login.microsoftonline.com/RST2.srfです

4

1 に答える 1