惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
Netflix TechBlog - Medium
Microsoft Azure Blog
Microsoft Azure Blog
罗磊的独立博客
博客园 - 三生石上(FineUI控件)
aimingoo的专栏
aimingoo的专栏
B
Blog RSS Feed
V
Visual Studio Blog
P
Proofpoint News Feed
云风的 BLOG
云风的 BLOG
博客园 - 【当耐特】
大猫的无限游戏
大猫的无限游戏
Application and Cybersecurity Blog
Application and Cybersecurity Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
The Cloudflare Blog
B
Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Apple Machine Learning Research
Apple Machine Learning Research
M
MIT News - Artificial intelligence
Know Your Adversary
Know Your Adversary
I
InfoQ
T
The Exploit Database - CXSecurity.com
V
Vulnerabilities – Threatpost
C
Cisco Blogs
Spread Privacy
Spread Privacy
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Palo Alto Networks Blog
Simon Willison's Weblog
Simon Willison's Weblog
月光博客
月光博客
博客园 - Franky
Project Zero
Project Zero
G
Google Developers Blog
S
SegmentFault 最新的问题
博客园 - 聂微东
P
Privacy & Cybersecurity Law Blog
The GitHub Blog
The GitHub Blog
阮一峰的网络日志
阮一峰的网络日志
P
Privacy International News Feed
T
Threat Research - Cisco Blogs
S
Schneier on Security
Microsoft Security Blog
Microsoft Security Blog
G
GRAHAM CLULEY
S
Security @ Cisco Blogs
Martin Fowler
Martin Fowler
A
Arctic Wolf
T
Tenable Blog
L
LINUX DO - 最新话题
TaoSecurity Blog
TaoSecurity Blog
Hugging Face - Blog
Hugging Face - Blog
有赞技术团队
有赞技术团队
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com

博客园 - N/A2011

Managing Hierarchical Data in MySQL 转贴 MySQL Multiple Result Procs in PHP 转贴 jQuery Datepicker by Example 转贴 Using MySQL Stored Procedures with PHP mysql/mysqli/pdo php generate pdf open office (java) ant + emma + junit Copy all files recursively from one folder to another RecursiveFileFinder 转贴: 怎样找第一份工作 PerformanceCounter in .net Trace in .net Logger in .net 转贴: 傅立叶级数(Fourier Series) 推导 CAS in .net Encrypting and Decrypting in .net Access Control List in .net User and Data Security in .net Unmanaged code in .net
php soapclient with wsse
N/A2011 · 2010-06-04 · via 博客园 - N/A2011

代码

<?php
class WebServiceClient extends SoapClient
{
    
public $username;
    
public $password;
    
public $fileContent;
    
public $fileName;
    
public $fileType;
    
    
public function __doRequest($request, $location, $action, $version, $one_way = 0)
    {
        
$request =
  
'<?xml version="1.0" encoding="utf-8"?>
  <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://com.clarkston.cts.webservice.source.event/IEventUploadWSv1.wsdl" xmlns:types="http://com.clarkston.cts.webservice.source.event/IEventUploadWSv1.wsdl/encodedTypes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <soap:Header>
      <wsse:Security>
        <wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="SecurityToken-8c17c5b1-3c45-4eba-bae6-024642866e12">
          <wsse:Username>
'.$this->username.'</wsse:Username>
          <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">
'.$this->password.'</wsse:Password>
        </wsse:UsernameToken>
      </wsse:Security>
    </soap:Header>
    <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      <q1:fileUpload xmlns:q1="urn:com-clarkston-cts-webservice-source-event-IEventUploadWSv1">
        <param0 href="#fur" />
      </q1:fileUpload>
      <q2:com_clarkston_cts_webservice_source_event_FileUploadRequest id="fur" xsi:type="q2:com_clarkston_cts_webservice_source_event_FileUploadRequest" xmlns:q2="http://com.clarkston.cts.webservice.source.event/IEventUploadWSv1.xsd">
        <fileContent xsi:type="xsd:base64Binary">
'.base64_encode($this->fileContent).'</fileContent>
        <fileName xsi:type="xsd:string">
'.$this->fileName.'</fileName>
        <fileType xsi:type="xsd:string">
'.$this->fileType.'</fileType>
      </q2:com_clarkston_cts_webservice_source_event_FileUploadRequest>
    </soap:Body>
  </soap:Envelope>
        
';
        
$location = "http://www.clia.demo.livestockid.ca/CLTSDB/EventUploadWSv1?WSDL";
        
return parent::__doRequest($request, $location, $action, $version, $one_way);
    }
}
$client = new WebServiceClient("http://www.clia.demo.livestockid.ca/CLTSDB/EventUploadWSv1?WSDL");
$client->username = "xxx";
$client->password = "xxx";
$client->fileContent = "okey-dokey";
$client->fileName = "alright.csv";
$client->fileType = "1";
echo $client->fileUpload();
?>