Nginx image_filter - static

I store static on S3 and use nginx as front-end. For fetch from S3 I use this construction:
location / {
try_files $uri #s3;
}
location #s3 {
root /var/www/static.dev;
proxy_pass https://bucket.s3-eu-west-1.amazonaws.com;
proxy_store off; # for test purposes
proxy_store_access all:rw;
proxy_temp_path /dev/shm;
}
This work!
But I want to generate thumbs and use this location:
if ( $uri ~ ^/t/ ) {
set $w 182;
set $h 114;
}
if ( $uri ~ ^/m/ ) {
set $w 640;
set $h 1280;
}
if ( $uri ~ ^/l/ ) {
set $w 1024;
set $h 2048;
}
location ~ ^/(?:t|m|l)/(.*\.(?:jpg|gif|png))$ {
rewrite ^/[t|m|l]+/(.*)$ /$1;
image_filter crop $w $h;
}
But this not work, nginx return 415 Unsupported Media Type.
What wrong?

You could be like to use the location directive on the each part of url: t/m/l.
location ( ~ ^/t/ ) {
set $w 182;
set $h 114;
root /;
image_filter crop $w $h;
}

Related

For loop for Array in Powershell

I have sample code as below:
$IP=#("IP1","IP2","IP3", "IP4" , "IP5")
$Hostname=#("Host1","Host2","Host3","HOST4", "HOST5")
$data = Read-Host -Prompt 'Please enter the data.'
if ($data -match 'zone1') {
$Unity=$IP[0]
$show=$hostname[0]
} elseif ($data -match 'site2'){
$Unity=$IP[1]
$show=$hostname[1]
} elseif ($data -match 'unit5'){
$Unity=$IP[2]
$show=$hostname[2]
} elseif ($data -match 'ALL DC'){
$Unity=$IP
$show=$hostname
}
foreach ($u in $Unity){
echo "This is my IP" $u
echo "This is my hostname" $show
}
Codework fine for all the options except ALL DC.
I want to run some command which uses hostname and Ip.
Desired Output when ALL DC is input by the user is
This is my IP
IP1
This is my hostname
Host1
This is my IP
IP2
This is my hostname
Host2
This is my IP
IP3
This is my hostname
Host3
This is my IP
IP4
This is my hostname
Host4
This is my IP
IP5
This is my hostname
Host5
If I understand what you are trying to do correctly, I would probably not use separate arrays for this, but one single array containing objects in order to keep the units, ip's and hostnames together.
Then you could do:
$units = [PsCustomObject]#{unit = 'zone1' ; ip = 'IP1'; hostname = 'Host1'},
[PsCustomObject]#{unit = 'site2' ; ip = 'IP2'; hostname = 'Host2'},
[PsCustomObject]#{unit = 'unit5' ; ip = 'IP3'; hostname = 'Host3'},
[PsCustomObject]#{unit = 'region3'; ip = 'IP4'; hostname = 'Host4'},
[PsCustomObject]#{unit = 'zone5' ; ip = 'IP5'; hostname = 'Host5'}
$data = Read-Host -Prompt 'Please enter the unit'
$choice = if (![string]::IsNullOrWhiteSpace($data)) { $units | Where-Object { $_.unit -match $data }}
if ($choice) {
Write-Host "You have chosen:" -ForegroundColor Green
$choice | Format-Table -AutoSize
}
else {
Write-Host "You have given invalid input.." -ForegroundColor Red
Write-Host "These are all DC's:"
$units | Format-Table -AutoSize
}
Is that your intent? If not, please edit your question to make it more clear.
You can reduce the number of assignments required by using a switch instead of if/elseif/else, and then only picking the array indices (instead of the target items):
$indices = switch -regex ($data){
'zone1' { 0 }
'site2' { 1 }
'unit5' { 2 }
'ALL DC' { 0..4 }
}
$Unity=$IP[$indices]
$show=$hostname[$indices]
Now you just need to replace the foreach loop with a for loop:
for($i = 0; $i -lt $Indices.Length; $i++){
$u = $Unity[$i]
$h = $show[$i]
echo "This is my IP" $u
echo "This is my hostname" $h
}
Alternatively, construct objects based on the original arrays before letting the user choose:
$IP=#("IP1","IP2","IP3", "IP4" , "IP5")
$Hostname=#("Host1","Host2","Host3","HOST4", "HOST5")
# construct a new array of objects with corresponding IP-Host details
$HostIPDetails = for($i = 0; $i -lt $IP.Length; $i++){
[pscustomobject]#{ IP = $IP[$i]; HostName = $Hostname[$i] }
}
$data = Read-Host 'Input the data... '
$indices = switch -regex ($data){
'zone1' { 0 }
'site2' { 1 }
'unit5' { 2 }
'ALL DC' { 0..4 }
}
foreach($machine in $HostIPDetails[$indices]){
echo "This is my IP" $machine.IP
echo "This is my hostname" $machine.HostName
}

