forked from 3gbywork/PSXmlRpcClient
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PSXmlRpcClientTest.ps1
31 lines (28 loc) · 1.38 KB
/
PSXmlRpcClientTest.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Import-Module .\PSXmlRpcClient.psm1
$int=ConvertTo-XmlRpcType -InputObject 365
$bool=ConvertTo-XmlRpcType -InputObject $true
$str=ConvertTo-XmlRpcType -InputObject "<start>!@#$%^&*()</start>"
$double=ConvertTo-XmlRpcType -InputObject 3.65
$datetime=ConvertTo-XmlRpcType -InputObject $([datetime]::Now)
$base64=ConvertTo-XmlRpcType -InputObject $([System.Text.Encoding]::UTF8.GetBytes("3.1415926"))
$struct=ConvertTo-XmlRpcType -InputObject $(@{"name"="value";"key"="value2";"n2"=3.14;"er"=345})
$array=ConvertTo-XmlRpcType -InputObject $("name","merlin","age",18)
ConvertFrom-XmlRpcType -Xml $int
ConvertFrom-XmlRpcType -Xml $bool
ConvertFrom-XmlRpcType -Xml $str
ConvertFrom-XmlRpcType -Xml $double
ConvertFrom-XmlRpcType -Xml $datetime
ConvertFrom-XmlRpcType -Xml $base64
ConvertFrom-XmlRpcType -Xml $struct
ConvertFrom-XmlRpcType -Xml $array
"================================"
"test pythonchallenge xmlrpc"
"--------------------------------"
$serverUrl="http://www.pythonchallenge.com/pc/phonebook.php"
"-----------listMethods----------"
Invoke-XmlRpcRequest -ServerUri $serverUrl -MethodName "system.listMethods"
"----methodSignature of phone----"
Invoke-XmlRpcRequest -ServerUri $serverUrl -MethodName "system.methodSignature" -Params "phone"
"------methodHelp of phone-------"
Invoke-XmlRpcRequest -ServerUri $serverUrl -MethodName "system.methodHelp" -Params "phone"
"================================"