use of javax.wsdl.extensions.ExtensibilityElement in project tdi-studio-se by Talend.
the class ComponentBuilder method createSchemaFromTypes.
protected Vector<XmlSchema> createSchemaFromTypes(List<Definition> wsdlDefinitions) throws WSDLException {
Vector<XmlSchema> schemas = new Vector<XmlSchema>();
Set<String> imports = new HashSet<String>();
org.w3c.dom.Element schemaElementt = null;
Map importElement = null;
List includeElement = null;
for (Definition def : wsdlDefinitions) {
if (def.getTypes() != null) {
Vector schemaExtElem = findExtensibilityElement(def.getTypes().getExtensibilityElements(), "schema");
for (int i = 0; i < schemaExtElem.size(); i++) {
ExtensibilityElement schemaElement = (ExtensibilityElement) schemaExtElem.elementAt(i);
if (schemaElement != null && schemaElement instanceof UnknownExtensibilityElement) {
schemaElementt = ((UnknownExtensibilityElement) schemaElement).getElement();
String documentBase = ((javax.wsdl.extensions.schema.Schema) schemaElement).getDocumentBaseURI();
XmlSchema schema = createschemafromtype(schemaElementt, def, documentBase);
if (schema != null) {
schemas.add(schema);
if (schema.getTargetNamespace() != null) {
schemaNames.add(schema.getTargetNamespace());
}
}
importElement = ((javax.wsdl.extensions.schema.Schema) schemaElement).getImports();
if (importElement != null && importElement.size() > 0) {
findImportSchema(def, schemas, importElement, imports);
}
}
if (schemaElement != null && schemaElement instanceof javax.wsdl.extensions.schema.Schema) {
schemaElementt = ((javax.wsdl.extensions.schema.Schema) schemaElement).getElement();
String documentBase = ((javax.wsdl.extensions.schema.Schema) schemaElement).getDocumentBaseURI();
Boolean isHaveImport = false;
importElement = ((javax.wsdl.extensions.schema.Schema) schemaElement).getImports();
if (importElement != null && importElement.size() > 0) {
Iterator keyIterator = importElement.keySet().iterator();
// }
if (importElement.size() > 0) {
isHaveImport = true;
}
// validateImportUrlPath(importElement);
}
XmlSchema schema = createschemafromtype(schemaElementt, def, documentBase);
if (schema != null) {
schemas.add(schema);
if (schema.getTargetNamespace() != null) {
schemaNames.add(schema.getTargetNamespace());
}
}
if (isHaveImport) {
findImportSchema(def, schemas, importElement, imports);
}
}
}
}
}
return schemas;
}
use of javax.wsdl.extensions.ExtensibilityElement in project tdi-studio-se by Talend.
the class ComponentBuilder method buildOperation.
private OperationInfo buildOperation(OperationInfo operationInfo, BindingOperation bindingOper) {
Operation oper = bindingOper.getOperation();
operationInfo.setTargetMethodName(oper.getName());
Vector operElems = findExtensibilityElement(bindingOper.getExtensibilityElements(), "operation");
ExtensibilityElement operElem = (ExtensibilityElement) operElems.elementAt(0);
if (operElem != null && operElem instanceof SOAPOperation) {
SOAPOperation soapOperation = (SOAPOperation) operElem;
operationInfo.setSoapActionURI(soapOperation.getSoapActionURI());
} else if (operElem != null && operElem instanceof SOAP12Operation) {
SOAP12Operation soapOperation = (SOAP12Operation) operElem;
operationInfo.setSoapActionURI(soapOperation.getSoapActionURI());
}
BindingInput bindingInput = bindingOper.getBindingInput();
BindingOutput bindingOutput = bindingOper.getBindingOutput();
Vector bodyElems = findExtensibilityElement(bindingInput.getExtensibilityElements(), "body");
ExtensibilityElement bodyElem = (ExtensibilityElement) bodyElems.elementAt(0);
if (bodyElem != null && bodyElem instanceof SOAPBody) {
SOAPBody soapBody = (SOAPBody) bodyElem;
List styles = soapBody.getEncodingStyles();
String encodingStyle = null;
if (styles != null) {
encodingStyle = styles.get(0).toString();
}
if (encodingStyle == null) {
encodingStyle = DEFAULT_SOAP_ENCODING_STYLE;
}
operationInfo.setEncodingStyle(encodingStyle.toString());
operationInfo.setTargetObjectURI(soapBody.getNamespaceURI());
} else if (bodyElem != null && bodyElem instanceof SOAP12Body) {
SOAP12Body soapBody = (SOAP12Body) bodyElem;
String encodingStyle = null;
if (soapBody.getEncodingStyle() != null) {
encodingStyle = soapBody.getEncodingStyle().toString();
}
if (encodingStyle == null) {
encodingStyle = DEFAULT_SOAP_ENCODING_STYLE;
}
operationInfo.setEncodingStyle(encodingStyle.toString());
operationInfo.setTargetObjectURI(soapBody.getNamespaceURI());
}
Input inDef = oper.getInput();
if (inDef != null) {
Message inMsg = inDef.getMessage();
if (inMsg != null) {
operationInfo.setInputMessageName(inMsg.getQName().getLocalPart());
getParameterFromMessage(operationInfo, inMsg, 1);
operationInfo.setInmessage(inMsg);
}
}
Output outDef = oper.getOutput();
if (outDef != null) {
Message outMsg = outDef.getMessage();
if (outMsg != null) {
operationInfo.setOutputMessageName(outMsg.getQName().getLocalPart());
getParameterFromMessage(operationInfo, outMsg, 2);
operationInfo.setOutmessage(outMsg);
}
}
return operationInfo;
}
use of javax.wsdl.extensions.ExtensibilityElement in project tomcat by apache.
the class ServiceRefFactory method getSOAPLocation.
/**
* @param port analyzed port
* @return Returns the endpoint URL of the given Port
*/
private String getSOAPLocation(Port port) {
String endpoint = null;
@SuppressWarnings("unchecked") List<ExtensibilityElement> extensions = port.getExtensibilityElements();
for (Iterator<ExtensibilityElement> i = extensions.iterator(); i.hasNext(); ) {
ExtensibilityElement ext = i.next();
if (ext instanceof SOAPAddress) {
SOAPAddress addr = (SOAPAddress) ext;
endpoint = addr.getLocationURI();
}
}
return endpoint;
}
use of javax.wsdl.extensions.ExtensibilityElement in project tdi-studio-se by Talend.
the class AllTypeDialog method initSimpleType.
private void initSimpleType() throws WSDLException, URISyntaxException {
String url = URLValue;
XmlSchemaCollection schemaCollection = new XmlSchemaCollection();
WSDLFactory wsdlFactory = WSDLFactory.newInstance();
WSDLReader newWSDLReader = wsdlFactory.newWSDLReader();
newWSDLReader.setFeature(com.ibm.wsdl.Constants.FEATURE_VERBOSE, false);
URI wsdlURI = new URI(url);
Definition definition = newWSDLReader.readWSDL(url);
java.util.List<ExtensibilityElement> extensibilityElements = definition.getTypes().getExtensibilityElements();
String tmpTNName = "";
int tmpCount = 0;
for (ExtensibilityElement el : extensibilityElements) {
if (el instanceof Schema) {
Schema schema = (Schema) el;
// for bug 8674
// set base uri for relative path in schemaLocation.
schemaCollection.setBaseUri(schema.getDocumentBaseURI());
if (schema.getElement().getAttributeNode("targetNamespace") == null) {
tmpTNName = schema.getDocumentBaseURI() + "#type" + tmpCount;
schemaCollection.read(schema.getElement(), tmpTNName);
tmpCount++;
} else {
schemaCollection.read(schema.getElement());
}
}
}
Map namespaces = definition.getNamespaces();
// System.out.println(namespaces);
XmlSchema[] schemas = schemaCollection.getXmlSchemas();
java.util.List<String> labelList = new ArrayList<String>();
for (int i = 0; i < schemas.length; i++) {
XmlSchema schema = schemas[i];
XmlSchemaObjectTable types = schema.getSchemaTypes();
Iterator it = types.getValues();
while (it.hasNext()) {
XmlSchemaType type = (XmlSchemaType) it.next();
if (type instanceof XmlSchemaSimpleType) {
XmlSchemaSimpleType t = (XmlSchemaSimpleType) type;
String label = "simpletype:" + t.getName();
if (!labelList.contains(label)) {
labelList.add(label);
labelAndNameSpaceMap.put(label, t.getQName().toString());
}
}
}
}
allXMLSimpleTypeName = new String[labelList.size()];
for (int i = 0; i < labelList.size(); i++) {
allXMLSimpleTypeName[i] = labelList.get(i);
}
}
use of javax.wsdl.extensions.ExtensibilityElement in project tdi-studio-se by Talend.
the class ComponentBuilder method buildOperations.
private List buildOperations(Binding binding) {
List operationInfos = new ArrayList();
List operations = binding.getBindingOperations();
if (operations != null && !operations.isEmpty()) {
Vector soapBindingElems = findExtensibilityElement(binding.getExtensibilityElements(), "binding");
// default
String style = "document";
ExtensibilityElement soapBindingElem = (ExtensibilityElement) soapBindingElems.elementAt(0);
if (soapBindingElem != null && soapBindingElem instanceof SOAPBinding) {
SOAPBinding soapBinding = (SOAPBinding) soapBindingElem;
style = soapBinding.getStyle();
} else if (soapBindingElem != null && soapBindingElem instanceof SOAP12Binding) {
SOAP12Binding soapBinding = (SOAP12Binding) soapBindingElem;
style = soapBinding.getStyle();
}
Iterator opIter = operations.iterator();
while (opIter.hasNext()) {
alldExtendtion.clear();
BindingOperation oper = (BindingOperation) opIter.next();
Vector operElems = findExtensibilityElement(oper.getExtensibilityElements(), "operation");
ExtensibilityElement operElem = (ExtensibilityElement) operElems.elementAt(0);
if (operElem != null && operElem instanceof SOAPOperation) {
OperationInfo operationInfo = new OperationInfo(style);
buildOperation(operationInfo, oper);
operationInfos.add(operationInfo);
} else if (operElem != null && operElem instanceof SOAP12Operation) {
OperationInfo operationInfo = new OperationInfo(style);
buildOperation(operationInfo, oper);
operationInfos.add(operationInfo);
}
}
}
return operationInfos;
}
Aggregations