Search in sources :

Example 56 with W3CEndpointReference

use of javax.xml.ws.wsaddressing.W3CEndpointReference in project narayana by jbosstm.

the class BAInteropUtil method registerCoordinatorCompletion.

/**
 * Register a coordinator completion participant in the specified coordination context.
 * @param context The coordination context.
 * @param participant The durable 2PC participant
 * @param id The participant id.
 * @return The participant engine.
 * @throws Exception for errors.
 */
public static CoordinatorCompletionParticipantEngine registerCoordinatorCompletion(final CoordinationContextType context, final BusinessAgreementWithCoordinatorCompletionParticipant participant, final String id) throws Exception {
    final W3CEndpointReference coordinator = RegistrationCoordinator.register(context, MessageId.getMessageId(), getCoordinatorCompletionParticipant(id), BusinessActivityConstants.WSBA_SUB_PROTOCOL_COORDINATOR_COMPLETION);
    final CoordinatorCompletionParticipantEngine engine = new CoordinatorCompletionParticipantEngine(id, coordinator, participant);
    CoordinatorCompletionParticipantProcessor.getProcessor().activateParticipant(engine, id);
    return engine;
}
Also used : CoordinatorCompletionParticipantEngine(com.arjuna.wst11.messaging.engines.CoordinatorCompletionParticipantEngine) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference)

Example 57 with W3CEndpointReference

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

the class EndpointReferenceBuilderTestCase method testParsedInterfaceName.

@Test
public void testParsedInterfaceName() throws Exception {
    W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
    builder = builder.address(URL);
    Element element = DOMUtils.parse(XML_INTERFACE_NAME);
    builder = builder.metadata(element);
    builder = builder.serviceName(SERVICE_QNAME);
    builder = builder.endpointName(PORT_QNAME);
    builder = builder.wsdlDocumentLocation(WSDL_URL);
    element = DOMUtils.parse(XML_REF_PARAM1);
    builder = builder.referenceParameter(element);
    element = DOMUtils.parse(XML_REF_PARAM2);
    builder = builder.referenceParameter(element);
    W3CEndpointReference epr = builder.build();
    DOMResult dr = new DOMResult();
    epr.writeTo(dr);
    Node endpointReferenceElement = dr.getNode();
    Logger.getLogger(this.getClass()).info(DOMUtils.node2String(endpointReferenceElement));
    assertMetaData(endpointReferenceElement);
    assertRefParam(endpointReferenceElement, PARAM1_QNAME, "Hello");
    assertRefParam(endpointReferenceElement, PARAM2_QNAME, "World");
}
Also used : W3CEndpointReferenceBuilder(javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder) DOMResult(javax.xml.transform.dom.DOMResult) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) Element(org.w3c.dom.Element) Node(org.w3c.dom.Node) JBossWSTest(org.jboss.wsf.test.JBossWSTest) Test(org.junit.Test)

Example 58 with W3CEndpointReference

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

the class WSDiscoveryTestCase method testProbeAndResolve.

@Test
@RunAsClient
public void testProbeAndResolve() throws Exception {
    Bus bus = null;
    try {
        bus = BusFactory.newInstance().createBus();
        WSDiscoveryClient client = new WSDiscoveryClient(bus);
        ProbeType pt = new ProbeType();
        ScopesType scopes = new ScopesType();
        pt.setScopes(scopes);
        final String serverHost = getServerHost().replace("127.0.0.1", "localhost");
        final int serverPort = getServerPort();
        List<ProbeMatchType> pmts = client.probe(pt, TIMEOUT).getProbeMatch();
        assertFalse("There must be some services discovered, check that you have allowed UDP broadcast on port 3072", pmts.isEmpty());
        List<ProbeMatchType> pmtsForHost = filterProbeMatchesForHost(pmts, serverHost);
        assertFalse("There must be some services discovered for current host " + serverHost + ", found only " + dbgProbeMatchTypeList(pmts), pmtsForHost.isEmpty());
        List<ResolveMatchType> rmts = new LinkedList<ResolveMatchType>();
        for (ProbeMatchType pmt : pmtsForHost) {
            W3CEndpointReference epr = pmt.getEndpointReference();
            ResolveMatchType rmt = client.resolve(epr, TIMEOUT);
            assertNotNull("Could not resolve (timeout = " + TIMEOUT + " ms) reference: " + epr, rmt);
            rmts.add(rmt);
        }
        final QName typeName = new QName("http://www.jboss.org/jbossws/ws-extensions/wsdd", "ServiceIface");
        checkResolveMatches(rmts, "http://" + serverHost + ":" + serverPort + "/jaxws-samples-wsdd/WSDDService", typeName);
        checkResolveMatches(rmts, "http://" + serverHost + ":" + serverPort + "/jaxws-samples-wsdd2/WSDDService", typeName);
        checkResolveMatches(rmts, "http://" + serverHost + ":" + serverPort + "/jaxws-samples-wsdd2/AnotherWSDDService", typeName);
        client.close();
    } finally {
        bus.shutdown(true);
    }
}
Also used : ScopesType(org.apache.cxf.ws.discovery.wsdl.ScopesType) Bus(org.apache.cxf.Bus) ProbeType(org.apache.cxf.ws.discovery.wsdl.ProbeType) QName(javax.xml.namespace.QName) LinkedList(java.util.LinkedList) ProbeMatchType(org.apache.cxf.ws.discovery.wsdl.ProbeMatchType) ResolveMatchType(org.apache.cxf.ws.discovery.wsdl.ResolveMatchType) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) WSDiscoveryClient(org.apache.cxf.ws.discovery.WSDiscoveryClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test) JBossWSTest(org.jboss.wsf.test.JBossWSTest)

