spring-cloud-contract icon indicating copy to clipboard operation
spring-cloud-contract copied to clipboard

Feature request. SOAP DSL

Open artemptushkin opened this issue 4 years ago • 8 comments

Enhancement.

Hi everyone!

I'd like to suggest a feature to add DSL classes for easy SOAP contracts writing and providing a convenient standard. SOAP looks like the standard HTTP synchronous contracts but has specific constants.

Goal: To have a convenient DSL for SOAP contracts. To handle XML contracts properly because currently there are a few bugs and misleadings by refactoring code during the feature implementation

Target DSL example:

Contracts.make {
	request {
		soap {
			url '/some/soap/url'
			body (
				equalToXml(
					file('__files/example.xml')
				)
			)
		}
	}
	response {
		status 200
		soap {
			body(
				file('__files/example-response.xml')
			)
		}
	}
}

Another variant:

soap {
			wsld '/some/soap/url.wsdl'
}

Closure soap will incupsuliate http header Content-Type: text/xml and method POST on request and header Content-Type: text/xml on response

artemptushkin avatar Aug 14 '19 16:08 artemptushkin

Why not just simple do a plain old xml ? Soap is nothing else but an XML

marcingrzejszczak avatar Aug 14 '19 16:08 marcingrzejszczak

because it can be easier to understand one for some people with low tech expertize, incapsulate default constants and will fail on invalid (not xml) passed body to a contract on generating stub or test

add enhancement label, please

artemptushkin avatar Aug 14 '19 16:08 artemptushkin

because it can be easier to understand one for some people with low tech expertize, incapsulate default constants and will fail on invalid (not xml) passed body to a contract on generating stub or test

we can describe it in the docs

  • create a file with your example SOAP message
  • pass the contentType(applicationXml())
  • read the contents of the body from file
  • you're done

add enhancement label, please

I don't yet see this as an enhancement. Maybe it's just a documentation extension. WDYT @OlgaMaciaszek

BTW if you want to first chat about making an enhancement we can chat on Gitter if you want to https://gitter.im/spring-cloud/spring-cloud-contract

marcingrzejszczak avatar Aug 14 '19 16:08 marcingrzejszczak

I agree with @marcingrzejszczak ; @artemptushkin would you like to contribute such a section to the documentation?

OlgaMaciaszek avatar Aug 14 '19 17:08 OlgaMaciaszek

@OlgaMaciaszek I think you meant @artemptushkin ;)

marcingrzejszczak avatar Aug 16 '19 21:08 marcingrzejszczak

yes. sorry for that. updated.

OlgaMaciaszek avatar Aug 16 '19 22:08 OlgaMaciaszek

Okay, I'll add doc for SOAP to how to section, I guess. Maybe later we'll be back to dsl :)

artemptushkin avatar Aug 16 '19 22:08 artemptushkin

adding my 2 cents, I think it may be worth to look at Apache Axis2, which offers highly comprehensive java support for SOAP. Some bits surely will be useful

Sam-Kruglov avatar Sep 10 '19 06:09 Sam-Kruglov