org.apache.cxf.service.model.BindingOperationInfo Java Examples

The following examples show how to use org.apache.cxf.service.model.BindingOperationInfo. 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: SimpleMethodDispatcher.java    From cxf with Apache License 2.0 6 votes vote down vote up
public void bind(OperationInfo o, Method... methods) {
    Method primary = methods[0];
    for (Method m : methods) {
        methodToOp.put(m, o);

        Map<BindingInfo, BindingOperationInfo> biToBop
            = new ConcurrentHashMap<>(4, 0.75f, 2);
        infoMap.put(m, biToBop);
    }

    opToMethod.put(o, primary);

    if (o.isUnwrappedCapable()) {
        opToMethod.put(o.getUnwrappedOperation(), primary);
    }
}
 
Example #2
Source File: SOAPLoggingTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testSoap() {
    DefaultLogEventMapper mapper = new DefaultLogEventMapper();
    Message message = new MessageImpl();
    ExchangeImpl exchange = new ExchangeImpl();
    ServiceInfo service = new ServiceInfo();
    BindingInfo info = new BindingInfo(service, "bindingId");
    SoapBinding value = new SoapBinding(info);
    exchange.put(Binding.class, value);
    OperationInfo opInfo = new OperationInfo();
    opInfo.setName(new QName("http://my", "Operation"));
    BindingOperationInfo boi = new BindingOperationInfo(info, opInfo);
    exchange.put(BindingOperationInfo.class, boi);
    message.setExchange(exchange);
    LogEvent event = mapper.map(message);
    Assert.assertEquals("{http://my}Operation", event.getOperationName());
}
 
Example #3
Source File: SoapBindingFactory.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void setupHeaders(BindingOperationInfo op,
                          BindingMessageInfo bMsg,
                          BindingMessageInfo unwrappedBMsg,
                          MessageInfo msg,
                          SoapBindingConfiguration config) {
    List<MessagePartInfo> parts = new ArrayList<>();
    for (MessagePartInfo part : msg.getMessageParts()) {
        if (config.isHeader(op, part)) {
            SoapHeaderInfo headerInfo = new SoapHeaderInfo();
            headerInfo.setPart(part);
            headerInfo.setUse(config.getUse());

            bMsg.addExtensor(headerInfo);
        } else {
            parts.add(part);
        }
    }
    unwrappedBMsg.setMessageParts(parts);
}
 
Example #4
Source File: ServiceModelUtilsTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetOperationInputPartNamesBare() throws Exception {
    getService(getClass().getResource("/wsdl/hello_world_xml_bare.wsdl"),
               org.apache.hello_world_xml_http.bare.GreeterImpl.class,
               new QName("http://apache.org/hello_world_xml_http/bare", "XMLPort"));
    BindingOperationInfo operation = ServiceModelUtil.getOperation(message.getExchange(), "greetMe");
    assertNotNull(operation);
    List<String> names = ServiceModelUtil.getOperationInputPartNames(operation.getOperationInfo());
    assertNotNull(names);
    assertEquals(1, names.size());
    assertEquals("requestType", names.get(0));

    operation = ServiceModelUtil.getOperation(message.getExchange(), "sayHi");
    assertNotNull(operation);
    names = ServiceModelUtil.getOperationInputPartNames(operation.getOperationInfo());
    assertNotNull(names);
    assertEquals(0, names.size());
}
 
Example #5
Source File: ServiceModelUtilsTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetOperationInputPartNamesWrapped() throws Exception {
    getService(getClass().getResource("/wsdl/hello_world.wsdl"),
               GreeterImpl.class,
               new QName("http://apache.org/hello_world_soap_http", "SoapPort"));

    BindingOperationInfo operation = ServiceModelUtil.getOperation(message.getExchange(), "greetMe");
    assertNotNull(operation);
    List<String> names = ServiceModelUtil.getOperationInputPartNames(operation.getOperationInfo());
    assertNotNull(names);
    assertEquals(1, names.size());
    assertEquals("requestType", names.get(0));

    operation = ServiceModelUtil.getOperation(message.getExchange(), "sayHi");
    assertNotNull(operation);
    names = ServiceModelUtil.getOperationInputPartNames(operation.getOperationInfo());
    assertNotNull(names);
    assertEquals(0, names.size());
}
 
