use of org.apache.cxf.binding.corba.wsdl.ModeType in project cxf by apache.
the class CorbaStreamOutEndingInterceptor method handleOutBoundMessage.
private void handleOutBoundMessage(CorbaMessage message, BindingOperationInfo boi) {
OperationInfo opInfo = boi.getOperationInfo();
OperationType opType = boi.getExtensor(OperationType.class);
List<ParamType> paramTypes = opType.getParam();
MessageInfo outMsgInfo = opInfo.getOutput();
String wrapNSUri = null;
boolean wrap = false;
if (boi.isUnwrappedCapable()) {
wrap = true;
if (outMsgInfo != null) {
wrapNSUri = getWrappedParamNamespace(outMsgInfo);
if (!CorbaUtils.isElementFormQualified(service, wrapNSUri)) {
wrapNSUri = "";
}
}
}
CorbaStreamWriter writer = (CorbaStreamWriter) message.getContent(XMLStreamWriter.class);
CorbaObjectHandler[] objs = writer.getCorbaObjects();
int count = 0;
int msgIndex = 0;
ArgType returnParam = opType.getReturn();
if (returnParam != null) {
QName retName;
if (wrap) {
retName = new QName(wrapNSUri, returnParam.getName());
} else {
retName = getMessageParamQName(outMsgInfo, returnParam.getName(), msgIndex);
}
QName retIdlType = returnParam.getIdltype();
CorbaObjectHandler obj = CorbaHandlerUtils.initializeObjectHandler(orb, retName, retIdlType, typeMap, service);
CorbaStreamable streamable = message.createStreamableObject(obj, retName);
message.setStreamableReturn(streamable);
msgIndex++;
}
for (Iterator<ParamType> iter = paramTypes.iterator(); iter.hasNext(); ) {
ParamType param = iter.next();
QName idlType = param.getIdltype();
QName paramName;
final CorbaObjectHandler obj;
if (param.getMode().equals(ModeType.OUT)) {
if (wrap) {
paramName = new QName(wrapNSUri, param.getName());
} else {
paramName = getMessageParamQName(outMsgInfo, param.getName(), msgIndex);
}
obj = CorbaHandlerUtils.initializeObjectHandler(orb, paramName, idlType, typeMap, service);
msgIndex++;
} else {
obj = objs[count++];
paramName = obj.getName();
}
CorbaStreamable streamable = message.createStreamableObject(obj, paramName);
ModeType paramMode = param.getMode();
if ("in".equals(paramMode.value())) {
streamable.setMode(org.omg.CORBA.ARG_IN.value);
} else if ("inout".equals(paramMode.value())) {
streamable.setMode(org.omg.CORBA.ARG_INOUT.value);
}
// default mode is out
message.addStreamableArgument(streamable);
}
}
use of org.apache.cxf.binding.corba.wsdl.ModeType in project cxf by apache.
the class WSDLParameter method createParam.
private static ParamType createParam(WSDLToCorbaBinding wsdlToCorbaBinding, String mode, String name, QName idltype) throws Exception {
ParamType paramtype = new ParamType();
ModeType modeType = ModeType.fromValue(mode);
paramtype.setName(name);
paramtype.setMode(modeType);
paramtype.setIdltype(idltype);
return paramtype;
}
use of org.apache.cxf.binding.corba.wsdl.ModeType 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 ("in".equals(paramMode.value())) {
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, corbaMsg.getExchange().getBus());
if ("in".equals(paramMode.value())) {
streamables[i].setMode(org.omg.CORBA.ARG_IN.value);
streamables[i].getObject().setIntoAny(value, streamables[i], false);
} else if ("out".equals(paramMode.value())) {
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);
}
}
use of org.apache.cxf.binding.corba.wsdl.ModeType in project cxf by apache.
the class CorbaStreamOutEndingInterceptor method handleInBoundMessage.
private void handleInBoundMessage(CorbaMessage message, BindingOperationInfo boi) {
OperationInfo opInfo = boi.getOperationInfo();
OperationType opType = boi.getExtensor(OperationType.class);
List<ParamType> paramTypes = opType.getParam();
MessageInfo msgInInfo = opInfo.getInput();
String wrapNSUri = null;
boolean wrap = false;
if (boi.isUnwrappedCapable()) {
wrap = true;
if (msgInInfo != null) {
wrapNSUri = getWrappedParamNamespace(msgInInfo);
if (!CorbaUtils.isElementFormQualified(service, wrapNSUri)) {
wrapNSUri = "";
}
}
}
CorbaStreamWriter writer = (CorbaStreamWriter) message.getContent(XMLStreamWriter.class);
CorbaObjectHandler[] objs = writer.getCorbaObjects();
int count = 0;
int msgIndex = 0;
ArgType returnParam = opType.getReturn();
if (returnParam != null) {
CorbaObjectHandler obj = objs[count++];
QName retName = obj.getName();
CorbaStreamable streamable = message.createStreamableObject(obj, retName);
message.setStreamableReturn(streamable);
}
for (Iterator<ParamType> iter = paramTypes.iterator(); iter.hasNext(); ) {
ParamType param = iter.next();
QName idlType = param.getIdltype();
QName paramName;
final CorbaObjectHandler obj;
if (param.getMode().equals(ModeType.IN)) {
if (wrap) {
paramName = new QName(wrapNSUri, param.getName());
} else {
paramName = getMessageParamQName(msgInInfo, param.getName(), msgIndex);
}
obj = CorbaHandlerUtils.initializeObjectHandler(orb, paramName, idlType, typeMap, service);
msgIndex++;
} else {
obj = objs[count++];
paramName = obj.getName();
}
CorbaStreamable streamable = message.createStreamableObject(obj, paramName);
ModeType paramMode = param.getMode();
if ("in".equals(paramMode.value())) {
streamable.setMode(org.omg.CORBA.ARG_IN.value);
} else if ("inout".equals(paramMode.value())) {
streamable.setMode(org.omg.CORBA.ARG_INOUT.value);
} else if ("out".equals(paramMode.value())) {
streamable.setMode(org.omg.CORBA.ARG_OUT.value);
}
message.addStreamableArgument(streamable);
}
}
Aggregations