Filter TreeView Nodes in PowerShell

I have a ton of Nodes in my TreeView, and have a textbox that filters through them to highlight the matched search. However, its a bit messy as it shows all the other nodes, and after I change my search, it leaves all nodes expanded.
I am trying to make something like this, https://www.codeproject.com/Tips/1000621/Filtering-and-Hiding-Tree-Nodes-WinForms
But I am using Windows forms / Powershell ISE and seem to struggle with implementing it into my own code.
For closing nodes I tried using things along the line of (Textbox.textlength -eq 0) to trigger a close all nodes function, but that was not working.
Here is what I want it too look like. Left is what I want, Right is what mine looks like.
Here is an example of the search function I am using.
Add-Type -AssemblyName System.Windows.Forms
function GetNodes([System.Windows.Forms.TreeNodeCollection] $nodes)
{
foreach ($n in $nodes) {
$n
GetNodes($n.Nodes)
}
}
$form = New-Object System.Windows.Forms.Form
$form.Text ="Test"
$form.Controls.AddRange(#(
($txt = [System.Windows.Forms.TextBox] #{
Location = [System.Drawing.Point]::new(8, 8);
Width = 100;
}),
($btn = [System.Windows.Forms.Button] #{
Location = [System.Drawing.Point]::new(120, 8);
Width = 50;
Text = "Search";
}),
($tree = [System.Windows.Forms.TreeView] #{
Location = [System.Drawing.Point]::new(8, 40);
Width = 170;
HideSelection = $false
})
))
$form.AcceptButton= $btn
$tree.Nodes.Add("A1", "A1")
$tree.Nodes.Add("A2", "A2")
$tree.Nodes[0].Nodes.Add("A11", "A11")
$tree.Nodes[0].Nodes.Add("A12", "A12")
$tree.Nodes[1].Nodes.Add("A21", "A21")
$tree.Nodes[1].Nodes.Add("A22", "A22")
$btn.Add_Click({param($sender,$e)
$nodes = GetNodes($tree.Nodes)
foreach ($node in $nodes) {
if($node.Text -like $txt.Text){
$tree.SelectedNode = $node
$node.EnsureVisible()
break
}
}
})
$form.ShowDialog() | Out-Null
$form.Dispose()
Assuming you are searching on a data source like a folder structure, this is what I'll do:
Create a function to get list of all directories recursively into a list
Create a function to filter the list of directories and return a list of directories which contain a specific text in their names.
Create a function to populate treeview
create a function to highlight treenode if it contains a specific text
Then in the text-changed event of the textbox, I'll filter and highlight tree:
Here is the code:
Add-Type -AssemblyName System.Windows.Forms
function GetPaths($root)
{
Get-ChildItem $root -Recurse -Directory | % {
$_.FullName.Replace($root, "").Trim("\")}
}
function FilterPaths($paths, $like)
{
$paths | ? {$_ -like "*$like*"} | % {
$i = $_.LastIndexOf("$like", [System.Globalization.CompareOptions]::IgnoreCase)
if($i -gt -1) {
$j = $_.IndexOf("\", $i, [System.Globalization.CompareOptions]::IgnoreCase)
if($j -gt -1) {
$_.SubString(0,$j)
} else {
$_
}
}
}
}
function GetNodes($nodes)
{
foreach ($n in $nodes) {
$n
GetNodes($n.Nodes)
}
}
function HighlightNodes($nodes, $like)
{
if(!$like){ return }
$nodes | ? {$_ -like "*$like*"} | % {
$_.BackColor = "Yellow"
}
}
function PopulateTree($treeView, $paths)
{
$treeView.Nodes.Clear()
foreach ($path in $paths)
{
$lastNode = $null
$subPathAgg = ""
foreach ($subPath in ($path -split '\\'))
{
$subPathAgg += ($subPath + '\')
$nodes = $treeView.Nodes.Find($subPathAgg, $true)
if ($nodes.Length -eq 0) {
if ($lastNode -eq $null) {
$lastNode = $treeView.Nodes.Add($subPathAgg, $subPath)
} else {
$lastNode = $lastNode.Nodes.Add($subPathAgg, $subPath)
}
} else {
$lastNode = $nodes[0]
}
}
}
}
$form = New-Object System.Windows.Forms.Form
$form.Text ="Test"
$form.Controls.AddRange(#(
($txt = [System.Windows.Forms.TextBox] #{
Location = [System.Drawing.Point]::new(8, 8);
Width = $form.ClientSize.Width - 16;
Anchor = [System.Windows.Forms.AnchorStyles]13
}),
($tree = [System.Windows.Forms.TreeView] #{
Location = [System.Drawing.Point]::new(8, 40);
Width = $form.ClientSize.Width - 16;
Anchor = [System.Windows.Forms.AnchorStyles]15
Height = 200;
HideSelection = $false
})
))
$form.AcceptButton= $btn
$root = "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\ItemTemplates\CSharp"
$paths = GetPaths $root
PopulateTree $tree $paths
$tree.ExpandAll()
$txt.Add_TextChanged({param($sender,$e)
$tree.BeginUpdate()
$like = $txt.Text
$filtered = FilterPaths $paths $like
PopulateTree $tree $filtered
HighlightNodes (GetNodes $tree.Nodes) $like
$tree.ExpandAll()
$tree.TopNode = $tree.Nodes[0]
$tree.EndUpdate()
})
$form.ShowDialog() | Out-Null
$form.Dispose()

Browse database with a loop

I have a database containing 3 parameters: name, http_host and http_port
stardb=# select name, http_host, http_port from data ;
name | http_host | http_port
-------+---------------+-----------
user2 | 127.0.0.1 | 80
user1 | 192.x.x.x. | 80
I would like to create a loop in my nginx server, so that each name it makes a proxy_pass http://$http_host:$http_port concerned.
Here's what I did:
location /getIp {
default_type 'text/plain';
rds_json on;
set $name '';
postgres_pass database;
postgres_query "SELECT http_host FROM data WHERE name = \'$name\'";
postgres_output rds;
}
location /getPort {
default_type 'text/plain';
rds_json on;
set $name '';
postgres_pass database;
postgres_query "SELECT http_port FROM data WHERE name = \'$name\'";
postgres_output rds;
}
location /$name {
ip = ngx.location.capture("/getIp", {
method = ngx.HTTP_GET
})
port = ngx.location.capture("/getPort", {
method = ngx.HTTP_GET
})
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://$ip:$port;
}
But I do not see how to make a loop to browse the database.

my PS-function sorts a list of ntp-servers acc. to their delay, at the end it should rewrite the list in the new order: failed?

my function sorts a list of ntp-server acc. to their delay and should - as arrays are passed by reference(?) - rewrite the original server-list but this does not happen:
$SvrList = #('ts1.aco.net','ts2.aco.net','ts1.univie.ac.at','ts2.univie.ac.at',,'9.de.pool.nttpp.org',
'0.at.pool.ntp.org','1.at.pool.ntp.org','2.at.pool.ntp.org','3.at.pool.ntp.org',
'ntp1.m-online.net','ptbtime1.ptb.de','ptbtime2.ptb.de','ptbtime3.ptb.de',
'ntp.raqxs.nl','sigma.shadowchild.nl','0.de.pool.ntp.org','1.de.pool.ntp.org',
'2.de.pool.ntp.org','3.de.pool.ntp.org','3.de.pool.nttpp.org')
# '9.de.pool.nttpp.org' & '3.de.pool.nttpp.org' will fail and should be put at the end
function sortNtpServer {
param( [string[]]$sL )
$HashTmp = #{};
foreach ( $Server in $sL ) {
# NTP Times are all UTC and are relative to midnight on 1/1/1900
$StartOfEpoch=New-Object DateTime(1900,1,1,0,0,0,[DateTimeKind]::Utc)
Function OffsetToLocal($Offset) {
# Convert milliseconds since midnight on 1/1/1900 to local time
$StartOfEpoch.AddMilliseconds($Offset).ToLocalTime()
}
[Byte[]]$NtpData = ,0 * 48
$NtpData[0] = 0x1B # NTP Request header in first byte
$Socket = New-Object Net.Sockets.Socket([Net.Sockets.AddressFamily]::InterNetwork,
[Net.Sockets.SocketType]::Dgram,
[Net.Sockets.ProtocolType]::Udp)
Try {
$Socket.Connect($Server,123)
$result = $Socket.BeginConnect($Server,123, $null, $null);
$success = $result.AsyncWaitHandle.WaitOne(2000, $true);
if ( !$success ) {
#Write-Error "$Server : $_"
#Throw "$Server : Failed to connect to server $Server"
$HashTmp.Set_Item($Server,99999.0);
$Socket.close()
continue
}
}
Catch {
#Write-Error "$Server : $_"
#Throw "$Server : Failed to connect to server $Server"
#return($NULL)
$HashTmp.Set_Item($Server,99999.0);
$Socket.close()
continue
}
# NTP Transaction -------------------------------------------------------
$t1 = Get-Date # Start of transaction... the clock is ticking...
Try {
[Void]$Socket.Send($NtpData)
[Void]$Socket.Receive($NtpData)
}
Catch {
#Write-Error "$Server : $_"
#Throw "$Server : Failed to communicate with server $Server"
#return($NULL)
$HashTmp.Set_Item($Server,99999.0);
$Socket.close()
continue
}
$t4 = Get-Date # End of transaction time
# -----------------------------------------------------------------------
$Socket.Close()
# Check the Leap Indicator (LI) flag for an alarm condition - extract the flag
# from the first byte in the packet by masking and shifting (dividing)
$LI = ($NtpData[0] -band 0xC0)/64 # Leap Second indicator
If ($LI -eq 3) {
#Write-Error "$Server : Alarm condition from server (clock not synchronized)"
#return($NULL)
$HashTmp.Set_Item($Server,99999.0);
continue
}
$IntPart = [BitConverter]::ToUInt32($NtpData[43..40],0)
$FracPart = [BitConverter]::ToUInt32($NtpData[47..44],0)
# Convert to Millseconds (convert fractional part by dividing value by 2^32)
$t3ms = $IntPart * 1000 + ($FracPart * 1000 / 0x100000000)
# Perform the same calculations for t2 (in bytes [32..39])
$IntPart = [BitConverter]::ToUInt32($NtpData[35..32],0)
$FracPart = [BitConverter]::ToUInt32($NtpData[39..36],0)
$t2ms = $IntPart * 1000 + ($FracPart * 1000 / 0x100000000)
# Calculate values for t1 and t4 as NTP format in milliseconds since 1/1/1900
$t1ms = ([TimeZoneInfo]::ConvertTimeToUtc($t1) - $StartOfEpoch).TotalMilliseconds
$t4ms = ([TimeZoneInfo]::ConvertTimeToUtc($t4) - $StartOfEpoch).TotalMilliseconds
# Calculate the NTP Offset and Delay values
$Offset = (($t2ms - $t1ms) + ($t3ms-$t4ms))/2
$Delay = ($t4ms - $t1ms) - ($t3ms - $t2ms)
#$Delay
$HashTmp.Set_Item($Server,$Delay);
}
$tempArr = #();
$HashTmp.GetEnumerator() |
Sort-Object { [double]$_.Value } |
ForEach-Object {
if ( $_.Value -lt 0 ) {
#Write-Host "#" $_.Key.PadLeft(20) " => " $_.Value.ToString('f3').PadLeft(7)
#continue
} else {
$tempArr += $_.Key
#Write-Host $_.Key.PadLeft(22) " => " $_.Value.ToString('f3').PadLeft(7)
}
}
$sL = $tempArr # this should re-write the original Server-List ??
foreach ( $Server in $sL ) {
Write-Host $Server.PadLeft(22) " => " $HashTmp.$Server.ToString('f3').PadLeft(7)
}
Write-Host "`n##########`n"
#return($tempArr)
}
# call the sort-function:
sortNtpServer $SvrList
# ok, check the result
foreach ( $Server in $SvrList ) {
Write-Host $Server.PadLeft(22)
}
I tried to use [ref] at param(..) which failed.
I tried to return($tempArr) which failed.
I tried to use $Script:SvrList which failed.
How do I do it?
I think what you want is just to set the variable as the result of the function run against the variable:
$SvrList = sortNtpServer $SvrList
I didn't feel like waiting for it to ping out the servers so I just commented out most of your function and set the delay to a random number. Then I added $SvrList = at the beginning of your sortNtpServer $SvrList line, removed the # from in front of return($tempArr) and ran it. It responded with what I think you would want:
ptbtime3.ptb.de => 108.000
0.de.pool.ntp.org => 209.000
ts1.aco.net => 356.000
1.at.pool.ntp.org => 377.000
ts1.univie.ac.at => 487.000
ntp1.m-online.net => 497.000
ts2.aco.net => 718.000
3.de.pool.nttpp.org => 907.000
3.de.pool.ntp.org => 1064.000
ntp.raqxs.nl => 1129.000
ptbtime1.ptb.de => 1243.000
ts2.univie.ac.at => 1329.000
9.de.pool.nttpp.org => 1435.000
2.de.pool.ntp.org => 1579.000
2.at.pool.ntp.org => 1791.000
ptbtime2.ptb.de => 1911.000
sigma.shadowchild.nl => 2082.000
1.de.pool.ntp.org => 2355.000
3.at.pool.ntp.org => 2449.000
0.at.pool.ntp.org => 2859.000
##########
ptbtime3.ptb.de
0.de.pool.ntp.org
ts1.aco.net
1.at.pool.ntp.org
ts1.univie.ac.at
ntp1.m-online.net
ts2.aco.net
3.de.pool.nttpp.org
3.de.pool.ntp.org
ntp.raqxs.nl
ptbtime1.ptb.de
ts2.univie.ac.at
9.de.pool.nttpp.org
2.de.pool.ntp.org
2.at.pool.ntp.org
ptbtime2.ptb.de
sigma.shadowchild.nl
1.de.pool.ntp.org
3.at.pool.ntp.org
0.at.pool.ntp.org

