2

私はWCFプロジェクトを開発しています。カスタム(ユーザー名)認証がオフの場合、PHPからWCFサービスを呼び出すことは正常に機能しますが、認証をオンにすると、WCFサービスにアクセスできないようです。ただし、カスタム認証をオンにすると、.NETプロジェクトからWCFサービスにアクセスできます。そのちょうどPHP。SSLを使用しています。以下はweb.configのバインディング設定です

    <basicHttpBinding>
            <binding name="MypBinding" allowCookies="true">
              <security mode="TransportWithMessageCredential">
                <transport clientCredentialType="None"/>
              </security>
            </binding>
     </basicHttpBinding>

<serviceCredentials>
            <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="ApiService.UAuth, ApiService"/>
          </serviceCredentials>

以下は私のサンプルphpコードです:

 <?php 
 header('Content-Type: text/plain');
    echo "start -> ";

    echo " set wsdl var11111 -> ";


    $soapclient = new SoapClient('https://api.address.com/Apii.svc?wsdl', array('login' => "username",'password' => "pwd",'default_socket_timeout' => 120, 'trace' => true));

    echo " created soapclient ->";
    echo $soapclient->GetData()->GetDataResult;
    echo " end ";


    print ' caught exception:'. $e->getMessage(). "\n";
    return;
?>

どんな提案でも大歓迎です!

4

0 に答える 0