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;
}
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");
}
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);
}
}
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());
}
}
}
}
}
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);
}
Aggregations