bigrollo
Senior Member.
1090 views

Looking for SoapClient connection code for C#

I'm kinda a new to Web Services and definitely using them with HP PPM. I'm trying to connect to the "createRequest" method inside of the DemandService?wsdl. I'm able to add the WSDL to my web references and see all of the methods to call but I'm a little uncertain of the correct syntax to make the initial "SoapClient" connection to send the request. The code provided in the downloadable source project seems to be a bit dated and written in Java. Was hoping someone would have a more current example of the SoapClient connect string code in C#  so I can use that connection to call the "createRequest" method. Below is the source code provided in the downloadable project.  I was able to write all the code to pass to the "createRequest" method to send the values but don't really know how to setup the SoapClient connect part to send the values. Directly below is a soapClient connect I use for method calls to wsdls in Service Manager that I have been able to do successfully but they seem to be a bit different in PPM.  Any help would be appreciated. 

// Soap Client Code for methods calls to Service Manager WSDLS I use successfully //

var soapClient = new IncidentManagement();

var netCredential = new NetworkCredential("myUser", "myPassword");

var uri = new Uri(soapClient.Url);

ICredentials credentials = netCredential.GetCredential(uri, "Basic");

 soapClient.Credentials = credentials;

//

 

// Code provided by HP PPM Sample Project Download for Soap Connect//

 

static void Main(string[] args){

string hostURL;

Console.Write("Please enter the URL of the webservice host, without the path name of the service file, and press Enter.");

Console.WriteLine(" [Leave blank for http://localhost:8080]");

 hostURL = Console.ReadLine().Trim();

if (hostURL.Length == 0) hostURL = "http://localhost:8080";

if (!hostURL.EndsWith("/")) hostURL += "/";

hostURL += "itg/ppmservices/ProjectService?wsdl";

Console.WriteLine("\nCreating service proxy...");

ProjectServiceWse serviceProxy = new ProjectServiceWse();

serviceProxy.Url = hostURL;

// Setting HTTP basic authentication

//Console.WriteLine("\nSetting http basic authentication headers...");

//NetworkCredential netCredential = new NetworkCredential("admin", "admin");

//Uri uri = new Uri(hostURL);

//ICredentials credentials = netCredential.GetCredential(uri, "Basic");

//serviceProxy.PreAuthenticate = true;

//serviceProxy.Credentials = credentials;

Console.WriteLine("\nSetting authentication policy...");

UsernameOverTransportAssertion policyAssertion = new UsernameOverTransportAssertion();

policyAssertion.UsernameTokenProvider = new UsernameTokenProvider("admin", "admin");

Policy p = new Policy(policyAssertion);

 

serviceProxy.SetPolicy(p);

}

// End of sample project Soap Client Code...

 

0 Likes
2 Replies
Wesly_Q_PPM Valued Contributor.
Valued Contributor.

Re: Looking for SoapClient connection code for C#

Hello 

My name is Wesly Quesada, I would like to let you know that the examples of the Web Services Toolkit of PPM (Which you can download from the following URL: <Host>:<Port>/itg/download/webservice/webservice_toolkit.zip ) are Java Program Lenguage at this moment there is not the same example codes in C#. These type of costumizations need to be handled by the Professional Services Organization (PSO), this is Professional Services Organization- it is the consultant who can come onsite and help you to perform this costumization.

I would like to attach the guide "Web Services Guide" and Web Services Programmer's Guide, where you can find more details about the web services toolkit and all example codes.

 

 

 

0 Likes
Wesly_Q_PPM Valued Contributor.
Valued Contributor.

Re: Looking for SoapClient connection code for C#

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.