AnsweredAssumed Answered

PPM using wsdl soap with .net to write to an object

Question asked by JonathanTorres1355981 on Jan 16, 2019
Latest reply on Jan 25, 2019 by gcubed

All,

 I'm trying to do a reference to wsdl using soap to write to an object (below example is projects). I tried looking at VB.NET SOAP Integration Sample for Ideas which was great. But if anyone else can provide examples as I'm not sure what to put in header and what values should go under it. Any help would be appreciated.

public Boolean LoadExecution()
{
ppm_objects.AllObjectsService ds = new ppm_objects.AllObjectsService();
ppm_objects.Login login = new ppm_objects.Login();
ppm_objects.Auth auth = new ppm_objects.Auth();
try
{
login.Username = Common.GetKeyValue("ppm_user");
login.Password = Common.GetKeyValue("ppm_pwd");
//login.TenantID=
var sessionId = ds.Login(login);
if (!String.IsNullOrEmpty(sessionId))
{
auth.SessionID = sessionId;
ds.AuthValue = auth;
}
if (String.IsNullOrEmpty(sessionId))
{ //We didn't login for some reason
return false;
}
//XmlTypeMapping myTypeMapping =new SoapReflectionImporter().ImportTypeMapping(typeof(DepartmentsService));
//XmlSerializer mySerializer = new XmlSerializer(myTypeMapping);
XmlDocument request = new XmlDocument();
request.LoadXml(@"<NikuDataBus xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""
xsi:noNamespaceSchemaLocation=""../xsd/nikuxog_department.xsd"">
<Header action=""write"" externalSource=""NIKU"" objectType=""department"" version=""8.0""/>
<Department>
<Department entity=""temp"">
<Departments>
<ColumnValue name=""partition_code"">NIKU.ROOT</ColumnValue>
</Departments>
<Description>
<ColumnValue name=""partition_code"">NIKU.ROOT</ColumnValue>
</Description>
<LocationAssociations>
<ColumnValue name=""partition_code"">NIKU.ROOT</ColumnValue>
</LocationAssociations>
<Budget>
<ColumnValue name=""partition_code"">NIKU.ROOT</ColumnValue>
</Budget>
<Child Department>
<ColumnValue name=""partition_code"">NIKU.ROOT</ColumnValue>
</Child Department>
</Idea>
</Department>
</NikuDataBus>");
//ds.WriteDepartment()

try

{

ds.Logout(sessionId);

}

catch (ProtocolException)

{

// ignore throw;

}

}
catch (Exception ex)

{

Common.WriteLog(String.Format("{0:MM/dd/yyyy HH:mm:ss}", DateTime.Now), Common.GetKeyValue("logpath"));
Common.WriteLog(ex.ToString(), Common.GetKeyValue("logpath"));

}


return true;
}

Outcomes