Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
fatihpense
Active Contributor
I was helping a friend connecting to a PO Web Service from .Net. It was not straightforward enough and I haven't found a good example so I decided to share the code with you. For simplicity, It is a console application.

(Update: If you are using .Net Core or .Net version > 5, check out my other post here)

Features are:

  • Using SOAP 1.1

  • Basic authentication over HTTP

  • Specifying endpoint


 

First, we add a Service Reference



 

We can give a Web URL or file path:



 

Add your C# namespace to the main class.
using ConsoleApplication4.ServiceReference2;

 

And the example code block:
static void Main(string[] args)
{

BasicHttpBinding binding = new BasicHttpBinding();
binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;

EndpointAddress endpoint = new EndpointAddress("http://hostname:port/XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_SENDER_SYSTEM0&receiverParty=&receiverService=&interface=SI_SEND_ORG_DATA&interfaceNamespace=http://example.com/HR/OrganisationData");
SI_SEND_ORG_DATAClient client = new SI_SEND_ORG_DATAClient(binding, endpoint);

client.ClientCredentials.UserName.UserName = "Username";
client.ClientCredentials.UserName.Password = "Password";

ZHRS_SEND_ORG_LINE[] result = client.SI_SEND_ORG_DATA("1234");

System.Console.WriteLine(result[0].VORNA);
System.Console.ReadLine();
}

If you have any questions, please ask in the comments.

Regards,

Fatih
6 Comments
Labels in this area