How to get complex types from WSDL file programatically?
I have to get complex types from Adobe echo sign. https://secure.echosign.com/services/EchoSignDocumentService19?wsdl
There are already some questions on this topic but none has useful answer. So, I am invoking this question again.
This is the code I have written, but no luck.
public class wsdlReader {
public static void main(String[] args) {
try {
WSDLFactory factory = WSDLFactory.newInstance();
WSDLReader reader = factory.newWSDLReader();
reader.setFeature("javax.wsdl.verbose", false);
reader.setFeature("javax.wsdl.importDocuments", true);
Definition def = reader.readWSDL(null, "https://secure.echosign.com/services/EchoSignDocumentService19?wsdl");
Map services = def.getServices();
Iterator servicesIterator = services.values().iterator();
def.getTypes();
while (servicesIterator.hasNext())
{
Service service = (Service) servicesIterator.next();
Map ports = service.getPorts();
Iterator portsIterator = ports.keySet().iterator();
while (portsIterator.hasNext())
{
String strPort = portsIterator.next().toString();
Port port = service.getPort(strPort);
Binding binding = port.getBinding();
PortType portType = binding.getPortType();
List operations = portType.getOperations();
Iterator opIterator = operations.iterator();
while (opIterator.hasNext())
{
Operation operation = (Operation) opIterator.next();
if (!operation.isUndefined())
{
Input inDef = operation.getInput();
Map params = operation.getInput().getMessage().getParts();
Iterator paramsIterator = params.keySet().iterator();
int n = 1;
StringBuffer sbParams = new StringBuffer();
while (paramsIterator.hasNext())
{
PartImpl iParam = (PartImpl) params.get(paramsIterator.next());
if (iParam.getTypeName() == null) {
sbParams.append(iParam.getElementName().getLocalPart()).append(" p").append(n).append(",");
n++;
} else if (iParam.getElementName() == null) {
sbParams.append(iParam.getTypeName().getLocalPart()).append(" ").append(iParam.getName()).append(", ");
} else {
System.err.println("sicis .:.");
}
}
System.out.println(sbParams);
if (sbParams.length() > 0) {
sbParams.delete(sbParams.length() - 1, sbParams.length());
}
}
}
}
}
} catch (WSDLException e) {
e.printStackTrace();
}
}
}
Any help or suggestion will be really helpful.
Thanks