Perl SOAP::LITE can parse array of object from WCF

I am having a small issue with the arrayed value from a WCF service. I have tested the WCF with WCF Storm. However I need it in perl. I can get the part of the object that is not in the array however when I try to get the arrayed values it seems to be jumping to the second value. Because I can see interface 2 but cannot see anything for the storage. Any advise it extremely helpful.
#!/usr/bin/perl
package main;
use SOAP::Lite;
# Variables
my $url = 'http://<MyServerName>/Services/DCSP/DCSP.ServerManagement.svc?wsdl';
my $url_debug = 'http://localhost:11040/Service1.svc?wsdl';
my $uri = 'http://tempuri.org/';
my $xmlns = 'http://schemas.datacontract.org/2004/07/WcfService1';
my $selectedOS = 'Solaris';
# Setup Network Connection
my $soap = SOAP::Lite
-> uri($uri)
-> on_action(sub { sprintf '%sIServerManagement/%s', #_ })
-> proxy($url)
->autotype(0)->readable(1);
my $response = $soap->serverExists(SOAP::Data->new(name => '_serverNamee', value => '<ServerName>'));
# Print the Result
if ($response->fault)
{
die $response->faultstring;
}
else
{
if($response->result > 0) {
my $serverID = $response->result;
my $buildserver = $soap->getServerById(SOAP::Data->new(name => '_id', value => $serverID));
my $cpus = $buildserver->valueof('//*/CPUs');
my $host = $buildserver->valueof('//*/Host');
my $hostname = $buildserver->valueof('//*/HostName');
my $memoryMB = $buildserver->valueof('//*/MemoryMB');
my $OS = $buildserver->valueof('//*/OperatingSystem');
my $stack = $buildserver->valueof('//*/Stack');
my $status = $buildserver->valueof('//*/Status');
my $tier = $buildserver->valueof('//*/Tier');
my $arch = $buildserver->valueof('//*/architecture');
my #interfaces = $buildserver->valueof('//*/*/systemInterface');
my #mounts = $buildserver->valueof('//*/*/systemStorage');
foreach $interface (#interfaces)
{
my $ipid = $interface->{'IPID'};
my $position = $interface->{'Position'};
my $ipaddress = $soap->getIpAddressByID(SOAP::Data->new(name => '_ID', value => $ipid));
my $gateway = $ipaddress->valueof('//*/gateway');
my $mask = $ipaddress->valueof('//*/mask');
my $vlan = $ipaddress->valueof('//*/vlanID');
my $ip = $ipaddress->valueof('//*/address');
}
foreach $mount (#mounts)
{
my $mountpoint = $mount->{'Anchor'};
my $size = $mount->{'SizeMB'};
}
}
}
Output from WCF Storm:
<getServerById>
<MethodParameters>
<virtualServer>
<systemInterface attr0="NetworkInterfaceArray" isNull="false">
<NetworkInterfaceArray0>
<IPID>4</IPID>
<Position>0</Position>
<SystemID>3</SystemID>
<id>11</id>
<EntityKey>System.Data.EntityKey</EntityKey>
</NetworkInterfaceArray0>
<NetworkInterfaceArray1>
<IPID isNull="true" />
<Position>0</Position>
<SystemID>3</SystemID>
<id>19</id>
<EntityKey>System.Data.EntityKey</EntityKey>
</NetworkInterfaceArray1>
</systemInterface>
<systemSpecs>
<CPUs>1</CPUs>
<Host><HOST></Host>
<HostName><HostName</HostName>
<MemoryMB>2048</MemoryMB>
<OperatingSystem>Solaris 10</OperatingSystem>
<Stack>Development</Stack>
<Status>Approved</Status>
<Tier>Teir 1 (Front End)</Tier>
<architecture>T-Series</architecture>
<id>3</id>
<EntityKey>System.Data.EntityKey</EntityKey>
</systemSpecs>
<systemStorage attr0="StorageArray" isNull="false">
<StorageArray0>
<Anchor>/def</Anchor>
<SizeMB>2048</SizeMB>
<SystemID>3</SystemID>
<id>11</id>
<EntityKey>System.Data.EntityKey</EntityKey>
</StorageArray0>
</systemStorage>
</virtualServer>
</MethodParameters>
</getServerById>
Reponse from debug:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<getServerByIdResponse xmlns="http://tempuri.org/">
<getServerByIdResult xmlns:a="http://schemas.datacontract.org/2004/07/DCSP.DataClasses" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:systemInterface>
<a:NetworkInterface xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" z:Id="i1">
<EntityKey xmlns="http://schemas.datacontract.org/2004/07/System.Data.Objects.DataClasses" xmlns:b="http://schemas.datacontract.org/2004/07/System.Data" z:Id="i2">
<b:EntityContainerName>DCSPEntities</b:EntityContainerName>
<b:EntityKeyValues>
<b:EntityKeyMember>
<b:Key>id</b:Key>
<b:Value i:type="c:int" xmlns:c="http://www.w3.org/2001/XMLSchema">11</b:Value>
</b:EntityKeyMember>
</b:EntityKeyValues>
<b:EntitySetName>NetworkInterfaces</b:EntitySetName>
</EntityKey>
<a:IPID>4</a:IPID>
<a:Position>0</a:Position>
<a:SystemID>3</a:SystemID>
<a:id>11</a:id>
</a:NetworkInterface>
<a:NetworkInterface xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" z:Id="i3">
<EntityKey xmlns="http://schemas.datacontract.org/2004/07/System.Data.Objects.DataClasses" xmlns:b="http://schemas.datacontract.org/2004/07/System.Data" z:Id="i4">
<b:EntityContainerName>DCSPEntities</b:EntityContainerName>
<b:EntityKeyValues>
<b:EntityKeyMember>
<b:Key>id</b:Key>
<b:Value i:type="c:int" xmlns:c="http://www.w3.org/2001/XMLSchema">19</b:Value>
</b:EntityKeyMember>
</b:EntityKeyValues>
<b:EntitySetName>NetworkInterfaces</b:EntitySetName>
</EntityKey>
<a:IPID i:nil="true"/>
<a:Position>0</a:Position>
<a:SystemID>3</a:SystemID>
<a:id>19</a:id>
</a:NetworkInterface>
</a:systemInterface>
<a:systemSpecs xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" z:Id="i5">
<EntityKey xmlns="http://schemas.datacontract.org/2004/07/System.Data.Objects.DataClasses" xmlns:b="http://schemas.datacontract.org/2004/07/System.Data" z:Id="i6">
<b:EntityContainerName>DCSPEntities</b:EntityContainerName>
<b:EntityKeyValues>
<b:EntityKeyMember>
<b:Key>id</b:Key>
<b:Value i:type="c:int" xmlns:c="http://www.w3.org/2001/XMLSchema">3</b:Value>
</b:EntityKeyMember>
</b:EntityKeyValues>
<b:EntitySetName>Computers</b:EntitySetName>
</EntityKey>
<a:CPUs>1</a:CPUs>
<a:Host>Host</a:Host>
<a:HostName>HostName</a:HostName>
<a:MemoryMB>2048</a:MemoryMB>
<a:OperatingSystem>Solaris 10</a:OperatingSystem>
<a:Stack>Development</a:Stack>
<a:Status>Approved</a:Status>
<a:Tier>Teir 1 (Front End)</a:Tier>
<a:architecture>T-Series</a:architecture>
<a:id>3</a:id>
</a:systemSpecs>
<a:systemStorage>
<a:Storage xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" z:Id="i7">
<EntityKey xmlns="http://schemas.datacontract.org/2004/07/System.Data.Objects.DataClasses" xmlns:b="http://schemas.datacontract.org/2004/07/System.Data" z:Id="i8">
<b:EntityContainerName>DCSPEntities</b:EntityContainerName>
<b:EntityKeyValues>
<b:EntityKeyMember>
<b:Key>id</b:Key>
<b:Value i:type="c:int" xmlns:c="http://www.w3.org/2001/XMLSchema">11</b:Value>
</b:EntityKeyMember>
</b:EntityKeyValues>
<b:EntitySetName>Storages</b:EntitySetName>
</EntityKey>
<a:Anchor>/def</a:Anchor>
<a:SizeMB>2048</a:SizeMB>
<a:SystemID>3</a:SystemID>
<a:id>11</a:id>
</a:Storage>
</a:systemStorage>
</getServerByIdResult>
</getServerByIdResponse>
</s:Body>
</s:Envelope>
Your question as-is is nigh-impossible to answer, you need to post a sample response as part of your program
See Re: Soap::Lite and Complex Types with WSDL for debug setup to capture data
$soap->transport->add_handler("request_send", \&pp_dump );
$soap->transport->add_handler("response_done", \&pp_dump );
sub pp_dump {
my $content = $_[0]->content('');
$_[0]->content( pp($content) );
print $_[0]->as_string,"\n";
return;
}
sub pp {
use XML::Twig;
open my($fh), '>', \my $str;
no warnings 'newline';
XML::Twig->new(qw! pretty_print record !)->xparse(#_)->print( $fh );
return $str;
}
And see Re^3: SOAP::Lite - Attribute in array for debug setup to access response
my $xml = <<'__XML__';
<?xml version="1.0" encoding="UTF-8"?>
...
__XML__
my $response = SOAP::Custom::XML::Deserializer->deserialize( $xml );

Resources