Example #6
Source File: DispatchImpl.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void addInvokeOperation(QName operationName, boolean oneWay) {
    ServiceInfo info = client.getEndpoint().getEndpointInfo().getService();

    OperationInfo invokeOpInfo = info.getInterface()
                   .getOperation(oneWay ? INVOKE_ONEWAY_QNAME : INVOKE_QNAME);

    OperationInfo opInfo = info.getInterface().addOperation(operationName);
    opInfo.setInput(invokeOpInfo.getInputName(), invokeOpInfo.getInput());

    if (!oneWay) {
        opInfo.setOutput(invokeOpInfo.getOutputName(), invokeOpInfo.getOutput());
    }

    for (BindingInfo bind : client.getEndpoint().getEndpointInfo().getService().getBindings()) {
        BindingOperationInfo bo = new BindingOperationInfo(bind, opInfo);
        bind.addOperation(bo);
    }
}
 
Example #7
Source File: RPCOutInterceptor.java    From cxf with Apache License 2.0 6 votes vote down vote up
protected String addOperationNode(NSStack nsStack, Message message,
                                  XMLStreamWriter xmlWriter,
                                  boolean output,
                                  BindingOperationInfo boi)
    throws XMLStreamException {
    String ns = boi.getName().getNamespaceURI();
    SoapBody body = null;
    if (output) {
        body = boi.getOutput().getExtensor(SoapBody.class);
    } else {
        body = boi.getInput().getExtensor(SoapBody.class);
    }
    if (body != null) {
        final String nsUri = body.getNamespaceURI(); //do it once, as it might internally use reflection...
        if (!StringUtils.isEmpty(nsUri)) {
            ns = nsUri;
        }
    }

    nsStack.add(ns);
    String prefix = nsStack.getPrefix(ns);
    String name = output ? boi.getName().getLocalPart() + "Response" : boi.getName().getLocalPart();
    StaxUtils.writeStartElement(xmlWriter, prefix, name, ns);
    return ns;
}
 
Example #8
Source File: PolicyAttachmentTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testAppliesToOperation() {
    BindingOperationInfo boi1 = control.createMock(BindingOperationInfo.class);
    BindingOperationInfo boi2 = control.createMock(BindingOperationInfo.class);
    DomainExpression de = control.createMock(DomainExpression.class);
    Collection<DomainExpression> des = Collections.singletonList(de);
    PolicyAttachment pa = new PolicyAttachment();
    pa.setDomainExpressions(des);

    EasyMock.expect(de.appliesTo(boi1)).andReturn(false);
    EasyMock.expect(de.appliesTo(boi2)).andReturn(true);
    control.replay();
    assertFalse(pa.appliesTo(boi1));
    assertTrue(pa.appliesTo(boi2));
    control.verify();
}
 
Example #9
Source File: SoapApiModelParser.java    From syndesis with Apache License 2.0 6 votes vote down vote up
private static ConnectorAction parseConnectorAction(final BindingOperationInfo bindingOperationInfo, final Map<String, Integer> idMap,
                                                    final String connectorId) throws ParserException {
    final OperationInfo operationInfo = bindingOperationInfo.getOperationInfo();
    final String description = getDescription(operationInfo,
            o -> "Invokes the operation " + getOperationName(bindingOperationInfo));
    final QName name = bindingOperationInfo.getName();

    final ConnectorAction.Builder builder = new ConnectorAction.Builder()
            .name(name.getLocalPart())
            .description(description)
            .id(getActionId(connectorId, name.getLocalPart(), idMap))
            .descriptor(new ConnectorDescriptor.Builder()
                .connectorId(connectorId)
                .putConfiguredProperty(DEFAULT_OPERATION_NAME_PROPERTY, name.getLocalPart())
                .putConfiguredProperty(DEFAULT_OPERATION_NAMESPACE_PROPERTY, name.getNamespaceURI())
                .putConfiguredProperty(DATA_FORMAT_PROPERTY, PAYLOAD_FORMAT)
                .inputDataShape(getDataShape(bindingOperationInfo.getInput()))
                .outputDataShape(getDataShape(bindingOperationInfo.getOutput()))
                // TODO handle SOAP faults
                .build())
            .pattern(Action.Pattern.To);
    return builder.build();
}
 
