Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create SOAP 1.2 requests? #101

Open
t-arn opened this issue Jun 5, 2024 · 2 comments
Open

How to create SOAP 1.2 requests? #101

t-arn opened this issue Jun 5, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@t-arn
Copy link

t-arn commented Jun 5, 2024

I have a webservice which uses SOAP 1.2, but suds always creates a SOAP 1.1 message:

  • the namespace for the Envelope, Header and Body is for SOAP 1.1
  • in the SOAP Header, the WS-Addressing elements wsa:To and wsa:Action are missing
  • the Content-Type in the HTTP Header is for SOAP 1.1

Can I configure suds to create a SOAP 1.2 compliant message or is this feature missing?

The WSDL is here: https://wsg.isceco.admin.ch/Livestock/AnimalTracingWSDL/3

The generated XML is this (SOAP 1.1):

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://www.admin.ch/xmlns/Services/evd/Livestock/AnimalTracing/1" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/">
	<SOAP-ENV:Header/>
	<ns1:Body>
		<ns0:GetCodes>
			<ns0:p_ManufacturerKey xsi:nil="true"/>
			<ns0:p_LCID/>
			<ns0:p_Type xsi:nil="true"/>
		</ns0:GetCodes>
	</ns1:Body>
</SOAP-ENV:Envelope>

But the XML to be sent should be this (SOAP 1.2):

<SOAP-ENV:Envelope xmlns:ns1="http://www.admin.ch/xmlns/Services/evd/Livestock/AnimalTracing/1" xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope">
	<SOAP-ENV:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
		<wsa:To>https://wsg.isceco.admin.ch/Livestock/AnimalTracing/3</wsa:To>
		<wsa:Action>http://www.admin.ch/xmlns/Services/evd/Livestock/AnimalTracing/1/AnimalTracingPortType/GetCodes</wsa:Action>
	</SOAP-ENV:Header>
	<SOAP-ENV:Body>
		<ns1:GetCodes>
			<ns1:p_ManufacturerKey/>
			<ns1:p_LCID/>
			<ns1:p_Type/>
		</ns1:GetCodes>
	</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
@phillbaker
Copy link
Member

I took a quick look at the spec for soap 1.2 and it is quite different, so offhand I would say that the feature is not supported currently. Support for processing soap 1.2 replies has been added recently in #96 and #99, @eshizhan could you share how you're sending messages that receive soap 1.2 replies?

Otherwise, you could probably modify suds to have those features/construct the XML manually.

@phillbaker phillbaker added the enhancement New feature or request label Jun 18, 2024
@phillbaker
Copy link
Member

Here's an example approach from a stackoverflow/gist: https://stackoverflow.com/a/5262037 / https://gist.github.com/kgaughan/858851

A PR to incorporate that into the library would make sense to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants