use of org.apache.cxf.binding.corba.wsdl.CorbaType in project cxf by apache.
the class WSDLParameter method getSchemaTypeName.
private static QName getSchemaTypeName(WSDLToCorbaBinding wsdlToCorbaBinding, XmlSchemaType schemaType, XmlSchemaAnnotation annotation, QName typeName, boolean nill) throws Exception {
QName idltype = null;
CorbaType corbaTypeImpl = null;
corbaTypeImpl = wsdlToCorbaBinding.getHelper().convertSchemaToCorbaType(schemaType, typeName, null, annotation, false);
if (corbaTypeImpl == null) {
throw new Exception("Couldn't convert schema type to corba type : " + typeName);
}
if (nill) {
QName qname = corbaTypeImpl.getQName();
idltype = wsdlToCorbaBinding.getHelper().createQNameCorbaNamespace(qname.getLocalPart() + "_nil");
} else {
idltype = corbaTypeImpl.getQName();
}
return idltype;
}
use of org.apache.cxf.binding.corba.wsdl.CorbaType in project cxf by apache.
the class WSDLParameter method getIdlType.
private static QName getIdlType(WSDLToCorbaBinding wsdlToCorbaBinding, XmlSchemaType schemaType, QName typeName, boolean nill) throws Exception {
QName idltype = null;
CorbaType corbaTypeImpl = null;
if (schemaType == null) {
corbaTypeImpl = (CorbaType) WSDLToCorbaHelper.CORBAPRIMITIVEMAP.get(typeName);
if (nill) {
QName qname = corbaTypeImpl.getQName();
idltype = wsdlToCorbaBinding.getHelper().createQNameCorbaNamespace(qname.getLocalPart() + "_nil");
} else {
if (corbaTypeImpl == null) {
XmlSchemaObject schemaObj = getSchemaObject(wsdlToCorbaBinding, typeName);
XmlSchemaAnnotation annotation = null;
if (schemaObj instanceof XmlSchemaElement) {
XmlSchemaElement el = (XmlSchemaElement) schemaObj;
schemaType = el.getSchemaType();
annotation = ((XmlSchemaElement) schemaObj).getAnnotation();
}
idltype = getSchemaTypeName(wsdlToCorbaBinding, schemaType, annotation, typeName, nill);
} else {
idltype = corbaTypeImpl.getQName();
}
}
} else {
// We need to get annotation information for the schema type we are
// about to pass in.
// This is used to produce the correct object reference type.
XmlSchemaElement schemaObj = getSchemaObject(wsdlToCorbaBinding, typeName);
XmlSchemaAnnotation annotation = null;
if (schemaObj != null) {
annotation = schemaObj.getAnnotation();
}
idltype = getSchemaTypeName(wsdlToCorbaBinding, schemaType, annotation, typeName, nill);
}
return idltype;
}
use of org.apache.cxf.binding.corba.wsdl.CorbaType in project cxf by apache.
the class WSDLToCorbaBinding method addCorbaTypes.
private void addCorbaTypes(XmlSchema xmlSchemaTypes) throws Exception {
Map<QName, XmlSchemaType> objs = xmlSchemaTypes.getSchemaTypes();
CorbaType corbaTypeImpl = null;
for (XmlSchemaType type : objs.values()) {
boolean anonymous = WSDLTypes.isAnonymous(type.getName());
corbaTypeImpl = helper.convertSchemaToCorbaType(type, type.getQName(), null, null, anonymous);
if (corbaTypeImpl != null && !helper.isDuplicate(corbaTypeImpl)) {
typeMappingType.getStructOrExceptionOrUnion().add(corbaTypeImpl);
}
}
addCorbaElements(corbaTypeImpl, xmlSchemaTypes);
}
use of org.apache.cxf.binding.corba.wsdl.CorbaType in project cxf by apache.
the class WSDLToCorbaBinding method convertFaultToCorbaType.
private CorbaType convertFaultToCorbaType(XmlSchema xmlSchema, Fault fault) throws Exception {
org.apache.cxf.binding.corba.wsdl.Exception corbaex = null;
XmlSchemaType schemaType = null;
Iterator<Part> parts = CastUtils.cast(fault.getMessage().getParts().values().iterator());
if (!parts.hasNext()) {
String msgStr = "Fault " + fault.getMessage().getQName().getLocalPart() + " UNSUPPORTED_FAULT.";
org.apache.cxf.common.i18n.Message msg = new org.apache.cxf.common.i18n.Message(msgStr, LOG);
throw new Exception(msg.toString());
}
Part part = parts.next();
schemaType = helper.lookUpType(part);
if (schemaType != null) {
QName name = schemaType.getQName();
if (name == null) {
name = part.getElementName();
}
if (!helper.isSchemaTypeException(schemaType)) {
corbaex = new org.apache.cxf.binding.corba.wsdl.Exception();
String faultName = fault.getMessage().getQName().getLocalPart();
int pos = faultName.indexOf("_exception.");
if (pos != -1) {
faultName = faultName.substring(pos + 11);
faultName = faultName + "Exception";
}
QName faultMsgName = helper.createQNameCorbaNamespace(faultName);
corbaex.setName(faultName);
corbaex.setQName(faultMsgName);
CorbaType corbaTypeImpl = helper.convertSchemaToCorbaType(schemaType, name, null, null, false);
if (corbaTypeImpl != null) {
MemberType member = new MemberType();
member.setName(corbaTypeImpl.getQName().getLocalPart());
member.setIdltype(corbaTypeImpl.getQName());
if (corbaTypeImpl.isSetQualified() && corbaTypeImpl.isQualified()) {
member.setQualified(true);
}
corbaex.getMember().add(member);
}
} else {
corbaex = createCorbaException(name, schemaType);
}
}
if (schemaType == null) {
String msgStr = "Fault " + fault.getMessage().getQName().getLocalPart() + " INCORRECT_FAULT_MSG.";
org.apache.cxf.common.i18n.Message msg = new org.apache.cxf.common.i18n.Message(msgStr, LOG);
throw new Exception(msg.toString());
}
if (corbaex == null) {
String msgStr = "Fault " + fault.getMessage().getQName().getLocalPart() + " UNSUPPORTED_FAULT.";
org.apache.cxf.common.i18n.Message msg = new org.apache.cxf.common.i18n.Message(msgStr, LOG);
throw new Exception(msg.toString());
}
// Set the repository ID for Exception
// add to CorbaTypeMapping
String repoId = WSDLToCorbaHelper.REPO_STRING + corbaex.getName().replace('.', '/') + WSDLToCorbaHelper.IDL_VERSION;
corbaex.setRepositoryID(repoId);
CorbaType corbaTypeImpl = corbaex;
if (!helper.isDuplicate(corbaTypeImpl)) {
CorbaType dup = helper.isDuplicateException(corbaTypeImpl);
if (dup != null) {
typeMappingType.getStructOrExceptionOrUnion().remove(dup);
typeMappingType.getStructOrExceptionOrUnion().add(corbaTypeImpl);
} else {
typeMappingType.getStructOrExceptionOrUnion().add(corbaTypeImpl);
}
}
return corbaex;
}
use of org.apache.cxf.binding.corba.wsdl.CorbaType in project cxf by apache.
the class WSDLToCorbaBinding method addCorbaOperationExtElement.
private void addCorbaOperationExtElement(BindingOperation bo, Operation op) throws Exception {
OperationType operationType = null;
try {
operationType = (OperationType) extReg.createExtension(BindingOperation.class, CorbaConstants.NE_CORBA_OPERATION);
} catch (WSDLException wse) {
LOG.log(Level.SEVERE, "Failed to create a Binding Operation extension", wse);
throw new Exception(LOG.toString(), wse);
}
operationType.setName(op.getName());
List<ParamType> params = new ArrayList<>();
List<ArgType> returns = new ArrayList<>();
wsdlParameter.processParameters(this, op, def, xmlSchemaList, params, returns, true);
for (ParamType paramtype : params) {
operationType.getParam().add(paramtype);
}
for (ArgType retType : returns) {
operationType.setReturn(retType);
}
Collection<Fault> faults = CastUtils.cast(op.getFaults().values());
for (Fault fault : faults) {
RaisesType raisestype = new RaisesType();
CorbaType extype = convertFaultToCorbaType(xmlSchemaType, fault);
if (extype != null) {
raisestype.setException(helper.createQNameCorbaNamespace(extype.getName()));
operationType.getRaises().add(raisestype);
}
}
bo.addExtensibilityElement((ExtensibilityElement) operationType);
}
Aggregations