use of org.apache.cxf.binding.corba.wsdl.OperationType in project cxf by apache.
the class CorbaStreamInInterceptor method handleRequest.
private void handleRequest(Message msg) {
ORB orb;
ServiceInfo service;
CorbaDestination destination;
if (msg.getDestination() != null) {
destination = (CorbaDestination) msg.getDestination();
} else {
destination = (CorbaDestination) msg.getExchange().getDestination();
}
service = destination.getBindingInfo().getService();
CorbaMessage message = (CorbaMessage) msg;
Exchange exchange = message.getExchange();
CorbaTypeMap typeMap = message.getCorbaTypeMap();
BindingInfo bInfo = destination.getBindingInfo();
InterfaceInfo info = bInfo.getInterface();
String opName = exchange.get(String.class);
Iterator<BindingOperationInfo> i = bInfo.getOperations().iterator();
OperationType opType = null;
BindingOperationInfo bopInfo = null;
QName opQName = null;
while (i.hasNext()) {
bopInfo = i.next();
if (bopInfo.getName().getLocalPart().equals(opName)) {
opType = bopInfo.getExtensor(OperationType.class);
opQName = bopInfo.getName();
break;
}
}
if (opType == null) {
throw new RuntimeException("Couldn't find the binding operation for " + opName);
}
orb = exchange.get(ORB.class);
ServerRequest request = exchange.get(ServerRequest.class);
NVList list = prepareArguments(message, info, opType, opQName, typeMap, destination, service);
request.arguments(list);
message.setList(list);
HandlerIterator paramIterator = new HandlerIterator(message, true);
final CorbaTypeEventProducer eventProducer;
BindingMessageInfo msgInfo = bopInfo.getInput();
boolean wrap = false;
if (bopInfo.isUnwrappedCapable()) {
wrap = true;
}
if (wrap) {
// wrapper element around our args
QName wrapperElementQName = msgInfo.getMessageInfo().getName();
eventProducer = new WrappedParameterSequenceEventProducer(wrapperElementQName, paramIterator, service, orb);
} else {
eventProducer = new ParameterEventProducer(paramIterator, service, orb);
}
CorbaStreamReader reader = new CorbaStreamReader(eventProducer);
message.setContent(XMLStreamReader.class, reader);
}
use of org.apache.cxf.binding.corba.wsdl.OperationType in project cxf by apache.
the class CorbaStreamOutInterceptor method handleInBoundMessage.
private void handleInBoundMessage(CorbaMessage message, BindingOperationInfo boi) {
boolean wrap = false;
if (boi.isUnwrappedCapable()) {
wrap = true;
}
OperationType opType = boi.getExtensor(OperationType.class);
ArgType returnParam = opType.getReturn();
List<ParamType> paramTypes = opType.getParam();
List<ArgType> params = new ArrayList<>();
if (returnParam != null) {
params.add(returnParam);
}
for (Iterator<ParamType> iter = paramTypes.iterator(); iter.hasNext(); ) {
ParamType param = iter.next();
if (!param.getMode().equals(ModeType.IN)) {
params.add(param);
}
}
CorbaStreamWriter writer = new CorbaStreamWriter(orb, params, typeMap, service, wrap);
message.setContent(XMLStreamWriter.class, writer);
}
use of org.apache.cxf.binding.corba.wsdl.OperationType 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.OperationType in project cxf by apache.
the class CorbaStreamOutInterceptor method handleOutBoundMessage.
private void handleOutBoundMessage(CorbaMessage message, BindingOperationInfo boi) {
boolean wrap = false;
if (boi.isUnwrappedCapable()) {
wrap = true;
}
OperationType opType = boi.getExtensor(OperationType.class);
List<ParamType> paramTypes = opType.getParam();
List<ArgType> params = new ArrayList<>();
for (Iterator<ParamType> iter = paramTypes.iterator(); iter.hasNext(); ) {
ParamType param = iter.next();
if (!param.getMode().equals(ModeType.OUT)) {
params.add(param);
}
}
CorbaStreamWriter writer = new CorbaStreamWriter(orb, params, typeMap, service, wrap);
message.setContent(XMLStreamWriter.class, writer);
}
use of org.apache.cxf.binding.corba.wsdl.OperationType in project cxf by apache.
the class CorbaConduit method close.
public void close(Message message) throws IOException {
if (message.get(CorbaConstants.CORBA_ENDPOINT_OBJECT) != null) {
BindingOperationInfo boi = message.getExchange().getBindingOperationInfo();
OperationType opType = boi.getExtensor(OperationType.class);
try {
if (message instanceof CorbaMessage) {
buildRequest((CorbaMessage) message, opType);
}
message.getContent(OutputStream.class).close();
} catch (Exception ex) {
LOG.log(Level.SEVERE, "Could not build the corba request");
throw new CorbaBindingException(ex);
}
}
}
Aggregations