I am using Grails 2.2.3. I am not able to call a SOAP based JAVA web service with parameters from Grails. I am using wslite. We are able to call a SOAP based web service but when we are passing the parameter, at the server end always receiving as NULL.
My Groovy Code snippet is as follows:
package poc.service
@Grab(group='com.github.groovy-wslite', module='groovy-wslite', version='0.8.0')
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import wslite.soap.SOAPClient
import wslite.http.HTTPRequest
import wslite.http.HTTPResponse
class LoginService {
static def checkUserData(def _userName12) {
def client = new SOAPClient('http://192.168.14.147:9090/SOAPServiceDemo/authenticate')
def userNameValue = _userName12
def response = client.send(SOAPAction:'\"http://example.service.com/checkUser\"'){
header{
}
body {
checkUser(xmlns:'http://example.service.com/') {
userName12(_userName12)
}
}
}
println "User Name = " + response.checkUserResponse.return
}
static main(args){
def status = checkUserData('123')
println status
}
}
Below is another example which is working fine. It is copied from google.
package poc.service
import wslite.soap.SOAPClient
import wslite.http.HTTPRequest
import wslite.http.HTTPResponse
class MothersDay {
static def checkMotherData(String _userName12) {
def client = new SOAPClient('http://www.holidaywebservice.com/Holidays/US/Dates/USHolidayDates.asmx')
def response = client.send(SOAPAction:'http://www.27seconds.com/Holidays/US/Dates/GetMothersDay') {
body {
GetMothersDay('xmlns':'http://www.27seconds.com/Holidays/US/Dates/') {
year(_userName12)
}
}
}
println "Result = " + response.GetMothersDayResponse.GetMothersDayResult.toString()
}
static main(args){
def status = checkMotherData("2018")
}
}
Please let me know if you have any idea where I am lacking.
Thanks
Ravi