I'm trying to perform soap action from C# code.
(btw its using non-standard api not available in projectserverservices.dll
)
Below working action through a web browser:
curl 'http://servername/pwa/_vti_bin/PSI/ProjectServer.svc' -H 'AsmxRoutedCall: true' -H 'Origin: http://servername' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.9,pl;q=0.8' -H 'User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36' -H 'Content-Type: text/xml; charset=UTF-8' -H 'Accept: */*' -H 'Referer: http://servername/pwa/Timesheet.aspx?tsUID=06b92bf0-806e-44d5-8c94-616c50471920&Source=http://servername/pwa/_layouts/pwa/timesheet/mytssummary.aspx' -H 'Cookie: ASP.NET_SessionId=kiihu1na3qifbojttxlauu3u; loginAsDifferentAttemptCount=; previousLoggedInAs=; PWA_Perf=0; OfflineClientInstalled=0; Ribbon.ContextualTabs.TiedMode.Home=1639690|-1|436|1720094216; PWA6637f161eb954cdc9bc621ab4641ce27CORPNET+AF8-TEST1=703012DE208D9FAF800770FA89647B17B21C3F5345D974ED344773B4049A0532D0757CD3B9103EEA8B41053A136ED4740A696A746CF5D3C5B272D0E94F935AF541C1EAD826B960CEBF9F63B6AB631A99576BD9DDE240346B12E247D3932E57CF850CD5066C0F360CDC2982E74C71D8727A2F2858B3DC9F0E9BAD53A90E9C3166BAC37B4853057B4ACD426B46AD1AF70E3C42406DAC090113F461529640E3E2EE3012C9339A62798236643998734757A0990F58F0B68483D4B3C0F570EDA809E2EDCA0AFC19333876B493CF6D43ECA43C9B6944D93C0DAAE641D32AAEFBF58DA878887838EE7BD87F9A9CDB0EFA09618EFDEFB7ED7E021A83EE1FB1B679D7D707A18C750AFEE9F63E844CBAB9B73B95389C56E46A2BE67C223A828AD2565966836B868C832F6D37FE35AFAE8D3003EEF2D91DE9A5DCE5C2E41C32AE4CF01A6A1C04A3405AC614089953C25D64CA44E016A7FD9958CB51339AE7BB542C291C5A44DDF61F33520BC62DED70E94FA48F4D157B714C9BFCE97DFC3338E1F6FCBEE8B310F137D612865B34B738087F4586FAFF30F2E15D70CBB96F969354B91B22B0FE11D3B12858B4778DF87F8F52FB4B6B9D0EDF16C6A84D783217EE81D780D59CAF40EE15B8EE2B6D89461C8DA6E7002D04CDA8EABE4C5DA4FEBD199A95A96A2D75F3FA9C14E2FEFE8B6C3D5C5D14D611A29FE5103226C8EDEDDC69A85B526DFEA6DB0EBEDCE8A4790E908C7251F0B7A3A8CEE0496C545AD8C58D77D29ED965A71D3E4227792E153BFE967B7A76EE2C92C86ABCE56D70E36F257C4B743F07CEA0E43F9A3CBC3F367D4257BF070AA654EAA07E182386CBFDBEE02D83C382504F844F15206643F3EAD946B392DBBDD41FFC412FBA06A8950A0D14588FF535B04B02BA0CCC5765F49C34541DCCA674E5DA4B3DBA75BA5CB208D0D7CBA8D7710315A6FD9D5DDDFA6C7D1A893F9FD6DD9DBF66DB545D9E73' -H 'Connection: keep-alive' -H 'SOAPAction: http://schemas.microsoft.com/office/project/server/webservices/PWA/TimeSheetSendGridUpdatesForSave' --data-binary '<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><TimeSheetSendGridUpdatesForSave xmlns="http://schemas.microsoft.com/office/project/server/webservices/PWA/"><jobUid>{f6880caf-9407-4454-ac60-84a30f57079c}</jobUid><tsUid>{06b92bf0-806e-44d5-8c94-616c50471920}</tsUid><changesJson>[{"updates":[{"type":2,"recordKey":"a81cc5f7-307a-46ce-a131-77e15468c29f","fieldKey":"TPD_col2a","newProp":{"dataValue":"600000","hasDataValue":true}},{"type":2,"recordKey":"a81cc5f7-307a-46ce-a131-77e15468c29f","fieldKey":"TPD_col2t","newProp":{"dataValue":"600000","hasDataValue":true}}],"changeNumber":1},{"updates":[{"type":2,"recordKey":"9f076a35-1394-4c6b-950a-aee4179febdc","fieldKey":"TPD_col2a","newProp":{"dataValue":"600000","hasDataValue":true}}],"changeNumber":2},{"updates":[{"type":2,"recordKey":"9f076a35-1394-4c6b-950a-aee4179febdc","fieldKey":"TPD_col2t","newProp":{"dataValue":"600000","hasDataValue":true}}],"changeNumber":3}]</changesJson><viewOptionsJson>{"dateFormat":3,"workFormat":2,"durationFormat":7,"filterType":5,"loadViewProperties":true,"newTasks":[],"importTasks":[],"removedLines":[]}</viewOptionsJson></TimeSheetSendGridUpdatesForSave></soap:Body></soap:Envelope>' --compressed --insecure
If i try to use it in a postman, it just does not work (Responds with 401 Not Authorized) using NTLM Auth (beta)
If i try to generate code from postman to C# (RestSharp) - same result 401
Any idea how should i create such a request?
I can use whatever technique, other than magic libraries (like projectserverservices.dll) :)
I have successfully authenticated the user by making a call from SOAP UI. As disclosed, i was performing undocumented call (without WSDL) so to make such a request from SOAP UI you have to create empty REST project and add a wsdl endpoint to it. If thats possible in SOAP UI then its for sure possible in C#.
Endpoint: http://servername
Resource: /pwa/_vti_bin/PSI/ProjectServer.svc
Headers:
AsmxRoutedCall: true
X-FORMS_BASED_AUTH_ACCEPTED: f
User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36
SOAPAction: http://schemas.microsoft.com/office/project/server/webservices/PWA/TimeSheetSendGridUpdatesForSave
Creating such call from C# is quite simple. If you're using HttpClient just use
httpClient.UseDefaultCredentials = true
# or
httpclient.Credentials = new NetworkCredentials(username,password,domain)
If youre using RestSharp then use:
client.Authenticator = new NtlmAuthenticator(new NetworkCredential(username,password,domain));