Contributions
Re: How to add parameter in SOAPUI-4.5.0 jar java in soap request
Hi Rupert, Thanks, As per your suggestions, I have created a new groovy class and write the below method in groovy class class ParseXML { def parseFile(xmlString) { def envelopeNode = new XmlSlurper().parseText(requestXMLString) envelopeNode.Body.CreateDevice.name="testSoapUI" return envelopeNode } } But am unable to set the parameter in the request In java code: ------------- String requestContent = wsdlOperation.createRequest(true).toString(); System.out.println(requestContent); ParseXML xml = new ParseXML(); // groovy file name Object obj = xml.parseFile(requestContent); But the envelopeNode returns - ?? My request is (requestContent): <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://soap.xxx.com"> <soapenv:Header/> <soapenv:Body> <soap:CreateDevice> <!--Optional:--> <soap:name>?</soap:name> <!--Optional:--> <soap:size>?</soap:size> </soap:CreateDevice> </soapenv:Body> </soapenv:Envelope> Kindly guide me..3.1KViews0likes0CommentsHow to add parameter in SOAPUI-4.5.0 jar java in soap request
I have an WSDL soap service, Am using SOAPUI-4.5.0 jar in java to generate all the operations, am creating a new request by using WsdlOperation.createRequest(true); but am unable to pass the parameter to the created request. Java code: WsdlInterface[] wsdls = WsdlImporter.importWsdl(project, "http://xx.xxx.xxx:3263/xxxx?Wsdl"); WsdlInterface iwsdl= wsdls[0]; WsdlOperation wsdlOperation=iwsdl.getOperationByName("CreateDevice"); WsdlRequest request = wsdlOperation.addNewRequest("My request"); String requestContent = wsdlOperation.createRequest(true); requestContent value: --------------------- <xml-fragment xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://soap.xxxx.com"> <soapenv:Header/> <soapenv:Body> <soap:Create> <!--Optional:--> <soap:name>?</soap:name> <!--Optional:--> <soap:size>?</soap:size> </soap:CreateDevice> </soapenv:Body> </xml-fragment> request.setRequestContent(requestXmlObject.toString()); request.setEndpoint("http://xx.xxx.xxx:3263/xxxx"); WsdlSubmitContext wsdlSubmitContext = new WsdlSubmitContext(request); WsdlSubmit<?> subm = request.submit(wsdlSubmitContext, false); Response response = subm.getResponse(); name = String type size = int type response value: --------------- <faultstring xml:lang="en-US">The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://soap.xxxx.com:size. The InnerException message was 'There was an error deserializing the object of type System.Int32. The value '?' cannot be parsed as the type 'Int32'.'. Please see InnerException for more details.</faultstring> Am getting the above error, while passing the request. I need to pass parameter for name and size. Please share the code3.2KViews0likes3Comments