Hello Fellow monks need some help and Im not familiar with SOAP messages or anything to do with web services. Basically I need to make a call to workday web service
I have been given workday URL, User ID and Password which Im not sharing for obvious reasons, I have been given below XML snippet to mention that my call should be made with below format only
<soapenv:Envelope
xmlns:bsvc="urn:com.workday/bsvc"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-2
+00401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-16"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasi
+s-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>#P_USER_NAME</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/20
+04/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">#P_US
+ER_PASSWORD</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/w
+ss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">w
+mtQ0Smma6txNXooNWIVFw==</wsse:Nonce>
<wsu:Created>2011-08-31T18:35:44.675Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<bsvc:Employee_Personal_Info_Update bsvc:version="v24.0">
<bsvc:Employee_Reference>
<bsvc:Integration_ID_Reference>
<bsvc:ID bsvc:System_ID="WD-EMPLID">#P_WORKDAY_ID<
+/bsvc:ID>
</bsvc:Integration_ID_Reference>
</bsvc:Employee_Reference>
<bsvc:Employee_Personal_Info_Data>
<bsvc:Personal_Info_Data>
<bsvc:Person_Data>
<bsvc:Contact_Data>
<bsvc:Internet_Email_Address_Data>
<bsvc:Email_Address>#P_VALUE</bsvc:Ema
+il_Address>
<bsvc:Usage_Data bsvc:Public="1">
<bsvc:Type_Reference bsvc:Primary=
+"1">WORK</bsvc:Type_Reference>
</bsvc:Usage_Data>
</bsvc:Internet_Email_Address_Data>
</bsvc:Contact_Data>
</bsvc:Person_Data>
</bsvc:Personal_Info_Data>
</bsvc:Employee_Personal_Info_Data>
</bsvc:Employee_Personal_Info_Update>
</soapenv:Body>
</soapenv:Envelope>
Keeping this in mind and searching around places I have built something that basically does make similar calls Below is my code
use SOAP::Lite +trace => [ transport => sub { print $_[0]->as_string }
+ ];
my $soapRequest = SOAP::Lite
-> uri('urn:com.workday/bsvc')
-> readable(1)
-> ns('urn:com.workday/bsvc','bsvc')
-> proxy('https://wd2-impl-services1.workday.com');
my $Username = SOAP::Header->name('wsse:Username' => $username);
my $Password = SOAP::Header->name('wsse:Password')
->attr({'Type'=>'http://docs.oasis-open.org
+/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText
+'})
->value($password);
my $Nonce = SOAP::Header->name('wsse:Nonce')
->attr({'EncodingType'=>'http://docs.oasis-
+open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base6
+4Binary'})
->value($nonce);
my $Created = SOAP::Header->name('wsu:Created' => $created);
my $UsernameToken = SOAP::Header->name('wsse:UsernameToken')
->attr ({
'wsu:Id'=>'UsernameToken-16',
'xmlns:wsu'=> 'http://docs.oasis-open.
+org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd'
})
->value(\SOAP::Header->value($Username,$Passwo
+rd,$Nonce,$Created));
my $security = SOAP::Header->name('wsse:Security')
->attr ({
'soapenv:mustUnderstand'=>'1',
'xmlns:wsse' => 'http://docs.oasis-open.org/ws
+s/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd'
})
->value(\SOAP::Header->value($UsernameToken));
my $Type_Reference = SOAP::Data ->name('bsvc:Type_Reference')
->attr({'bsvc:Primary'=>'1'})
->value('WORK');
my $Usage_Data = SOAP::Data ->name('bsvc:Usage_Data')
->attr({'bsvc:Public'=>'1'})
->value(\SOAP::Data->value($Type_Reference));
my $Email_Address = SOAP::Data ->name('bsvc:Email_Address')
->value('Hadoop_Test@XXX.co.uk');
my $Internet_Email_Address_Data = SOAP::Data ->name('bsvc:Internet_Em
+ail_Address_Data')
->value(\SOAP::Data->value($Email_Address,$Usa
+ge_Data));
my $Contact_Data = SOAP::Data ->name('bsvc:Contact_Data')
->value(\SOAP::Data->value($Internet_Email_Add
+ress_Data));
my $Person_Data = SOAP::Data ->name('bsvc:Person_Data')
->value(\SOAP::Data->value($Contact_Data));
my $Personal_Info_Data = SOAP::Data ->name('bsvc:Personal_Info_Data')
->value(\SOAP::Data->value($Person_Data));
my $Employee_Personal_Info_Data = SOAP::Data ->name('bsvc:Employee_Pe
+rsonal_Info_Data')
->value(\SOAP::Data->value($Personal_Info_Data
+));
my $Type_Reference = SOAP::Data ->name('bsvc:Type_Reference')
->attr({'bsvc:Primary'=>'1'})
->value(\SOAP::Data->value($Person_Data));
my $Employee_Personal_Info_Data = SOAP::Data ->name('bsvc:Employee_Pe
+rsonal_Info_Data')
->value(\SOAP::Data->value($Personal_Info_Data
+));
my $bsvc_ID = SOAP::Data ->name('bsvc:ID')
->attr({'bsvc:System_ID'=>'WD-EMPLID'})
->value('1234');
my $Int_ID = SOAP::Data ->name('bsvc:Integration_ID_Refer
+ence')
->value(\SOAP::Data->value($bsvc_ID));
my $Employee_Reference = SOAP::Data ->name('bsvc:Employee_Reference')
->value(\SOAP::Data->value($Int_ID));
my $params = SOAP::Data ->name('bsvc:Employee_Personal_Info_Update')
->attr({'bsvc:version'=>'v24.0'})
->value(\SOAP::Data->value($Employee_Reference
+));
$soapRequest->call($params,$Employee_Reference,$Employee_Personal_Info
+_Data,$security);
Error that Im getting is
HTTP/1.1 500 Internal Server Error
Connection: close
Date: Tue, 19 May 2015 11:38:55 GMT
Host: wd2-impl-services1.workday.com
TE: deflate,gzip;q=0.3
Server: Workday Integration Server /2015.20.649
Content-Type: text/xml
Client-Date: Tue, 19 May 2015 11:38:55 GMT
Client-Peer: 209.177.166.48:443
Client-Response-Num: 1
Client-SSL-Cert-Issuer: /C=US/O=GeoTrust Inc./CN=GeoTrust SSL CA - G4
Client-SSL-Cert-Subject: /C=US/ST=California/L=Pleasanton/O=Workday, I
+nc./CN=*.workday.com
Client-SSL-Cipher: AES128-SHA
Client-SSL-Warning: Peer certificate not verified
Client-Transfer-Encoding: chunked
Set-Cookie: WorkdayLB=36942858.1835.0000; path=/
Strict-Transport-Security: max-age=15638400; includeSubDomains
X-WD-REQUEST-ID: F5S|E139FF4A|555B20CF
X-Workday-Forwarded-For: 91.186.189.227
<?xml version="1.0" encoding="utf-8"?><SOAP-ENV:Envelope xmlns:SOAP-EN
+V="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-EN
+V:Fault xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xm
+lns:wd="urn:com.workday/bsvc"><faultcode>SOAP-ENV:Client.validationEr
+ror</faultcode><faultstring>Invalid request</faultstring></SOAP-ENV:F
+ault></SOAP-ENV:Body></SOAP-ENV:Envelope>