WS_Decom PASSWORD prodh20 #### prodh20 HEWLETT PACKARD PROLIANT DL380P GEN8 (SERIAL) (BUILDING) (FLOOR) (SPACE_ID) (LOC)/ns1:GRID_LOCATION> (RACK) FRONT 7 3.5 #### This function provides the XML interface to create a form #### my $wsdl = 'https://www.example.com/VISTA/wsdl/LocateDevice_RunLocator.wsdl'; my $lite = SOAP::Lite ->service($wsdl) ->ns('was'); my @params = (SOAP::Data->name(WAS_userName => 'MY_USER'), SOAP::Data->name(WAS_password => 'MY_PASSWD'), SOAP::Data->name(DEVICE_NAME => 'MY_SERVER')); SOAP::Lite->import(+trace => 'all'); my $result = $lite->RunLocator(@params); #### SOAP::Transport::HTTP::Client::new: () SOAP::Lite::call: () SOAP::Serializer::envelope: () SOAP::Serializer::envelope: RunLocator SOAP::Data=HASH(0x2063270) SOAP::Data=HASH(0x2063150) SOAP::Data=HASH(0x1b2a2a0) SOAP::Data::new: () SOAP::Data::new: () SOAP::Data::new: () SOAP::Data::new: () SOAP::Data::new: () SOAP::Transport::HTTP::Client::send_receive: HTTP::Request=HASH(0x20463b8) SOAP::Transport::HTTP::Client::send_receive: POST https://www.example.com/WAS/API/AWEService.asmx?w_v=1&w_s=VISTA&w_o=LocateDevice HTTP/1.1 Accept: text/xml Accept: multipart/* Accept: application/soap Content-Length: 832 Content-Type: text/xml; charset=utf-8 SOAPAction: "http://tempuri.org/AWEService/API/WASAPI/RunLocator" prodh20 SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x2036400) SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Server Error Cache-Control: private,no-cache, no-store, must-revalidate Date: Sat, 20 May 2017 19:56:56 GMT Server: Microsoft-IIS/7.5 Content-Length: 837 Content-Type: text/xml; charset=utf-8 ... soap:VersionMismatchPossible SOAP version mismatch: Envelope namespace http://schemas.xmlsoap.org/wsdl/soap/ was unexpected. Expecting http://schemas.xmlsoap.org/soap/envelope/. SOAP::Deserializer::deserialize: () SOAP::Parser::decode: () SOAP::SOM::new: () SOAP::SOM::DESTROY: () SOAP::Data::DESTROY: () SOAP::Data::DESTROY: () SOAP::Lite::DESTROY: () SOAP::Deserializer::DESTROY: () SOAP::Parser::DESTROY: () SOAP::Transport::DESTROY: () SOAP::Transport::HTTP::Client::DESTROY: () SOAP::Serializer::DESTROY: () SOAP::Data::DESTROY: () SOAP::Data::DESTROY: () SOAP::Data::DESTROY: () SOAP::Data::DESTROY: () SOAP::Data::DESTROY: () SOAP::Data::DESTROY: () SOAP::Data::DESTROY: () SOAP::Data::DESTROY: () #### #!/usr/bin/perl use strict; use warnings; use SOAP::Lite; use v5.16; my $client = SOAP::Lite ->proxy('https://www.example.com/WAS/API/AWEService.asmx?ENDPOINT') ->on_action(sub { join '/', @_ }) ->ns('http://tempuri.org/AWEService/API/WASAPI','was'); my %auth_parms = ( WAS_userName => 'USER', WAS_password => 'PASSWORD', ); my %search_parms = ( DEVICE_NAME => 'SERVER', ); my @auth_data; for (keys %auth_parms){ my $data = SOAP::Data->name( $_ => $auth_parms{$_} )->prefix('was'); push @auth_data, SOAP::Data->type('data' => $data); } my @search_data; for (keys %search_parms){ my $data = SOAP::Data->name( $_ => $search_parms{$_} )->prefix('was'); push @search_data, SOAP::Data->type('data' => $data); } my $auth = SOAP::Data->name( "userIdentification" => \@auth_data )->prefix('was'); my $search = SOAP::Data->name( "locatorSearchFieldsIdentification" => \@search_data )->prefix('was'); my $header = SOAP::Data->type('xml' => ''); my $response = $client->call("RunLocator", SOAP::Header->type('data' => $header), SOAP::Data->type('data' => $auth), SOAP::Data->type('data' => $search) ); if ($response->valueof('//RunLocatorResult')) { my $serial = $response->valueof('//SERIAL_NUMBER'); my $model = join(' ', scalar $response->valueof('//MANUFACTURER'), scalar $response->valueof('//MODEL') ); my $location = join(' ', scalar $response->valueof('//BUILDING'), scalar $response->valueof('//FLOOR'), scalar $response->valueof('//SPACE_ID'), scalar $response->valueof('//GRID_LOCATION'), scalar $response->valueof('//RACK_NAME') ); return ($serial, $model, $location); }