[Users] FAULT: Add a modelReference element in WSDL document
bronko85
bronko85 at gmail.com
Wed Mar 16 11:00:18 CET 2011
I'm using EasyWSDL APIs to create, from a WSDL document (http://soap.amazon.com/schemas2/AmazonWebServices.wsdl), an annotated SAWSDL document.
If I try to add a modelReference element in the Operation tag, it doesn't function. It generate a WSDL file without modelReference attribute.
Although I try, with the same code, adding a modelReference element in the Interface tag, it functions.
This is the Java code:
Code:
public static void writeOperationElement(String wsdlURI) {
try {
SAWSDLReader sawsdlReader = SAWSDLFactory.newInstance().newSAWSDLReader();
SAWSDLWriter sawsdlWriter = SAWSDLFactory.newInstance().newSAWSDLWriter();
Description des = sawsdlReader.read(new URL(wsdlURI));
List<Operation> operations = des.getInterfaces().get(0).getOperations();
System.out.println("Number of operations in document: " + operations.size());
for(Operation operation: operations){
System.out.println("Number of references in \"" + operation.getQName() + "\" operation (previous adding): " + operation.getModelReference().size());
operation.addModelReference(new URI("http://prova1.com/interface"));
operation.addModelReference(new URI("http://prova2.com/interface"));
System.out.println("Number of references in \"" + operation.getQName() + "\" operation (after adding) : " + operation.getModelReference().size());
}
operations.get(0).addModelReference(new URI("http://test.com/wsdl"));
Document doc = sawsdlWriter.getDocument(des);
Transformer transformer = TransformerFactory.newInstance().newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
StreamResult result = new StreamResult(new FileWriter("sampleDocument.wsdl"));
DOMSource source = new DOMSource(doc);
transformer.transform(source, result);
}
catch (Exception e) {
e.printStackTrace();
}
}
Can anyone help me?
[Crying or Very sad]
-------------------- m2f --------------------
Subscribe/Unsubscribe emails notifications.
Response to this email will be posted on the Petals forum.
Please delete the existing text before responding :)
Read the topic online:
http://forum.petalslink.com/viewtopic.php?p=31149#31149
-------------------- m2f --------------------
More information about the Users
mailing list