Quantcast
Channel: New board topics in SmartBear Community
Viewing all articles
Browse latest Browse all 21061

How to add parameter in SOAPUI-4.5.0 jar java in soap request

$
0
0

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 code


Viewing all articles
Browse latest Browse all 21061

Trending Articles