Example #10
Source File: ServiceWSDLBuilder.java    From cxf with Apache License 2.0 6 votes vote down vote up
protected void buildBindingOperation(Definition def, Binding binding,
                                   Collection<BindingOperationInfo> bindingOperationInfos) {
    BindingOperation bindingOperation = null;
    for (BindingOperationInfo bindingOperationInfo : bindingOperationInfos) {
        bindingOperation = def.createBindingOperation();
        addDocumentation(bindingOperation, bindingOperationInfo.getDocumentation());
        bindingOperation.setName(bindingOperationInfo.getName().getLocalPart());
        for (Operation operation
                : CastUtils.cast(binding.getPortType().getOperations(), Operation.class)) {
            if (operation.getName().equals(bindingOperation.getName())) {
                bindingOperation.setOperation(operation);
                break;
            }
        }
        buildBindingInput(def, bindingOperation, bindingOperationInfo.getInput());
        buildBindingOutput(def, bindingOperation, bindingOperationInfo.getOutput());
        buildBindingFault(def, bindingOperation, bindingOperationInfo.getFaults());
        addExtensibilityAttributes(def, bindingOperation, bindingOperationInfo.getExtensionAttributes());
        addExtensibilityElements(def, bindingOperation, getWSDL11Extensors(bindingOperationInfo));
        binding.addBindingOperation(bindingOperation);
    }
}
 
Example #11
Source File: StratosAuthorizingHandler.java    From attic-stratos with Apache License 2.0 6 votes vote down vote up
/**
 * Here we are getting the target invocation method. The method get set as a
 * properties in the
 * message by the
 * {@link org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor}
 *
 * @param message incoming message
 * @return
 */
protected Method getTargetMethod(Message message) {
    BindingOperationInfo bop = message.getExchange().get(BindingOperationInfo.class);
    if (bop != null) {
        MethodDispatcher md =
                (MethodDispatcher) message.getExchange().get(Service.class)
                        .get(MethodDispatcher.class.getName());
        return md.getMethod(bop);
    }
    Method method = (Method) message.get("org.apache.cxf.resource.method");
    if (method != null) {
        return method;
    }
    log.error("The requested resource is not found. Please check the resource path etc..");
    throw new AccessDeniedException("Method is not available : Unauthorized");
}
 
Example #12
Source File: NetworkAddressValidatingInterceptor.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
protected Method getTargetMethod(Message m) {
    // Used the SOAP
    BindingOperationInfo bop = m.getExchange().get(BindingOperationInfo.class);
    if (bop != null) {
        MethodDispatcher md = (MethodDispatcher)
                m.getExchange().get(Service.class).get(MethodDispatcher.class.getName());
        return md.getMethod(bop);
    }
    // Used for JAX-RS
    // This doesn't work for JAX-RS sub-resources as the lookup is only done on the original method, not the
    // sub-resource
    Method method = (Method) m.get("org.apache.cxf.resource.method");
    if (method != null) {
        return method;
    }
    throw new AccessDeniedException("Method is not available : Unauthorized");
}
 
Example #13
Source File: PhaseInterceptorChain.java    From cxf with Apache License 2.0 6 votes vote down vote up
private String getServiceInfo(Message message) {
    StringBuilder description = new StringBuilder();
    if (message.getExchange() != null) {
        Exchange exchange = message.getExchange();
        Service service = exchange.getService();
        if (service != null) {
            description.append('\'');
            description.append(service.getName());
            BindingOperationInfo boi = exchange.getBindingOperationInfo();
            OperationInfo opInfo = boi != null ? boi.getOperationInfo() : null;
            if (opInfo != null) {
                description.append('#').append(opInfo.getName());
            }
            description.append("\' ");
        }
    }
    return description.toString();
}
 
