2

PHPには次のものと同等のものが必要です

    System.Net.NetworkCredential credential = new System.Net.NetworkCredential("administrator", "PASSWORD", "DOMAIN");
    wsDynamicsGP.Credentials = credential;
    DynamicsGPWebService.Policy apPolicy = wsDynamicsGP.GetPolicyByOperation("CreatePayablesInvoice", context);

ドメイン/ユーザーパスワードを渡しています

define('USERPWD', 'domain\username:password');

そしたらこれ見つけた

class NTLMSoapClient extends SoapClient {
    function __doRequest($request, $location, $action, $version) {
        $headers = array(
            'Method: POST',
            'Connection: Keep-Alive',
            'User-Agent: PHP-SOAP-CURL',
            'Content-Type: text/xml; charset=utf-8',
            'SOAPAction: "'.$action.'"',
        );
        $this->__last_request_headers = $headers;
        $ch = curl_init($location);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($ch, CURLOPT_POST, true );
        curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
        curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
        curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
        curl_setopt($ch, CURLOPT_USERPWD, USERPWD);
        $response = curl_exec($ch);
        return $response;
    }

    function __getLastRequestHeaders() {
        return implode("\n", $this->__last_request_headers)."\n";
    }
}

(補助授業はありますが、載せる必要はないと思います)

だから私の接続をテストするために私はこれをやっています

// we unregister the current HTTP wrapper 
stream_wrapper_unregister('http');
// we register the new HTTP wrapper 
stream_wrapper_register('http', 'NTLMStream') or die("Failed to register protocol");

// Initialize Soap Client 
$baseURL = 'http://www.targetgpserver.com:port';
$client = new NTLMSoapClient($baseURL.'/DynamicsGPWebServices/DynamicsGPService.asmx?wsdl');
print_var($client);

スクリプトを実行すると、次のようになります。

PHP Fatal error:  SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://erpweb.treecarescience.com:48620/DynamicsGPWebServices/DynamicsGPService.asmx' : Document is empty

hurl.it などを使用して接続できることを確認する方法はありますか? そのサービスを使用してドメインを処理する方法がわかりません。

Mac を使用していますが、接続できることを確認する別の方法はありますか?

4

0 に答える 0