Search in sources :

Example 1 with IsEvenResponse

use of org.apache.cxf.factory_pattern.IsEvenResponse in project cxf by apache.

the class MultiplexHttpAddressClientServerTest method testWithManualMultiplexEprCreation.

@Test
public void testWithManualMultiplexEprCreation() throws Exception {
    Service numService = Service.create(NumberFactoryImpl.NUMBER_SERVICE_QNAME);
    Number num = numService.getPort(Number.class);
    InvocationHandler handler = Proxy.getInvocationHandler(num);
    BindingProvider bp = (BindingProvider) handler;
    bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, NUMBER_SERVANT_ADDRESS_ROOT + "103");
    IsEvenResponse numResp = num.isEven();
    assertFalse("103 is not even", numResp.isEven());
}
Also used : Number(org.apache.cxf.factory_pattern.Number) Service(javax.xml.ws.Service) NumberFactoryService(org.apache.cxf.factory_pattern.NumberFactoryService) NumberService(org.apache.cxf.factory_pattern.NumberService) BindingProvider(javax.xml.ws.BindingProvider) IsEvenResponse(org.apache.cxf.factory_pattern.IsEvenResponse) InvocationHandler(java.lang.reflect.InvocationHandler) Test(org.junit.Test)

Example 2 with IsEvenResponse

use of org.apache.cxf.factory_pattern.IsEvenResponse in project cxf by apache.

the class ManualHttpMulitplexClientServerTest method testWithManualMultiplexEprCreation.

@Test
public void testWithManualMultiplexEprCreation() throws Exception {
    NumberFactoryService service = new NumberFactoryService();
    NumberFactory nfact = service.getNumberFactoryPort();
    updateAddressPort(nfact, PORT);
    W3CEndpointReference w3cEpr = nfact.create("2");
    assertNotNull("reference", w3cEpr);
    // use the epr info only
    // no wsdl so default generated soap/http binding will be used
    // address url must come from the calling context
    EndpointReferenceType epr = ProviderImpl.convertToInternal(w3cEpr);
    QName serviceName = EndpointReferenceUtils.getServiceName(epr, bus);
    Service numService = Service.create(serviceName);
    String portString = EndpointReferenceUtils.getPortName(epr);
    QName portName = new QName(serviceName.getNamespaceURI(), portString);
    numService.addPort(portName, SoapBindingFactory.SOAP_11_BINDING, "http://foo");
    Number num = numService.getPort(portName, Number.class);
    setupContextWithEprAddress(epr, num);
    IsEvenResponse numResp = num.isEven();
    assertTrue("2 is even", numResp.isEven());
    // try again with the address from another epr
    w3cEpr = nfact.create("3");
    epr = ProviderImpl.convertToInternal(w3cEpr);
    setupContextWithEprAddress(epr, num);
    numResp = num.isEven();
    assertFalse("3 is not even", numResp.isEven());
    // try again with the address from another epr
    w3cEpr = nfact.create("6");
    epr = ProviderImpl.convertToInternal(w3cEpr);
    setupContextWithEprAddress(epr, num);
    numResp = num.isEven();
    assertTrue("6 is even", numResp.isEven());
}
Also used : NumberFactory(org.apache.cxf.factory_pattern.NumberFactory) EndpointReferenceType(org.apache.cxf.ws.addressing.EndpointReferenceType) Number(org.apache.cxf.factory_pattern.Number) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) NumberFactoryService(org.apache.cxf.factory_pattern.NumberFactoryService) NumberService(org.apache.cxf.factory_pattern.NumberService) NumberFactoryService(org.apache.cxf.factory_pattern.NumberFactoryService) IsEvenResponse(org.apache.cxf.factory_pattern.IsEvenResponse) Test(org.junit.Test)

Example 3 with IsEvenResponse

use of org.apache.cxf.factory_pattern.IsEvenResponse in project cxf by apache.

the class NumberImpl method genResponse.

private IsEvenResponse genResponse(boolean v) {
    IsEvenResponse resp = new ObjectFactory().createIsEvenResponse();
    resp.setEven(v);
    return resp;
}
Also used : ObjectFactory(org.apache.cxf.factory_pattern.ObjectFactory) IsEvenResponse(org.apache.cxf.factory_pattern.IsEvenResponse)

Aggregations

IsEvenResponse (org.apache.cxf.factory_pattern.IsEvenResponse)3 Service (javax.xml.ws.Service)2 Number (org.apache.cxf.factory_pattern.Number)2 NumberFactoryService (org.apache.cxf.factory_pattern.NumberFactoryService)2 NumberService (org.apache.cxf.factory_pattern.NumberService)2 Test (org.junit.Test)2 InvocationHandler (java.lang.reflect.InvocationHandler)1 QName (javax.xml.namespace.QName)1 BindingProvider (javax.xml.ws.BindingProvider)1 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)1 NumberFactory (org.apache.cxf.factory_pattern.NumberFactory)1 ObjectFactory (org.apache.cxf.factory_pattern.ObjectFactory)1 EndpointReferenceType (org.apache.cxf.ws.addressing.EndpointReferenceType)1