Forum Discussion

premjeetsinghho's avatar
premjeetsinghho
New Contributor
12 years ago

Get request parameter data types

Hello,

I am trying to get all the methods, their parameters and the parameters data types like Boolean, String etc. from a Wsdl.
Here's my code

public class SoapUIClass {

public static void main(String[] args) throws Exception {
soapTest();
}

public static void soapTest() throws Exception

{

WsdlProject project = new WsdlProject();
WsdlInterface iface = WsdlInterfaceFactory.importWsdl(project,
"http://www.dneonline.com/calculator.asmx?WSDL", true)[0];

Operation[] operations = iface.getAllOperations();

for (Operation o : operations) {
System.out.println("\n");
System.out.println(o.getName());
List<Request> childrens = o.getRequestList();
for (Request c : childrens) {
System.out.println(c.getRequestContent());
}

}

System.exit(0);
}
}

It gives me the output like

Add
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
<soapenv:Header/>
<soapenv:Body>
<tem:Add>
<tem:intA>?</tem:intA>
<tem:intB>?</tem:intB>
</tem:Add>
</soapenv:Body>
</soapenv:Envelope>

My requirement is to get the data type of intA and intB. How can i get that?

Also getRequestContent() returns a xml. Is there any way i can get the list of parameters with their data types?

3 Replies

  • nmrao's avatar
    nmrao
    Community Hero
    I think wsdl might be using and xml schema definition and it should contain the data types.
  • Yes, surely it contains the data types.

    My question is how to get them using SoapUI api?
  • nmrao's avatar
    nmrao
    Community Hero
    I see your example code which i could not relate. Does your wsdl contains in line schema?

    What I know is you can use some code generator which will generate the classes for the wsdl, you may generate it client side code or service side code.
    Please see http://axis.apache.org/axis2/java/core/ ... lugin.html

    then probably you will be able to achieve what you are looking for, I hope.