Skip to Content
Technical Articles
Author's profile photo Fatih Pense

SAP PO SOAP Web Service with .NET Core client

Dear SAP PI/PO consultants,

It has been a while(3 years) since I wrote “.Net C# SOAP Web Service Client Example for SAP PI/PO Services”  .NET Core has gained popularity since then.

There is also a tendency to request REST services. However, I still think there are many valid use cases where SOAP is the better option. In order to speed up things, you can pass this blog post when you are working with .NET developers.


  • .NET Core SDK is installed

Generate Web Service Client Reference Classes & add libraries

Java wsimport equivalent of .NET Core is dotnet-svcutil

dotnet tool install --global dotnet-svcutil
dotnet tool list -g

Usually it adds the tools to the PATH. You may need to close & reopen the terminal. If that doesn’t work you should add this directory to Environment variable PATH:

Generate client classes with a WSDL:

dotnet-svcutil calculator-v1.wsdl

Generate classes with namespace:

dotnet-svcutil SI_SEND_ORG_DATA.wsdl -n *,MDP.MyAwesomePO.WSClient

This command will create a Service Reference. You can copy the class to your project. By default, it doesn’t create sync methods but there is an option for that(–sync). You can use –help to see options.

You have to add these packages to your project:

dotnet add package System.ServiceModel.Primitives
dotnet add package System.ServiceModel.Http

Don’t forget to run “dotnet restore”.

Use the Reference Classes

I like to set endpoint, username, and password programmatically. Binding configuration helps if you have to use basic authentication over HTTP.

String endpointurl = "http://hostname:port/XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_SENDER_SYSTEM0&receiverParty=&receiverService=&interface=SI_SEND_ORG_DATA&interfaceNamespace=";
BasicHttpBinding binding = new BasicHttpBinding();
//If you need HTTP with Basic Auth for internal network or dev environments. Otherwise remove these two lines:
binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;

EndpointAddress endpoint = new EndpointAddress(endpointurl);
var wsclient = new SI_SEND_ORG_DATAClient(binding, endpoint);
wsclient.ClientCredentials.UserName = "username";
wsclient.ClientCredential.Password = "password";

//Here you can use client
var request = new SI_SEND_ORG_DATA();
var response = await wsclient.SI_SEND_ORG_DATAAsync(request);


Beware of the integer/double

Coming from Java one of the things that bit me was setting an integer value for a SOAP request.

If you have a field like xsd:integer or xsd:double that maps to .Net built-in types which don’t have null, you have to set Specified value to true.

request.FirstNumber = 2;

This is a solution to differentiate between an element with 0 and no element. I’m sure you experienced this behavior while trying to send an integer with 0 value using ABAP Proxy. Because in ABAP, integer initial value is 0 and regarded as null for outbound XML processing. 🙂

See you in next blog posts!

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Raffael Herrmann
      Raffael Herrmann

      Hi Fatih,

      thanks for the blog. As a person with a C# background I really appreciate the blogs where SAP and .NET go hand-in-hand. One question: Why do you use the commandline util svcutil to generate the classes? On your first/old article you used the "Service Definition" gui from Visual Studio. As far as I know this is still available, even for .NET Core applications. Any specific reasons why you switched to the console? 🙂

      Author's profile photo Fatih Pense
      Fatih Pense
      Blog Post Author

      Hi Raffael,

      That is a good question. Yes, it may work with the GUI also!

      I have a few reasons:
      -I don't use C# and Visual Studio daily. Since .Net Core came out, I prefer terminal + VS Code to poke around. So I haven't checked Visual Studio GUI, to be honest.
      -As a reader I prefer command-line tutorials. I find them expressive, concise, and easy to reproduce.
      -This solution also works on Linux/Mac as a side benefit 🙂

      Thanks for your contribution.
      Regards, Fatih

      Author's profile photo Raffael Herrmann
      Raffael Herrmann

      Hi Fatih,

      thanks for your response. I would say these are valid points you listed. No further questions. 😉

      Author's profile photo Hakan Ertug
      Hakan Ertug

      Hello Fatih,

      I have successfully run the project, but the following error is returned from the service.

      System.ServiceModel.FaultException: Web service processing error; more details in the web service error log on provider side (UTC timestamp 20230321182957; Transaction ID 5D16C8ED31E9F1508197005056885816)

      How can I solve this error, can you help?




      Author's profile photo Diogo Pineda
      Diogo Pineda

      I have the same error, did you find a solution?

      I received from SAP team an answer like this:

      "This error could be caused by an invalid Web Service endpoint configuration on provider side or an incompatible SOAP request send by the Web Service consumer."

      The endpoint is up to date, so I believe there is an error in the call, I am doing the same thing as explained in this article.

      Author's profile photo Fatih Pense
      Fatih Pense
      Blog Post Author

      I discussed with him briefly, and the solution he found was to "send some parameters even when they are empty"

      I think getting the payload using some http tracker and then comparing it with a working SOAPUI example can give you some pointers.


      Author's profile photo Nahid Kose
      Nahid Kose

      Merhaba Hakan Bey,

      Eğer çözemediyseniz Soamanager 'ı açın. Logs and Traces sekmesinde SOA Runtime Error Log 'da detaylı görebilirsiniz.

      Author's profile photo Hakan Ertug
      Hakan Ertug

      Teşekkür ederim