envelopeAttributes is not used
bresche opened this issue · comments
in the example code the envelopeAttributes is set:
def client2 = new SOAPClient('http://www.holidaywebservice.com/Holidays/US/Dates/USHolidayDates.asmx')
def response = client2.send(SOAPAction:'http://www.27seconds.com/Holidays/US/Dates/GetMothersDay',
connectTimeout:5000,
readTimeout:10000,
useCaches:false,
followRedirects:false,
sslTrustAllCerts:true) {
version SOAPVersion.V1_2 // SOAPVersion.V1_1 is default
soapNamespacePrefix "SOAP" // "soap-env" is default
encoding "ISO-8859-1" // "UTF-8" is default encoding for xml
envelopeAttributes "xmlns:hr":"http://example.org/hr"
header(mustUnderstand:false) {
auth {
apiToken("1234567890")
}
}
body {
GetMothersDay('xmlns':'http://www.27seconds.com/Holidays/US/Dates/') {
year(2011)
}
}
}
the generated soap request looks like that:
<tag0:Envelope xmlns:tag0="http://www.w3.org/2003/05/soap-envelope">
<tag0:Header mustUnderstand="false">
<auth>
<apiToken>1234567890</apiToken>
</auth>
</tag0:Header>
<tag0:Body>
<tag1:GetMothersDay xmlns:tag1="http://www.27seconds.com/Holidays/US/Dates/">
<tag1:year>2011</tag1:year>
</tag1:GetMothersDay>
</tag0:Body>
</tag0:Envelope>
but it should looks like:
<hr:Envelope xmlns:hr="http://example.org/hr">
...
I get the following raw request:
POST http://www.holidaywebservice.com/Holidays/US/Dates/USHolidayDates.asmx HTTP/1.1
Content-Type: application/soap+xml; charset=ISO-8859-1; action="http://www.27seconds.com/Holidays/US/Dates/GetMothersDay"
Connection: Close
Accept-Encoding: gzip
Cache-Control: no-cache
Pragma: no-cache
User-Agent: Java/1.7.0_79
Host: www.holidaywebservice.com
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
Content-Length: 425
<?xml version='1.0' encoding='ISO-8859-1'?>
<SOAP:Envelope xmlns:SOAP='http://www.w3.org/2003/05/soap-envelope' xmlns:hr='http://example.org/hr'>
<SOAP:Header mustUnderstand='false'>
<auth>
<apiToken>1234567890</apiToken>
</auth>
</SOAP:Header>
<SOAP:Body>
<GetMothersDay xmlns='http://www.27seconds.com/Holidays/US/Dates/'>
<year>2011</year>
</GetMothersDay>
</SOAP:Body>
</SOAP:Envelope>
Using the following code
@Grab('com.github.groovy-wslite:groovy-wslite:1.1.2')
import wslite.soap.*
def client2 = new SOAPClient('http://www.holidaywebservice.com/Holidays/US/Dates/USHolidayDates.asmx')
def response = client2.send(SOAPAction:'http://www.27seconds.com/Holidays/US/Dates/GetMothersDay',
connectTimeout:5000,
readTimeout:10000,
useCaches:false,
followRedirects:false,
sslTrustAllCerts:true) {
version SOAPVersion.V1_2 // SOAPVersion.V1_1 is default
soapNamespacePrefix "SOAP" // "soap-env" is default
encoding "ISO-8859-1" // "UTF-8" is default encoding for xml
envelopeAttributes "xmlns:hr":"http://example.org/hr"
header(mustUnderstand:false) {
auth {
apiToken("1234567890")
}
}
body {
GetMothersDay('xmlns':'http://www.27seconds.com/Holidays/US/Dates/') {
year(2011)
}
}
}