Java Code Examples for org.apache.cxf.service.model.BindingOperationInfo#getOutput()
The following examples show how to use
org.apache.cxf.service.model.BindingOperationInfo#getOutput() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractJAXWSHandlerInterceptor.java From cxf with Apache License 2.0 | 6 votes |
protected void setupBindingOperationInfo(Exchange exch, Object data) { if (exch.getBindingOperationInfo() == null) { //need to know the operation to determine if oneway QName opName = getOpQName(exch, data); if (opName == null) { return; } BindingOperationInfo bop = ServiceModelUtil .getOperationForWrapperElement(exch, opName, false); if (bop == null) { bop = ServiceModelUtil.getOperation(exch, opName); } if (bop != null) { exch.put(BindingOperationInfo.class, bop); if (bop.getOutput() == null) { exch.setOneWay(true); } } } }
Example 2
Source File: SoapBindingFactory.java From cxf with Apache License 2.0 | 6 votes |
private void initializeBindingOperation(SoapBindingInfo bi, BindingOperationInfo boi) { SoapOperationInfo soi = new SoapOperationInfo(); SoapOperation soapOp = SOAPBindingUtil.getSoapOperation(boi.getExtensors(ExtensibilityElement.class)); if (soapOp != null) { String action = soapOp.getSoapActionURI(); if (action == null) { action = ""; } soi.setAction(action); soi.setStyle(soapOp.getStyle()); } boi.addExtensor(soi); if (boi.getInput() != null) { initializeMessage(bi, boi, boi.getInput()); } if (boi.getOutput() != null) { initializeMessage(bi, boi, boi.getOutput()); } }
Example 3
Source File: SwAOutInterceptor.java From cxf with Apache License 2.0 | 5 votes |
public void handleMessage(SoapMessage message) throws Fault { Exchange ex = message.getExchange(); BindingOperationInfo bop = ex.getBindingOperationInfo(); if (bop == null) { return; } if (bop.isUnwrapped()) { bop = bop.getWrappedOperation(); } boolean client = isRequestor(message); BindingMessageInfo bmi = client ? bop.getInput() : bop.getOutput(); if (bmi == null) { return; } SoapBodyInfo sbi = bmi.getExtensor(SoapBodyInfo.class); if (sbi == null || sbi.getAttachments() == null || sbi.getAttachments().isEmpty()) { Service s = ex.getService(); DataBinding db = s.getDataBinding(); if (db instanceof JAXBDataBinding && hasSwaRef((JAXBDataBinding) db)) { setupAttachmentOutput(message); } return; } processAttachments(message, sbi); }
Example 4
Source File: EffectivePolicyImpl.java From cxf with Apache License 2.0 | 5 votes |
Assertor initialisePolicy(EndpointInfo ei, BindingOperationInfo boi, PolicyEngine engine, boolean requestor, boolean request, Assertor assertor, Message m) { if (boi.isUnwrapped()) { boi = boi.getUnwrappedOperation(); } BindingMessageInfo bmi = request ? boi.getInput() : boi.getOutput(); EndpointPolicy ep; if (requestor) { ep = engine.getClientEndpointPolicy(ei, getAssertorAs(assertor, Conduit.class), m); } else { ep = engine.getServerEndpointPolicy(ei, getAssertorAs(assertor, Destination.class), m); } policy = ep.getPolicy(); if (ep instanceof EndpointPolicyImpl) { assertor = ((EndpointPolicyImpl)ep).getAssertor(); } policy = policy.merge(((PolicyEngineImpl)engine).getAggregatedOperationPolicy(boi, m)); if (null != bmi) { policy = policy.merge(((PolicyEngineImpl)engine).getAggregatedMessagePolicy(bmi, m)); } policy = policy.normalize(engine.getRegistry(), true); return assertor; }
Example 5
Source File: ServiceModelPolicyUpdater.java From cxf with Apache License 2.0 | 5 votes |
public void addPolicyAttachments(Collection<PolicyAttachment> attachments) { for (PolicyAttachment pa : attachments) { boolean policyUsed = false; for (BindingOperationInfo boi : ei.getBinding().getOperations()) { BindingMessageInfo inputMessage = boi.getInput(); BindingMessageInfo outputMessage = boi.getOutput(); if (pa.appliesTo(boi)) { // Add wsp:PolicyReference to wsdl:binding/wsdl:operation addPolicyRef(boi, pa.getPolicy()); // Add it to wsdl:portType/wsdl:operation too // FIXME - since the appliesTo is for BindingOperationInfo, I think its dodgy // that the policy ref should also be associated with the port type addPolicyRef(ei.getInterface().getOperation(boi.getName()), pa.getPolicy()); policyUsed = true; } else if (pa.appliesTo(inputMessage)) { addPolicyRef(inputMessage, pa.getPolicy()); policyUsed = true; } else if (pa.appliesTo(outputMessage)) { addPolicyRef(outputMessage, pa.getPolicy()); policyUsed = true; } } // Add wsp:Policy to top-level wsdl:definitions if (policyUsed) { addPolicy(pa); } } }
Example 6
Source File: CorbaDSIServant.java From cxf with Apache License 2.0 | 5 votes |
public void invoke(ServerRequest request) throws CorbaBindingException { String opName = request.operation(); QName requestOperation = operationMap.get(opName); MessageImpl msgImpl = new MessageImpl(); msgImpl.setDestination(getDestination()); Exchange exg = new ExchangeImpl(); exg.put(String.class, requestOperation.getLocalPart()); exg.put(ORB.class, getOrb()); exg.put(ServerRequest.class, request); msgImpl.setExchange(exg); CorbaMessage msg = new CorbaMessage(msgImpl); msg.setCorbaTypeMap(typeMap); // If there's no output message part in our operation then it's a oneway op BindingMessageInfo bindingMsgOutputInfo = null; BindingOperationInfo bindingOpInfo = null; try { bindingOpInfo = this.destination.getEndPointInfo().getBinding().getOperation(requestOperation); } catch (Exception ex) { throw new CorbaBindingException("Invalid Request. Operation unknown: " + opName); } if (bindingOpInfo != null) { bindingMsgOutputInfo = bindingOpInfo.getOutput(); if (bindingMsgOutputInfo == null) { exg.setOneWay(true); } } // invokes the interceptors getObserver().onMessage(msg); }
Example 7
Source File: HeaderUtil.java From cxf with Apache License 2.0 | 5 votes |
public static Set<QName> getHeaderQNameInOperationParam(SoapMessage soapMessage) { BindingOperationInfo bop = soapMessage.getExchange().getBindingOperationInfo(); if (bop != null) { if (bop.getInput() != null) { return getHeaderParts(bop.getInput()); } if (bop.getOutput() != null) { return getHeaderParts(bop.getOutput()); } } return Collections.emptySet(); }
Example 8
Source File: BareOutInterceptor.java From cxf with Apache License 2.0 | 5 votes |
public void handleMessage(Message message) { Exchange exchange = message.getExchange(); BindingOperationInfo operation = exchange.getBindingOperationInfo(); if (operation == null) { return; } MessageContentsList objs = MessageContentsList.getContentsList(message); if (objs == null || objs.isEmpty()) { return; } List<MessagePartInfo> parts = null; BindingMessageInfo bmsg = null; boolean client = isRequestor(message); if (!client) { if (operation.getOutput() != null) { bmsg = operation.getOutput(); parts = bmsg.getMessageParts(); } else { // partial response to oneway return; } } else { bmsg = operation.getInput(); parts = bmsg.getMessageParts(); } writeParts(message, exchange, operation, objs, parts); }
Example 9
Source File: JaxWsEndpointImpl.java From cxf with Apache License 2.0 | 4 votes |
private void extractWsdlExtensibilities(EndpointInfo endpoint) { List<ExtensibilityElement> portExtensors = getExtensors(endpoint); List<ExtensibilityElement> bindingExtensors = getExtensors(endpoint.getBinding()); //check the extensions under <wsdl:binding> checkRespectBindingFeature(bindingExtensors); Collection<BindingOperationInfo> bindingOperations = endpoint.getBinding().getOperations(); if (null != bindingOperations) { Iterator<BindingOperationInfo> iterator = bindingOperations.iterator(); while (iterator.hasNext()) { BindingOperationInfo operationInfo = iterator.next(); BindingMessageInfo inputInfo = operationInfo.getInput(); BindingMessageInfo outputnfo = operationInfo.getOutput(); Collection<BindingFaultInfo> faults = operationInfo.getFaults(); //check the extensions under <wsdl:operation> checkRespectBindingFeature(getExtensors(operationInfo)); //check the extensions under <wsdl:input> checkRespectBindingFeature(getExtensors(inputInfo)); //check the extensions under <wsdl:output> checkRespectBindingFeature(getExtensors(outputnfo)); if (null != faults) { Iterator<BindingFaultInfo> faultIterator = faults.iterator(); while (faultIterator.hasNext()) { BindingFaultInfo faultInfo = faultIterator.next(); //check the extensions under <wsdl:fault> checkRespectBindingFeature(getExtensors(faultInfo)); } } } } if (hasUsingAddressing(bindingExtensors) || hasUsingAddressing(portExtensors)) { WSAddressingFeature feature = new WSAddressingFeature(); if (addressingRequired(bindingExtensors) || addressingRequired(portExtensors)) { feature.setAddressingRequired(true); } addAddressingFeature(feature); } extractWsdlEprs(endpoint); }
Example 10
Source File: CorbaStreamInInterceptor.java From cxf with Apache License 2.0 | 4 votes |
private void handleReply(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; if (message.getStreamableException() != null || message.getSystemException() != null) { message.setContent(Exception.class, message.getExchange().getOutMessage().getContent(Exception.class)); Endpoint ep = message.getExchange().getEndpoint(); message.getInterceptorChain().abort(); if (ep.getInFaultObserver() != null) { ep.getInFaultObserver().onMessage(message); return; } } CorbaMessage outMessage = (CorbaMessage)message.getExchange().getOutMessage(); orb = message.getExchange().get(ORB.class); HandlerIterator paramIterator = new HandlerIterator(outMessage, false); CorbaTypeEventProducer eventProducer = null; Exchange exchange = message.getExchange(); BindingOperationInfo bindingOpInfo = exchange.getBindingOperationInfo(); BindingMessageInfo msgInfo = bindingOpInfo.getOutput(); boolean wrap = false; if (bindingOpInfo.isUnwrappedCapable()) { wrap = true; } if (wrap) { // wrapper element around our args // REVISIT, bravi, message name same as the element name 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); }
Example 11
Source File: XMLMessageOutInterceptor.java From cxf with Apache License 2.0 | 4 votes |
public void handleMessage(Message message) throws Fault { BindingOperationInfo boi = message.getExchange().getBindingOperationInfo(); MessageInfo mi; BindingMessageInfo bmi; if (isRequestor(message)) { mi = boi.getOperationInfo().getInput(); bmi = boi.getInput(); } else { mi = boi.getOperationInfo().getOutput(); bmi = boi.getOutput(); } XMLBindingMessageFormat xmf = bmi.getExtensor(XMLBindingMessageFormat.class); QName rootInModel = null; if (xmf != null) { rootInModel = xmf.getRootNode(); } final int mpn = mi.getMessagePartsNumber(); if (boi.isUnwrapped() || mpn == 1) { // wrapper out interceptor created the wrapper // or if bare-one-param new BareOutInterceptor().handleMessage(message); } else { if (rootInModel == null) { rootInModel = boi.getName(); } if (mpn == 0 && !boi.isUnwrapped()) { // write empty operation qname writeMessage(message, rootInModel, false); } else { // multi param, bare mode, needs write root node writeMessage(message, rootInModel, true); } } // in the end we do flush ;) XMLStreamWriter writer = message.getContent(XMLStreamWriter.class); try { writer.flush(); } catch (XMLStreamException e) { throw new Fault(new org.apache.cxf.common.i18n.Message("STAX_WRITE_EXC", BUNDLE, e)); } }
Example 12
Source File: XMLMessageInInterceptor.java From cxf with Apache License 2.0 | 4 votes |
public void handleMessage(Message message) throws Fault { if (isGET(message)) { LOG.fine("XMLMessageInInterceptor skipped in HTTP GET method"); return; } Endpoint ep = message.getExchange().getEndpoint(); XMLStreamReader xsr = message.getContent(XMLStreamReader.class); if (xsr == null) { return; } DepthXMLStreamReader reader = new DepthXMLStreamReader(xsr); if (!StaxUtils.toNextElement(reader)) { throw new Fault(new org.apache.cxf.common.i18n.Message("NO_OPERATION_ELEMENT", LOG)); } Exchange ex = message.getExchange(); QName startQName = reader.getName(); // handling xml fault message if (startQName.getLocalPart().equals(XMLFault.XML_FAULT_ROOT)) { message.getInterceptorChain().abort(); if (ep.getInFaultObserver() != null) { ep.getInFaultObserver().onMessage(message); return; } } // handling xml normal inbound message BindingOperationInfo boi = ex.getBindingOperationInfo(); boolean isRequestor = isRequestor(message); if (boi == null) { BindingInfo service = ep.getEndpointInfo().getBinding(); boi = getBindingOperationInfo(isRequestor, startQName, service, xsr); if (boi != null) { ex.put(BindingOperationInfo.class, boi); ex.setOneWay(boi.getOperationInfo().isOneWay()); } } else { BindingMessageInfo bmi = isRequestor ? boi.getOutput() : boi.getInput(); if (hasRootNode(bmi, startQName)) { try { xsr.nextTag(); } catch (XMLStreamException xse) { throw new Fault(new org.apache.cxf.common.i18n.Message("STAX_READ_EXC", LOG)); } } } }
Example 13
Source File: WSDLServiceBuilderTest.java From cxf with Apache License 2.0 | 4 votes |
@Test public void testBindingMessageInfo() throws Exception { setUpBasic(); BindingInfo bindingInfo = null; bindingInfo = serviceInfo.getBindings().iterator().next(); QName name = new QName(serviceInfo.getName().getNamespaceURI(), "sayHi"); BindingOperationInfo sayHi = bindingInfo.getOperation(name); BindingMessageInfo input = sayHi.getInput(); assertNotNull(input); assertEquals(input.getMessageInfo().getName().getLocalPart(), "sayHiRequest"); assertEquals(input.getMessageInfo().getName().getNamespaceURI(), "http://apache.org/hello_world_soap_http"); assertEquals(input.getMessageInfo().getMessageParts().size(), 1); assertEquals(input.getMessageInfo().getMessageParts().get(0).getName().getLocalPart(), "in"); assertEquals(input.getMessageInfo().getMessageParts().get(0).getName().getNamespaceURI(), "http://apache.org/hello_world_soap_http"); assertTrue(input.getMessageInfo().getMessageParts().get(0).isElement()); QName elementName = input.getMessageInfo().getMessageParts().get(0).getElementQName(); assertEquals(elementName.getLocalPart(), "sayHi"); assertEquals(elementName.getNamespaceURI(), "http://apache.org/hello_world_soap_http/types"); BindingMessageInfo output = sayHi.getOutput(); assertNotNull(output); assertEquals(output.getMessageInfo().getName().getLocalPart(), "sayHiResponse"); assertEquals(output.getMessageInfo().getName().getNamespaceURI(), "http://apache.org/hello_world_soap_http"); assertEquals(output.getMessageInfo().getMessageParts().size(), 1); assertEquals(output.getMessageInfo().getMessageParts().get(0).getName().getLocalPart(), "out"); assertEquals(output.getMessageInfo().getMessageParts().get(0).getName().getNamespaceURI(), "http://apache.org/hello_world_soap_http"); assertTrue(output.getMessageInfo().getMessageParts().get(0).isElement()); elementName = output.getMessageInfo().getMessageParts().get(0).getElementQName(); assertEquals(elementName.getLocalPart(), "sayHiResponse"); assertEquals(elementName.getNamespaceURI(), "http://apache.org/hello_world_soap_http/types"); assertTrue(sayHi.getFaults().isEmpty()); name = new QName(serviceInfo.getName().getNamespaceURI(), "pingMe"); BindingOperationInfo pingMe = bindingInfo.getOperation(name); assertNotNull(pingMe); assertEquals(1, pingMe.getFaults().size()); BindingFaultInfo fault = pingMe.getFaults().iterator().next(); assertNotNull(fault); assertEquals(fault.getFaultInfo().getName().getLocalPart(), "pingMeFault"); assertEquals(fault.getFaultInfo().getName().getNamespaceURI(), "http://apache.org/hello_world_soap_http"); assertEquals(fault.getFaultInfo().getMessageParts().size(), 1); assertEquals(fault.getFaultInfo().getMessageParts().get(0).getName().getLocalPart(), "faultDetail"); assertEquals(fault.getFaultInfo().getMessageParts().get(0).getName().getNamespaceURI(), "http://apache.org/hello_world_soap_http"); assertTrue(fault.getFaultInfo().getMessageParts().get(0).isElement()); elementName = fault.getFaultInfo().getMessageParts().get(0).getElementQName(); assertEquals(elementName.getLocalPart(), "faultDetail"); assertEquals(elementName.getNamespaceURI(), "http://apache.org/hello_world_soap_http/types"); control.verify(); }
Example 14
Source File: WSDLServiceBuilderTest.java From cxf with Apache License 2.0 | 4 votes |
private void assertBindingOperationMessageExtensions(BindingOperationInfo boi, boolean expectExtensions, boolean hasOutput, QName fault) { BindingMessageInfo bmi = boi.getInput(); if (expectExtensions) { // REVISIT: bug in wsdl4j? // getExtensionAttributes on binding/operation/input element returns an empty map // assertEquals(1, bmi.getExtensionAttributes().size()); // assertNotNull(bmi.getExtensionAttribute(EXTENSION_ATTR_STRING)); assertEquals(1, bmi.getExtensors(UnknownExtensibilityElement.class).size()); assertEquals(EXTENSION_ELEM, bmi.getExtensor(UnknownExtensibilityElement.class).getElementType()); } else { assertNull(bmi.getExtensionAttributes()); assertNull(bmi.getExtensionAttribute(EXTENSION_ATTR_STRING)); assertEquals(0, bmi.getExtensors(UnknownExtensibilityElement.class).size()); assertNull(bmi.getExtensor(UnknownExtensibilityElement.class)); } if (hasOutput) { bmi = boi.getOutput(); if (expectExtensions) { // REVISIT: bug in wsdl4j? // getExtensionAttributes on binding/operation/output element returns an empty map // assertEquals(1, bmi.getExtensionAttributes().size()); // assertNotNull(bmi.getExtensionAttribute(EXTENSION_ATTR_STRING)); assertEquals(1, bmi.getExtensors(UnknownExtensibilityElement.class).size()); assertEquals(EXTENSION_ELEM, bmi.getExtensor(UnknownExtensibilityElement.class).getElementType()); } else { assertNull(bmi.getExtensionAttributes()); assertNull(bmi.getExtensionAttribute(EXTENSION_ATTR_STRING)); assertEquals(0, bmi.getExtensors(UnknownExtensibilityElement.class).size()); assertNull(bmi.getExtensor(UnknownExtensibilityElement.class)); } } if (null != fault) { BindingFaultInfo bfi = boi.getFault(fault); if (expectExtensions) { assertEquals(1, bfi.getExtensionAttributes().size()); assertNotNull(bfi.getExtensionAttribute(EXTENSION_ATTR_STRING)); assertEquals(1, bfi.getExtensors(UnknownExtensibilityElement.class).size()); assertEquals(EXTENSION_ELEM, bfi.getExtensor(UnknownExtensibilityElement.class).getElementType()); } else { assertNull(bfi.getExtensionAttributes()); assertNull(bfi.getExtensionAttribute(EXTENSION_ATTR_STRING)); assertNull(bfi.getExtensors(UnknownExtensibilityElement.class)); assertNull(bfi.getExtensor(UnknownExtensibilityElement.class)); } } }
Example 15
Source File: AbstractInDatabindingInterceptor.java From cxf with Apache License 2.0 | 4 votes |
/** * Find the next possible message part in the message. If an operation in * the list of operations is no longer a viable match, it will be removed * from the Collection. * * @param exchange * @param operations * @param name * @param client * @param index */ protected MessagePartInfo findMessagePart(Exchange exchange, Collection<OperationInfo> operations, QName name, boolean client, int index, Message message) { Endpoint ep = exchange.getEndpoint(); MessagePartInfo lastChoice = null; BindingOperationInfo lastBoi = null; BindingMessageInfo lastMsgInfo = null; for (Iterator<OperationInfo> itr = operations.iterator(); itr.hasNext();) { OperationInfo op = itr.next(); final BindingOperationInfo boi = ep.getEndpointInfo().getBinding().getOperation(op); if (boi == null) { continue; } final BindingMessageInfo msgInfo; if (client) { msgInfo = boi.getOutput(); } else { msgInfo = boi.getInput(); } if (msgInfo == null) { itr.remove(); continue; } Collection<MessagePartInfo> bodyParts = msgInfo.getMessageParts(); if (bodyParts.isEmpty() || bodyParts.size() <= index) { itr.remove(); continue; } MessagePartInfo p = msgInfo.getMessageParts().get(index); if (name.getNamespaceURI() == null || name.getNamespaceURI().isEmpty()) { // message part has same namespace with the message name = new QName(p.getMessageInfo().getName().getNamespaceURI(), name.getLocalPart()); } if (name.equals(p.getConcreteName())) { exchange.put(BindingOperationInfo.class, boi); exchange.setOneWay(op.isOneWay()); return p; } if (Constants.XSD_ANYTYPE.equals(p.getTypeQName())) { lastChoice = p; lastBoi = boi; lastMsgInfo = msgInfo; } else { itr.remove(); } } if (lastChoice != null) { setMessage(message, lastBoi, client, lastBoi.getBinding().getService(), lastMsgInfo.getMessageInfo()); } return lastChoice; }