Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

workday webservices using Perl

by PERL_fresher (Novice)
on May 19, 2015 at 11:53 UTC ( [id://1127113]=perlquestion: print w/replies, xml ) Need Help??

PERL_fresher has asked for the wisdom of the Perl Monks concerning the following question:

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>

Replies are listed 'Best First'.
Re: workday webservices using Perl
by ww (Archbishop) on May 19, 2015 at 14:27 UTC

    Do the messages

    1. "Client-SSL-Warning: Peer certificate not verified"
      and
    2. "<faultcode>SOAP-ENV:Client.validationError</faultcode><faultstring>Invalid request</faultstring></SOAP-ENV:Fault>"

    offer any insight?

Re: workday webservices using Perl
by Anonymous Monk on May 19, 2015 at 12:24 UTC
    So how does the soap your prog sent differ from expected?

      My Soap envolope has some extra characters

      <soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:bsvc="urn:com.workday/bsvc" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      where only
      <soapenv:Envelope xmlns:bsvc="urn:com.workday/bsvc" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
      is required
        I think soap lite docs say something about soapenv vs. soapenc

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1127113]
Approved by GotToBTru
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-20 00:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found