Example #14
Source File: ServiceProcessor.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void processBindings(JavaModel model) {
    for (BindingInfo binding : service.getBindings()) {
        bindingType = getBindingType(binding);

        if (bindingType == null) {
            org.apache.cxf.common.i18n.Message msg =
                new org.apache.cxf.common.i18n.Message("BINDING_SPECIFY_ONE_PROTOCOL",
                                                       LOG,
                                                       binding.getName());
            throw new ToolException(msg);
        }

        Collection<BindingOperationInfo> operations = binding.getOperations();
        for (BindingOperationInfo bop : operations) {
            processOperation(model, bop, binding);
        }
    }
}
 
Example #15
Source File: DispatchTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testFindOperationWithSource() throws Exception {
    ServiceImpl service =
        new ServiceImpl(getBus(), getClass().getResource("/wsdl/hello_world.wsdl"), SERVICE_NAME, null);

    Dispatch<Source> disp = service.createDispatch(PORT_NAME, Source.class, Service.Mode.MESSAGE);
    disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, ADDRESS);
    disp.getRequestContext().put("find.dispatch.operation", Boolean.TRUE);

    d.setMessageObserver(new MessageReplayObserver("/org/apache/cxf/jaxws/sayHiResponse.xml"));

    BindingOperationVerifier bov = new BindingOperationVerifier();
    ((DispatchImpl<?>)disp).getClient().getOutInterceptors().add(bov);

    Document doc = StaxUtils.read(getResourceAsStream("/org/apache/cxf/jaxws/sayHi2.xml"));
    DOMSource source = new DOMSource(doc);
    Source res = disp.invoke(source);
    assertNotNull(res);

    BindingOperationInfo boi = bov.getBindingOperationInfo();
    assertNotNull(boi);

    assertEquals(new QName("http://apache.org/hello_world_soap_http", "sayHi"), boi.getName());
}
 
Example #16
Source File: FaultOutInterceptor.java    From cxf with Apache License 2.0 6 votes vote down vote up
/**
 * Find the correct Fault part for a particular exception.
 *
 * @param op
 * @param class1
 */
public FaultInfo getFaultForClass(BindingOperationInfo op, Class<?> class1) {
    FaultInfo selectedFaultInfo = null;
    Class<?> selectedFaultInfoClass = null;
    for (BindingFaultInfo bfi : op.getFaults()) {

        FaultInfo faultInfo = bfi.getFaultInfo();
        Class<?> c = (Class<?>)faultInfo.getProperty(Class.class.getName());
        if (c != null && c.isAssignableFrom(class1) && (selectedFaultInfo == null
            || (selectedFaultInfoClass != null && selectedFaultInfoClass.isAssignableFrom(c)))) {
            selectedFaultInfo = faultInfo;
            selectedFaultInfoClass = c;
        }
    }
    return selectedFaultInfo;
}
 
Example #17
Source File: InstrumentedInvokerFactoryTest.java    From dropwizard-jaxws with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() {
    exchange = mock(Exchange.class);

    BindingOperationInfo boi = mock(BindingOperationInfo.class);
    when(exchange.getBindingOperationInfo()).thenReturn(boi);

    OperationInfo oi = mock(OperationInfo.class);
    when(boi.getOperationInfo()).thenReturn(oi);

    testMetricRegistry = new MetricRegistry();
    mockMetricRegistry = mock(MetricRegistry.class);

    invokerBuilder = new InstrumentedInvokerFactory(mockMetricRegistry);
    instrumentedService = new InstrumentedService();
}
 
Example #18
Source File: JAXRSClientMetricsTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() {
    endpointContext = Mockito.mock(MetricsContext.class);
    operationContext = Mockito.mock(MetricsContext.class);
    resourceContext = Mockito.mock(MetricsContext.class);

    provider = new MetricsProvider() {
        public MetricsContext createEndpointContext(Endpoint endpoint, boolean asClient, String cid) {
            return endpointContext;
        }

        public MetricsContext createOperationContext(Endpoint endpoint, BindingOperationInfo boi, 
                boolean asClient, String cid) {
            return operationContext;
        }

        public MetricsContext createResourceContext(Endpoint endpoint, String resourceName, 
                boolean asClient, String cid) {
            return resourceContext;
        }
    };
}
 
Example #19
Source File: JaxWsClientProxy.java    From cxf with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
private Object invokeAsync(Method method, final BindingOperationInfo oi, Object[] params) throws Exception {

    client.setExecutor(getClient().getEndpoint().getExecutor());

    AsyncHandler<Object> handler;
    if (params.length > 0 && params[params.length - 1] instanceof AsyncHandler) {
        handler = (AsyncHandler<Object>)params[params.length - 1];
        Object[] newParams = new Object[params.length - 1];
        System.arraycopy(params, 0, newParams, 0, newParams.length);
        params = newParams;
    } else {
        handler = null;
    }
    ClientCallback callback = new JaxwsClientCallback<Object>(handler, this) {
        @Override
        protected Throwable mapThrowable(Throwable t) {
            if (t instanceof Exception) {
                t = mapException(null, oi, (Exception)t);
            }
            return t;
        }
    };

    Response<Object> ret = new JaxwsResponseCallback<>(callback);
    client.invoke(callback, oi, params);
    return ret;
}
 
Example #20
Source File: SoapActionInterceptorTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testSoapAction() throws Exception {
    SoapPreProtocolOutInterceptor i = new SoapPreProtocolOutInterceptor();

    Message message = new MessageImpl();
    message.setExchange(new ExchangeImpl());
    message.getExchange().setOutMessage(message);
    SoapBinding sb = new SoapBinding(null);
    message = sb.createMessage(message);
    assertNotNull(message);
    assertTrue(message instanceof SoapMessage);
    SoapMessage soapMessage = (SoapMessage) message;
    soapMessage.put(Message.REQUESTOR_ROLE, Boolean.TRUE);
    assertEquals(Soap11.getInstance(), soapMessage.getVersion());
    (new SoapPreProtocolOutInterceptor()).handleMessage(soapMessage);
    Map<String, List<String>> reqHeaders
        = CastUtils.cast((Map<?, ?>)soapMessage.get(Message.PROTOCOL_HEADERS));
    assertNotNull(reqHeaders);
    assertEquals("\"\"", reqHeaders.get(SoapBindingConstants.SOAP_ACTION).get(0));

    sb.setSoapVersion(Soap12.getInstance());
    soapMessage.clear();
    soapMessage = (SoapMessage) sb.createMessage(soapMessage);
    soapMessage.put(Message.REQUESTOR_ROLE, Boolean.TRUE);
    i.handleMessage(soapMessage);
    String ct = (String) soapMessage.get(Message.CONTENT_TYPE);
    assertEquals("application/soap+xml", ct);

    BindingOperationInfo bop = createBindingOperation();

    soapMessage.getExchange().put(BindingOperationInfo.class, bop);
    SoapOperationInfo soapInfo = new SoapOperationInfo();
    soapInfo.setAction("foo");
    bop.addExtensor(soapInfo);

    i.handleMessage(soapMessage);
    ct = (String) soapMessage.get(Message.CONTENT_TYPE);
    assertEquals("application/soap+xml; action=\"foo\"", ct);
}
 
Example #21
Source File: EffectivePolicyImpl.java    From cxf with Apache License 2.0 5 votes vote down vote up
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 #22
Source File: PolicyEngineImpl.java    From cxf with Apache License 2.0 5 votes vote down vote up
private BindingFaultInfo mapToWrappedBindingFaultInfo(BindingFaultInfo bfi) {
    BindingOperationInfo boi = bfi.getBindingOperation();
    if (boi != null && boi.isUnwrapped()) {
        boi = boi.getWrappedOperation();
        for (BindingFaultInfo bf2 : boi.getFaults()) {
            if (bf2.getFaultInfo().getName().equals(bfi.getFaultInfo().getName())) {
                return bf2;
            }
        }
    }
    return bfi;
}
 
Example #23
Source File: EffectivePolicyImpl.java    From cxf with Apache License 2.0 5 votes vote down vote up
public void initialise(EndpointInfo ei,
                BindingOperationInfo boi,
                BindingFaultInfo bfi,
                PolicyEngine engine,
                Assertor assertor,
                Message m) {
    initialisePolicy(ei, boi, bfi, engine, m);
    chooseAlternative(engine, assertor, m);
    initialiseInterceptors(engine, false, m);
}
 
Example #24
Source File: CorbaConduitTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testClose() throws Exception {
    Method m = CorbaConduit.class.getDeclaredMethod("buildRequest",
        new Class[] {CorbaMessage.class, OperationType.class});
    CorbaConduit conduit = EasyMock.createMockBuilder(CorbaConduit.class)
        .addMockedMethod(m).createMock();

    org.omg.CORBA.Object obj = control.createMock(org.omg.CORBA.Object.class);
    CorbaMessage msg = control.createMock(CorbaMessage.class);
    EasyMock.expect(msg.get(CorbaConstants.CORBA_ENDPOINT_OBJECT)).andReturn(obj);
    Exchange exg = control.createMock(Exchange.class);
    EasyMock.expect(msg.getExchange()).andReturn(exg);
    BindingOperationInfo bopInfo = control.createMock(BindingOperationInfo.class);
    EasyMock.expect(exg.getBindingOperationInfo()).andReturn(bopInfo);
    OperationType opType = control.createMock(OperationType.class);
    bopInfo.getExtensor(OperationType.class);
    EasyMock.expectLastCall().andReturn(opType);
    conduit.buildRequest(msg, opType);
    EasyMock.expectLastCall();
    OutputStream os = control.createMock(OutputStream.class);
    EasyMock.expect(msg.getContent(OutputStream.class)).andReturn(os);
    os.close();
    EasyMock.expectLastCall();

    control.replay();
    conduit.close(msg);
    control.verify();
}
 
Example #25
Source File: DocLiteralInInterceptor.java    From cxf with Apache License 2.0 5 votes vote down vote up
private BindingOperationInfo getBindingOperationInfo(DepthXMLStreamReader xmlReader, Exchange exchange,
                                                     BindingOperationInfo bop, boolean client) {
    //bop might be a unwrapped, wrap it back so that we can get correct info
    if (bop != null && bop.isUnwrapped()) {
        bop = bop.getWrappedOperation();
    }

    if (bop == null) {
        QName startQName = xmlReader == null
            ? new QName("http://cxf.apache.org/jaxws/provider", "invoke")
            : xmlReader.getName();
        bop = getBindingOperationInfo(exchange, startQName, client);
    }
    return bop;
}
 
Example #26
Source File: SoapBindingInfo.java    From cxf with Apache License 2.0 5 votes vote down vote up
public OperationInfo getOperationByAction(String action) {
    for (BindingOperationInfo b : getOperations()) {
        SoapOperationInfo opInfo = b.getExtensor(SoapOperationInfo.class);

        if (opInfo.getAction().equals(action)) {
            return b.getOperationInfo();
        }
    }

    return null;
}
 
Example #27
Source File: JAXWSMethodDispatcher.java    From cxf with Apache License 2.0 5 votes vote down vote up
public BindingOperationInfo getBindingOperation(Method method, Endpoint endpoint) {
    try {
        method = getImplementationMethod(method);
    } catch (NoSuchMethodException e) {
        // ignore
    }
    return super.getBindingOperation(method, endpoint);
}
 
Example #28
Source File: CorbaConduit.java    From cxf with Apache License 2.0 5 votes vote down vote up
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);
        }
    }
}
 
Example #29
Source File: SimpleMethodDispatcher.java    From cxf with Apache License 2.0 5 votes vote down vote up
private BindingOperationInfo getRealOperation(OperationInfo o, BindingOperationInfo bop) {
    BindingOperationInfo unwrappedOp = bop.getUnwrappedOperation();
    if (unwrappedOp != null
        && unwrappedOp.getOperationInfo().equals(o.getUnwrappedOperation())) {
        return unwrappedOp;
    }
    return bop;
}
 
Example #30
Source File: ValidatingInvokerTest.java    From dropwizard-jaxws with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
    underlying = mock(Invoker.class);
    invoker = new ValidatingInvoker(underlying, Validation.buildDefaultValidatorFactory().getValidator());
    exchange = mock(Exchange.class);
    when(exchange.getInMessage()).thenReturn(mock(Message.class));
    BindingOperationInfo boi = mock(BindingOperationInfo.class);
    when(exchange.getBindingOperationInfo()).thenReturn(boi);
    OperationInfo oi = mock(OperationInfo.class);
    when(boi.getOperationInfo()).thenReturn(oi);
}