Skip to Content

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.

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

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply