Search in sources :

Example 66 with W3CEndpointReference

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

the class WSNHelper method getPort.

public <T> T getPort(EndpointReference ref, Class<T> serviceInterface, Class<?>... extraClasses) {
    if (!(ref instanceof W3CEndpointReference)) {
        throw new IllegalArgumentException("Unsupported endpoint reference: " + (ref != null ? ref.toString() : "null"));
    }
    W3CEndpointReference w3cEpr = (W3CEndpointReference) ref;
    String address = getWSAAddress(w3cEpr);
    return getPort(address, serviceInterface, extraClasses);
}
Also used : W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference)

Example 67 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 68 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 69 with W3CEndpointReference

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

the class EndpointReferenceTest method testProviderReadEndpointReference.

@Test
public void testProviderReadEndpointReference() throws Exception {
    ProviderImpl provider = new ProviderImpl();
    InputStream is = getClass().getResourceAsStream("resources/hello_world_soap_http_infoset.xml");
    Document doc = StaxUtils.read(is);
    DOMSource erXML = new DOMSource(doc);
    EndpointReference endpointReference = provider.readEndpointReference(erXML);
    assertNotNull(endpointReference);
    assertTrue(endpointReference instanceof W3CEndpointReference);
}
Also used : DOMSource(javax.xml.transform.dom.DOMSource) InputStream(java.io.InputStream) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) ProviderImpl(org.apache.cxf.jaxws.spi.ProviderImpl) Document(org.w3c.dom.Document) EndpointReference(javax.xml.ws.EndpointReference) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) Test(org.junit.Test)

Example 70 with W3CEndpointReference

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

the class EndpointReferenceTest method testBindingProviderSOAPBinding.

@Test
public void testBindingProviderSOAPBinding() throws Exception {
    javax.xml.ws.Service s = javax.xml.ws.Service.create(new QName("http://apache.org/hello_world_soap_http", "SoapPort"));
    assertNotNull(s);
    Greeter greeter = s.getPort(Greeter.class);
    BindingProvider bindingProvider = (BindingProvider) greeter;
    EndpointReference er = bindingProvider.getEndpointReference();
    assertNotNull(er);
    // If the BindingProvider instance has a binding that is either SOAP 1.1/HTTP or SOAP
    // 1.2/HTTP, then a W3CEndpointReference MUST be returned.
    assertTrue(er instanceof W3CEndpointReference);
}
Also used : QName(javax.xml.namespace.QName) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) Greeter(org.apache.hello_world_soap_http.Greeter) BindingProvider(javax.xml.ws.BindingProvider) EndpointReference(javax.xml.ws.EndpointReference) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) Test(org.junit.Test)

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