Example 59 with W3CEndpointReference

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

the class JaxWsEndpointImpl method extractWsdlEprs.

private void extractWsdlEprs(EndpointInfo endpoint) {
    // parse the EPR in wsdl
    List<ExtensibilityElement> portExtensors = endpoint.getExtensors(ExtensibilityElement.class);
    if (portExtensors != null) {
        Iterator<ExtensibilityElement> extensionElements = portExtensors.iterator();
        QName wsaEpr = new QName(Names.WSA_NAMESPACE_NAME, "EndpointReference");
        while (extensionElements.hasNext()) {
            ExtensibilityElement ext = extensionElements.next();
            if (ext instanceof UnknownExtensibilityElement && wsaEpr.equals(ext.getElementType())) {
                final Element element = ((UnknownExtensibilityElement) ext).getElement();
                synchronized (element.getOwnerDocument()) {
                    DOMSource domSource = new DOMSource(element);
                    W3CEndpointReference w3cEPR = new W3CEndpointReference(domSource);
                    EndpointReferenceType ref = ProviderImpl.convertToInternal(w3cEPR);
                    endpoint.getTarget().setMetadata(ref.getMetadata());
                    endpoint.getTarget().setReferenceParameters(ref.getReferenceParameters());
                    endpoint.getTarget().getOtherAttributes().putAll(ref.getOtherAttributes());
                }
            }
        }
    }
}
Also used : DOMSource(javax.xml.transform.dom.DOMSource) EndpointReferenceType(org.apache.cxf.ws.addressing.EndpointReferenceType) QName(javax.xml.namespace.QName) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) UnknownExtensibilityElement(javax.wsdl.extensions.UnknownExtensibilityElement) UnknownExtensibilityElement(javax.wsdl.extensions.UnknownExtensibilityElement) ExtensibilityElement(javax.wsdl.extensions.ExtensibilityElement) Element(org.w3c.dom.Element) UnknownExtensibilityElement(javax.wsdl.extensions.UnknownExtensibilityElement) ExtensibilityElement(javax.wsdl.extensions.ExtensibilityElement)

Example 60 with W3CEndpointReference

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

the class Client method main.

public static void main(String[] args) throws Exception {
    Object implementor = new CallbackImpl();
    String address = "http://localhost:9005/CallbackContext/CallbackPort";
    Endpoint endpoint = Endpoint.publish(address, implementor);
    if (args.length == 0) {
        System.out.println("please specify wsdl");
        System.exit(1);
    }
    URL wsdlURL;
    File wsdlFile = new File(args[0]);
    if (wsdlFile.exists()) {
        wsdlURL = wsdlFile.toURI().toURL();
    } else {
        wsdlURL = new URL(args[0]);
    }
    SOAPService ss = new SOAPService(wsdlURL, SERVICE_NAME);
    ServerPortType port = ss.getSOAPPort();
    InputStream is = demo.callback.client.Client.class.getResourceAsStream("/callback_infoset.xml");
    Document doc = StaxUtils.read(is);
    Element referenceParameters = DOMUtils.findChildWithAtt(doc.getDocumentElement(), "wsa:ReferenceParameters", "name", "");
    W3CEndpointReference ref = (W3CEndpointReference) endpoint.getEndpointReference(referenceParameters);
    String resp = port.registerCallback(ref);
    System.out.println("Response from server: " + resp);
    System.exit(0);
}
Also used : SOAPService(org.apache.callback.SOAPService) InputStream(java.io.InputStream) Element(org.w3c.dom.Element) ServerPortType(org.apache.callback.ServerPortType) Document(org.w3c.dom.Document) URL(java.net.URL) Endpoint(javax.xml.ws.Endpoint) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) File(java.io.File)

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