Search in sources :

Example 11 with W3CEndpointReference

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

the class LocatorClientServerTest method testLookupEndpointAndVerifyWsdlLocationOnly.

@Test
public void testLookupEndpointAndVerifyWsdlLocationOnly() throws Exception {
    URL wsdl = getClass().getResource("/wsdl/locator.wsdl");
    assertNotNull(wsdl);
    LocatorService_Service ss = new LocatorService_Service(wsdl, serviceName);
    LocatorService port = ss.getLocatorServicePort();
    updateAddressPort(port, PORT);
    W3CEndpointReference epr = port.lookupEndpoint(new QName("http://service/2", "Number"));
    String eprString = epr.toString();
    assertTrue(eprString.contains("Metadata"));
    assertTrue(eprString.contains("wsdlLocation=\"wsdlLoc\""));
}
Also used : LocatorService_Service(org.apache.locator.LocatorService_Service) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) QName(javax.xml.namespace.QName) LocatorService(org.apache.locator.LocatorService) URL(java.net.URL) Test(org.junit.Test)

Example 12 with W3CEndpointReference

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

the class LocatorClientServerTest method testLookupEndpointAndVerifyWsdlLocationAndNamespace.

@Test
public void testLookupEndpointAndVerifyWsdlLocationAndNamespace() throws Exception {
    URL wsdl = getClass().getResource("/wsdl/locator.wsdl");
    assertNotNull(wsdl);
    LocatorService_Service ss = new LocatorService_Service(wsdl, serviceName);
    LocatorService port = ss.getLocatorServicePort();
    updateAddressPort(port, PORT);
    W3CEndpointReference epr = port.lookupEndpoint(new QName("http://service/1", "Number"));
    String eprString = epr.toString();
    assertTrue(eprString.contains("Metadata"));
    assertTrue(eprString.contains("wsdlLocation=\"http://service/1 wsdlLoc\""));
}
Also used : LocatorService_Service(org.apache.locator.LocatorService_Service) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) QName(javax.xml.namespace.QName) LocatorService(org.apache.locator.LocatorService) URL(java.net.URL) Test(org.junit.Test)

Example 13 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)

Example 14 with W3CEndpointReference

use of javax.xml.ws.wsaddressing.W3CEndpointReference 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", Boolean.TRUE.equals(numResp.isEven()));
    // try again with the address from another epr
    w3cEpr = nfact.create("3");
    epr = ProviderImpl.convertToInternal(w3cEpr);
    setupContextWithEprAddress(epr, num);
    numResp = num.isEven();
    assertTrue("3 is not even", Boolean.FALSE.equals(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", Boolean.TRUE.equals(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) NumberService(org.apache.cxf.factory_pattern.NumberService) NumberFactoryService(org.apache.cxf.factory_pattern.NumberFactoryService) NumberFactoryService(org.apache.cxf.factory_pattern.NumberFactoryService) IsEvenResponse(org.apache.cxf.factory_pattern.IsEvenResponse) Test(org.junit.Test)

Example 15 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)

Aggregations

W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)37 Test (org.junit.Test)17 QName (javax.xml.namespace.QName)9 EndpointReferenceType (org.apache.cxf.ws.addressing.EndpointReferenceType)9 URL (java.net.URL)8 InputStream (java.io.InputStream)6 StreamResult (javax.xml.transform.stream.StreamResult)6 EndpointReference (javax.xml.ws.EndpointReference)6 Element (org.w3c.dom.Element)6 Number (org.apache.cxf.factory_pattern.Number)5 NumberFactory (org.apache.cxf.factory_pattern.NumberFactory)5 NumberFactoryService (org.apache.cxf.factory_pattern.NumberFactoryService)5 NumberService (org.apache.cxf.factory_pattern.NumberService)5 Document (org.w3c.dom.Document)5 Source (javax.xml.transform.Source)4 Endpoint (javax.xml.ws.Endpoint)4 ServiceImpl (org.apache.cxf.jaxws.ServiceImpl)4 ArrayList (java.util.ArrayList)2 JAXBContext (javax.xml.bind.JAXBContext)2 JAXBException (javax.xml.bind.JAXBException)2