grouser
grouser

Reputation: 628

connect to WCF net.tcp protocol from Python

I am using a SOAP API using the library suds but not sure if I can just use a Python library for this problem.

Firstly, I connect to the API.

client.Client("http://localhost:8003/mex")

Once I am connected, can see every method in the API but the problem is when I try to call one:

client.service.MethodX()
urllib2.URLError: <urlopen error unknown url type: net.tcp>

I have spoken with the provider and at runtime, the API is exposed at net.tcp://localhost:8002/PublicAPI. I don't manage to find a solution about this problem without creating a bridge developed in C# to send the data to my Python script.

Upvotes: 1

Views: 4584

Answers (1)

dmusial
dmusial

Reputation: 1564

Firstly, if the service is exposed using NetTcpBinding there is no way for you to consume it using a SOAP-based library because net.tcp uses binary message encoding (message is not transported in SOAP format). Furthermore (AFAIK) WCF's net.tcp is not conforming to any industry-wide standards and is designed for high performance communication between .NET apps, not for interoperability. In light of that, i doubt you'll be able to consume the service directly from Python in any way. Possible options in that case are:

  1. Create a .NET bridge and consume that from Python (as you've mentioned)
  2. Ask the service provider to expose an additional endpoint with ie. basicHttpBinding

Upvotes: 3

Related Questions