Search in sources :

Example 71 with W3CEndpointReference

use of javax.xml.ws.wsaddressing.W3CEndpointReference in project cxf by apache.

the class NumberFactoryImpl method create.

public W3CEndpointReference create(String id) {
    manageNumberServantInitialisation();
    int val = Integer.valueOf(id);
    // allow clients to drive test scenarios with val
    String portName = "NumberPort";
    if (val >= 30) {
        // use jms transport
        portName = "NumberPortJMS";
    }
    EndpointReferenceType epr = EndpointReferenceUtils.getEndpointReferenceWithId(NUMBER_SERVICE_QNAME, portName, id, bus);
    Source source = EndpointReferenceUtils.convertToXML(epr);
    return new W3CEndpointReference(source);
}
Also used : EndpointReferenceType(org.apache.cxf.ws.addressing.EndpointReferenceType) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) Source(javax.xml.transform.Source)

Example 72 with W3CEndpointReference

use of javax.xml.ws.wsaddressing.W3CEndpointReference in project cxf by apache.

the class CallbackClientServerTest method testCallback.

@Test
public void testCallback() throws Exception {
    Object implementor = new CallbackImpl();
    String address = "http://localhost:" + CB_PORT + "/CallbackContext/CallbackPort";
    Endpoint ep = Endpoint.publish(address, implementor);
    URL wsdlURL = getClass().getResource("/wsdl/basic_callback_test.wsdl");
    SOAPService ss = new SOAPService(wsdlURL, SERVICE_NAME);
    ServerPortType port = ss.getPort(PORT_NAME, ServerPortType.class);
    updateAddressPort(port, PORT);
    EndpointReference w3cEpr = ep.getEndpointReference();
    String resp = port.registerCallback((W3CEndpointReference) w3cEpr);
    assertEquals("registerCallback called", resp);
    ep.stop();
}
Also used : SOAPService(org.apache.callback.SOAPService) Endpoint(javax.xml.ws.Endpoint) ServerPortType(org.apache.callback.ServerPortType) URL(java.net.URL) EndpointReference(javax.xml.ws.EndpointReference) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) Test(org.junit.Test)

Example 73 with W3CEndpointReference

use of javax.xml.ws.wsaddressing.W3CEndpointReference in project cxf by apache.

the class ManualNumberFactoryImpl method create.

public W3CEndpointReference create(String id) {
    manageNumberServantInitialisation();
    // manually force id into address context as context appendage
    EndpointReferenceType epr = EndpointReferenceUtils.duplicate(templateEpr);
    EndpointReferenceUtils.setAddress(epr, EndpointReferenceUtils.getAddress(epr) + id);
    Source source = EndpointReferenceUtils.convertToXML(epr);
    return new W3CEndpointReference(source);
}
Also used : EndpointReferenceType(org.apache.cxf.ws.addressing.EndpointReferenceType) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) Source(javax.xml.transform.Source)

Example 74 with W3CEndpointReference

use of javax.xml.ws.wsaddressing.W3CEndpointReference in project cxf by apache.

the class MultiplexClientServerTest method testWithGetPortExtensionOverJMS.

@Test
public void testWithGetPortExtensionOverJMS() throws Exception {
    NumberFactoryService service = new NumberFactoryService();
    NumberFactory factory = service.getNumberFactoryPort();
    updateAddressPort(factory, PORT);
    // use values >= 30 to create JMS eprs - see NumberFactoryImpl.create
    // verify it is JMS, 999 for JMS will throw a fault
    W3CEndpointReference ref = factory.create("999");
    String s = NumberService.WSDL_LOCATION.toString();
    EmbeddedJMSBrokerLauncher.updateWsdlExtensors(BusFactory.getDefaultBus(), s);
    NumberService numService = new NumberService();
    assertNotNull("reference", ref);
    ServiceImpl serviceImpl = ServiceDelegateAccessor.get(numService);
    Number num = serviceImpl.getPort(ref, Number.class);
    try {
        num.isEven().isEven();
        fail("there should be a fault on val 999");
    } catch (Exception expected) {
        assertTrue("match on exception message " + expected.getMessage(), expected.getMessage().indexOf("999") != -1);
    }
    ClientProxy.getClient(num).getConduit().close();
    ref = factory.create("37");
    assertNotNull("reference", ref);
    num = serviceImpl.getPort(ref, Number.class);
    assertFalse("37 is not even", num.isEven().isEven());
    ClientProxy.getClient(num).getConduit().close();
    ClientProxy.getClient(factory).getConduit().close();
}
Also used : NumberService(org.apache.cxf.factory_pattern.NumberService) NumberFactory(org.apache.cxf.factory_pattern.NumberFactory) Number(org.apache.cxf.factory_pattern.Number) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) ServiceImpl(org.apache.cxf.jaxws.ServiceImpl) NumberFactoryService(org.apache.cxf.factory_pattern.NumberFactoryService) IOException(java.io.IOException) Test(org.junit.Test)

Example 75 with W3CEndpointReference

use of javax.xml.ws.wsaddressing.W3CEndpointReference in project cxf by apache.

the class HttpNumberFactoryImpl method create.

public W3CEndpointReference create(String id) {
    String portName = null;
    EndpointReferenceType epr = EndpointReferenceUtils.getEndpointReferenceWithId(NUMBER_SERVICE_QNAME, portName, id, bus);
    Source source = EndpointReferenceUtils.convertToXML(epr);
    return new W3CEndpointReference(source);
}
Also used : EndpointReferenceType(org.apache.cxf.ws.addressing.EndpointReferenceType) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) Source(javax.xml.transform.Source)

Aggregations

W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)154 Test (org.junit.Test)80 InstanceIdentifier (com.arjuna.webservices11.wsarj.InstanceIdentifier)56 MAP (org.jboss.ws.api.addressing.MAP)53 SystemException (com.arjuna.wst.SystemException)16 UnknownTransactionException (com.arjuna.wst.UnknownTransactionException)16 QName (javax.xml.namespace.QName)16 W3CEndpointReferenceBuilder (javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder)16 InvalidCreateParametersException (com.arjuna.wsc.InvalidCreateParametersException)15 CoordinationContextType (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)14 WrongStateException (com.arjuna.wst.WrongStateException)12 TransactionRolledBackException (com.arjuna.wst.TransactionRolledBackException)11 EndpointReferenceType (org.apache.cxf.ws.addressing.EndpointReferenceType)9 CoordinationContext (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext)9 TxContextImple (com.arjuna.mwlabs.wst11.ba.context.TxContextImple)8 State (com.arjuna.webservices11.wsba.State)8 InvalidProtocolException (com.arjuna.wsc.InvalidProtocolException)8 CoordinatorCompletionCoordinatorDetails (com.arjuna.wst.tests.arq.TestCoordinatorCompletionCoordinatorProcessor.CoordinatorCompletionCoordinatorDetails)8 ParticipantCompletionParticipantDetails (com.arjuna.wst.tests.arq.TestParticipantCompletionParticipantProcessor.ParticipantCompletionParticipantDetails)8 URL (java.net.URL)8