use of org.apache.cxf.binding.corba.wsdl.ParamType 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);
}
use of org.apache.cxf.binding.corba.wsdl.ParamType in project cxf by apache.
the class WSDLToIDLAction method createIdlAttribute.
public void createIdlAttribute(org.apache.cxf.binding.corba.wsdl.OperationType opType, String name) throws Exception {
String attrNm = name.substring(5, name.length());
IdlAttribute attr;
IdlDefn idlDef = intf.lookup(attrNm);
if (idlDef == null) {
if (name.startsWith("_get_")) {
ArgType t = opType.getReturn();
attr = IdlAttribute.create(intf, attrNm, findType(t.getIdltype()), true);
} else {
ParamType arg = opType.getParam().iterator().next();
attr = IdlAttribute.create(intf, attrNm, findType(arg.getIdltype()), false);
}
intf.addAttribute(attr);
} else {
attr = (IdlAttribute) idlDef;
if (attr.readonly() && name.startsWith("_set_")) {
attr.setReadonly(false);
}
}
}
use of org.apache.cxf.binding.corba.wsdl.ParamType in project cxf by apache.
the class WSDLToIDLAction method createIdlOperation.
public void createIdlOperation(org.apache.cxf.binding.corba.wsdl.OperationType opType, String name, boolean isOneway) throws Exception {
IdlOperation idlOp = IdlOperation.create(intf, opType.getName(), isOneway);
intf.holdForScope(idlOp);
ArgType crt = opType.getReturn();
if (crt != null) {
IdlType rt = findType(crt.getIdltype());
idlOp.addReturnType(rt);
}
for (ParamType arg : opType.getParam()) {
IdlType type = findType(arg.getIdltype());
String mode = arg.getMode().value();
IdlParam param = IdlParam.create(idlOp, arg.getName(), type, mode);
idlOp.addParameter(param);
}
for (RaisesType rs : opType.getRaises()) {
IdlType type = findType(rs.getException());
if (type instanceof IdlException) {
idlOp.addException((IdlException) type);
} else {
String msgStr = type.fullName() + " is not a type.";
org.apache.cxf.common.i18n.Message msg = new org.apache.cxf.common.i18n.Message(msgStr, LOG);
throw new Exception(msg.toString());
}
}
root.flush();
intf.promoteHeldToScope();
}
use of org.apache.cxf.binding.corba.wsdl.ParamType in project cxf by apache.
the class AttributeVisitor method generateCorbaParam.
private ParamType generateCorbaParam(AST type) {
ParamType param = new ParamType();
param.setName(PARAM_NAME);
param.setMode(ModeType.IN);
ParamTypeSpecVisitor visitor = new ParamTypeSpecVisitor(getScope(), definition, schema, wsdlVisitor);
visitor.visit(type);
CorbaTypeImpl corbaType = visitor.getCorbaType();
if (corbaType != null) {
param.setIdltype(corbaType.getQName());
} else {
wsdlVisitor.getDeferredActions().add(visitor.getFullyQualifiedName(), new AttributeDeferredAction(param));
}
return param;
}
use of org.apache.cxf.binding.corba.wsdl.ParamType in project cxf by apache.
the class CorbaStreamInInterceptor method prepareDIIArgsList.
protected NVList prepareDIIArgsList(CorbaMessage corbaMsg, BindingOperationInfo boi, CorbaStreamable[] streamables, List<ParamType> paramTypes, CorbaTypeMap map, ORB orb, ServiceInfo service) {
try {
// Build the list of DII arguments, returns, and exceptions
NVList list = orb.create_list(streamables.length);
OperationInfo opInfo = boi.getOperationInfo();
MessageInfo input = opInfo.getInput();
MessageInfo output = opInfo.getOutput();
String inWrapNSUri = null;
String outWrapNSUri = null;
boolean wrap = false;
if (boi.isUnwrappedCapable()) {
wrap = true;
if (input != null) {
inWrapNSUri = getWrappedParamNamespace(input);
if (!CorbaUtils.isElementFormQualified(service, inWrapNSUri)) {
inWrapNSUri = "";
}
}
if (output != null) {
outWrapNSUri = getWrappedParamNamespace(output);
if (!CorbaUtils.isElementFormQualified(service, outWrapNSUri)) {
outWrapNSUri = "";
}
}
}
int inMsgIndex = 0;
int outMsgIndex = 0;
for (int i = 0; i < paramTypes.size(); i++) {
ParamType param = paramTypes.get(i);
QName paramIdlType = param.getIdltype();
QName paramName;
ModeType paramMode = param.getMode();
if (paramMode.value().equals("in")) {
if (wrap) {
paramName = new QName(inWrapNSUri, param.getName());
} else {
paramName = getMessageParamQName(input, param.getName(), inMsgIndex);
inMsgIndex++;
}
} else {
if (wrap) {
paramName = new QName(outWrapNSUri, param.getName());
} else {
paramName = getMessageParamQName(output, param.getName(), outMsgIndex);
outMsgIndex++;
}
}
CorbaObjectHandler obj = CorbaHandlerUtils.initializeObjectHandler(orb, paramName, paramIdlType, map, service);
streamables[i] = corbaMsg.createStreamableObject(obj, paramName);
Any value = CorbaAnyHelper.createAny(orb);
if (paramMode.value().equals("in")) {
streamables[i].setMode(org.omg.CORBA.ARG_IN.value);
streamables[i].getObject().setIntoAny(value, streamables[i], false);
} else if (paramMode.value().equals("out")) {
streamables[i].setMode(org.omg.CORBA.ARG_OUT.value);
streamables[i].getObject().setIntoAny(value, streamables[i], true);
} else {
streamables[i].setMode(org.omg.CORBA.ARG_INOUT.value);
streamables[i].getObject().setIntoAny(value, streamables[i], false);
}
list.add_value(streamables[i].getName(), value, streamables[i].getMode());
corbaMsg.addStreamableArgument(streamables[i]);
}
return list;
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
Aggregations