Easiest Way For a Novice Dev to Make a SOAP Service

I am a novice developer and am looking at starting a project to create a SOAP service to handle Windows WS-Print queries and jobs.


I’ve found that when Windows discovers a printer on the network it attempts to connect to it using WS-Print rather than IPP. I want to build a service to handle the WS-Print queries/requests and send the print jobs to CUPS.

What is the best route to do this? Python or Apache+PHP or something else? Is there a framework with documentation that I can use for this?

Even better. Is there something out there that does this already?

Oh jeez, SOAP and WSDL, blast from the past.

Between php and Python, definitely Python.

See this library: https://github.com/rayrapetyan/flask-spyne

Looking at the spec, in addition to main function and a server class, with some flask decorators, you’ll need some classes to hold the request/reply structures with fields relevant to you, and methods to do marshalling/unmarshalling to/from xml… that library will help, it even has some tiny examples.


Grab vscode, git for windows, python for windows, windows terminal, some kind of Linux command line environment like wsl; (unless you’re already using Linux in which case this is easier, grab what you’re missing). And get cracking.

Usual setup would be to start with a virtual environment for a project, that’s self contained in a directory/folder, and where you could pull in your dependencies without requiring admin/root privileges, or having to install them system wide and pollute the system you’re working on. python -m venv will bootstrap this folder for you. Then you “activate” that environment in your shell you’re working from, or where you’ll later run vscode in, and you can pip install whatever dependencies you need right there into your project dir (deps like that library above) and then just keep iterating (change code, run, change code, run, …).

You can save that directory in git for sharing, and later reuse. Speaking of git, typically you’d get something like precommit to run the black code formatter, and run reuse which will check your file headers for proper spdx license headers, and can also optionally run other linters and even invoke tests once you have them. All this to help you not check in broken code.

Once you have something that works, you can redistribute using git, or using pip. It’s also fairly easy to build tiny/small docker/oci images from pip requirements.

Any configuration you have (backends, port numbers), you can keep in a json file that you just load into a global variable on startup (easier than dealing with flags).

At some point you’ll want to write some automated test code, with fake IPP servers and fake ws-print clients. Come back if/when you’re ready to share code and have questions on testing.

Oh boy. When I say novice, I don’t mean fresh out of school. What little I know, I am self taught. Terms like “black code formatter” and “linters” are unknown to me. Is a “linter” a plug-in for syntax highlighting and the ability to understand when code is incorrect? I know what git is and what it is for, but have never used it. I will also have to Google how this python environment thing works.

My “development” experience is for automation as I am a SysAdmin for a school district (as well as a independent school evenings and weekends). I should have learned git a long time ago, for the automation tools and scripts I have written. I suppose now is the time.

My workstation is Linux and I already have visual studio code, so I have that going for me. I never knew you could do this environment thing with python. I will have to Google how that works too.

Thank you for the tools and frameworks to look into. I have some learning to do on some tools before I check out the Flask and flask-spyne documentation.

“black” is a code formatter for Python (one of many, that unlike many isn’t a pos). Python forces you to use indentation, and then there’s pep-8 which describes further how code should look like, but “black” takes it a step further and actually is a tool you can run to format your code for you.

You can integrate it with VS code through a vscode plugin, so that it does this formatting using the tool on save… (Otherwise you can run it by hand, but running all this tooling by hand gets old really quickly… it’s good to understand what your editor does behind the scenes… but no, you shouldn’t do it yourself)


A “linter” is another kind of tool, most linters only report stylistic code formatting issues, like “inconsistent use of single/double quotes” or “too much / too little indentation”. Since you use black as a formatter, you don’t care about the linter for those… What you need a linter for is to do light static analysis, for things like “missing return statements”, or “use of uninitialized variables”…

You can add type annotations to Python, and then tools like mypy which is a Python type checker can do even more static analysis for you, and prevent you from introducing bugs… Look into this later.

1 Like

I found that the printer I really need to handle WS-Print already does, so I just had to use avahi to reflect the mDNS queries across VLANs to make it discoverable to Windows. Since that happened this dropped to the bottom of the priority list and other projects are taking over (sad day).

However, i will return to this eventually. One day I will complete this.

I may not be able to work on this WS-Print thing for a while, however this is still really invaluable, so thank you for all this. It will help in other projects.