小编The*_*lab的帖子

使用PHP进行SOAP身份验证

我需要以纯文本用户名和密码的形式连接到需要身份验证凭据的Web服务.

我对SOAP有基本的了解,并且设法使用NuSOAP连接到不需要用户名或密码的其他开放Web服务.

以下内容发送给我:

<?php

// Set up security options
$security_options = array("useUsernameToken" => TRUE);
$policy = new WSPolicy(array("security" => $security_options));

$security_token = new WSSecurityToken(array(
    "user" => "xxx",
    "password" => "xxx",
    "passwordType" => "basic"));

// Create client with options
$client = new WSClient(array("wsdl" => "https://xxx.asmx?wsdl",
    "action" => "http://xxx",
    "to" => "https://xxx",
    "useWSA" => 'submission',
    "CACert" => "cert.pem",
    "useSOAP" => 1.1,
    "policy" => $policy,
    "securityToken" => $security_token));

// Send request and capture response
$proxy = $client->getProxy();

$input_array = array("From" => "2010-01-01 00:00:00", …
Run Code Online (Sandbox Code Playgroud)

php authentication soap wso2 nusoap

6
推荐指数
1
解决办法
5万
查看次数

标签 统计

authentication ×1

nusoap ×1

php ×1

soap ×1

wso2 ×1