본문 바로가기
프로그래밍/SOAP

nusoap with basic authentication

by 백룡화검 2010. 4. 24.
<?php
require("../lib/nusoap.php");
 
$username = "username";
$password = "password";
$method = "basic";
 
$soapClient = new soapclient(
  "https://$username:$password@www.minimizr.com/ws/services/v1/MinimizrService?wsdl",
  "wsdl");
$proxyClass = $soapClient->getProxy();
$proxyClass->setCredentials($username, $password, $method);
$proxyClass->useHTTPPersistentConnection();
...
<?php

require_once("../../serverScripts/nusoap/lib/nusoap.php");
//set path to server and create new client
$serverpath = "https://secure.bluedot.us/BlueDotApi.asmx?WSDL";
$client = new soapclient($serverpath);
$client->setCredentials('your_username','your_password','basic');
$err = $client->getError();

if ($err)
{
print_r($err);
}
else
{
$namespace ='http://bluedot.us/api';
$soapAction = "http://bluedot.us/api/GetLastUpdatedDateTime";
$result = $client->call('GetLastUpdatedDateTime',"",$namespace,$soapAction);

if ($client->fault)
{
print_r($client->response);
}
else
{
$err = $client->getError();

if ($err)
{
print_r($err);
}
else
{
echo "<pre>";
print_r($result);
echo "</pre>";
}
}
}
?>

'프로그래밍 > SOAP' 카테고리의 다른 글

Soap  (0) 2010.04.24
nuSoap을 이용한 서버간의 파일전송  (0) 2010.04.24
웹서비스, XML, UDDI, WSDL, SOAP  (0) 2010.04.24
[본문스크랩] SOAP 참고 사이트  (0) 2010.04.24