0

Recently i started creating a Xamarin-iOS app, which consume ProjectServer PSI WebService. When I add the PSI as WebReference and I try to access the PSI methods I am getting 401 unauthorised error. Interestingly It works fine in local network and but getting error in enterprise network. So I plan to change WebReference to SOAP - HttpwebRequest method.

This is what i Tried

I am trying to get the resource id using this url BaseAddress + pwa/_vti_bin/PSI/Resource.asmx?op=GetCurrentUserUid

<?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>  
<GetCurrentUserUid xmlns="http://schemas.microsoft.com/office/project/server/webservices/Resource/" />
</soap:Body> 

I am passing the above code as body.

But when i execute this using HttpWebRequest I am getting the error HttpStatusCode InternalServerError System.Net.HttpStatusCode

Also in the response i found the following xml response.

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>  
<s:Fault>

xmlns:a="http://Microsoft.Office.Project.Server">a:ProjectServerFaultCode
</faultcode>
<faultstring>
Unhandled Communication Fault occurred
</faultstring>
<detail>
<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">
Object reference not set to an instance of an object.</string></detail>   
</s:Fault>
</s:Body>
</s:Envelope>

I don't know what' wrong. So my question are,

Is it possible to call PSI method using HttpWebRequest If not what is the alternative.

Please help. Thanks in advance.

StezPet
  • 2,430
  • 2
  • 27
  • 49

1 Answers1

1

Here's a few items:

  • The URL should be: BaseAddress + pwa/_vti_bin/PSI/Resource.asmx
  • SOAP Action Header: ReadResource
  • In your example, the soap:body should be...

    <SOAP:BODY>
    <ReadResource>
    <resourceUid>value</resourceUid>
    </ReadResource>
    </SOAP:BODY>
    
thedoubleu
  • 31
  • 3