use of org.apache.cxf.ws.addressing.WSAddressingFeature in project cxf by apache.
the class WSAClientServerTest method testCxfWsaFeature.
@Test
public void testCxfWsaFeature() throws Exception {
ByteArrayOutputStream input = setupInLogging();
ByteArrayOutputStream output = setupOutLogging();
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setServiceClass(AddNumbersPortType.class);
factory.setAddress("http://localhost:" + PORT + "/jaxws/add");
factory.getFeatures().add(new WSAddressingFeature());
AddNumbersPortType port = (AddNumbersPortType) factory.create();
((BindingProvider) port).getRequestContext().put("ws-addressing.write.optional.replyto", Boolean.TRUE);
assertEquals(3, port.addNumbers(1, 2));
assertLogContains(output.toString(), "//wsa:Address", "http://www.w3.org/2005/08/addressing/anonymous");
assertLogContains(input.toString(), "//wsa:RelatesTo", getLogValue(output.toString(), "//wsa:MessageID"));
}
use of org.apache.cxf.ws.addressing.WSAddressingFeature in project cxf by apache.
the class Server method run.
protected void run() {
setBus(BusFactory.getDefaultBus());
Object implementor = new AddNumberImpl();
String address = "http://localhost:" + PORT + "/AddNumberImplPort";
ep1 = new EndpointImpl(implementor);
ep1.getFeatures().add(new WSAddressingFeature());
ep1.publish(address);
ep2 = new EndpointImpl(new AddNumberImplNoAddr());
ep2.publish(address + "-noaddr");
}
use of org.apache.cxf.ws.addressing.WSAddressingFeature in project cxf by apache.
the class Server method run.
protected void run() {
Object implementor = new AddNumberReg();
String address = "http://localhost:" + PORT + "/jaxws/add";
EndpointImpl ep;
ep = new EndpointImpl(BusFactory.getThreadDefaultBus(), implementor, null, getWsdl());
ep.getFeatures().add(new WSAddressingFeature());
ep.publish(address);
eps.add(ep);
implementor = new AddNumberNonAnon();
address = "http://localhost:" + PORT + "/jaxws/addNonAnon";
ep = new EndpointImpl(BusFactory.getThreadDefaultBus(), implementor, null, getWsdl());
ep.getFeatures().add(new WSAddressingFeature());
ep.publish(address);
eps.add(ep);
implementor = new AddNumberOnlyAnon();
address = "http://localhost:" + PORT + "/jaxws/addAnon";
ep = new EndpointImpl(BusFactory.getThreadDefaultBus(), implementor, null, getWsdl());
ep.getFeatures().add(new WSAddressingFeature());
ep.publish(address);
eps.add(ep);
}
use of org.apache.cxf.ws.addressing.WSAddressingFeature in project cxf by apache.
the class JaxWsEndpointImpl method extractWsdlExtensibilities.
private void extractWsdlExtensibilities(EndpointInfo endpoint) {
List<ExtensibilityElement> portExtensors = getExtensors(endpoint);
List<ExtensibilityElement> bindingExtensors = getExtensors(endpoint.getBinding());
// check the extensions under <wsdl:binding>
checkRespectBindingFeature(bindingExtensors);
Collection<BindingOperationInfo> bindingOperations = endpoint.getBinding().getOperations();
if (null != bindingOperations) {
Iterator<BindingOperationInfo> iterator = bindingOperations.iterator();
while (iterator.hasNext()) {
BindingOperationInfo operationInfo = iterator.next();
BindingMessageInfo inputInfo = operationInfo.getInput();
BindingMessageInfo outputnfo = operationInfo.getOutput();
Collection<BindingFaultInfo> faults = operationInfo.getFaults();
// check the extensions under <wsdl:operation>
checkRespectBindingFeature(getExtensors(operationInfo));
// check the extensions under <wsdl:input>
checkRespectBindingFeature(getExtensors(inputInfo));
// check the extensions under <wsdl:output>
checkRespectBindingFeature(getExtensors(outputnfo));
if (null != faults) {
Iterator<BindingFaultInfo> faultIterator = faults.iterator();
while (faultIterator.hasNext()) {
BindingFaultInfo faultInfo = faultIterator.next();
// check the extensions under <wsdl:fault>
checkRespectBindingFeature(getExtensors(faultInfo));
}
}
}
}
if (hasUsingAddressing(bindingExtensors) || hasUsingAddressing(portExtensors)) {
WSAddressingFeature feature = new WSAddressingFeature();
if (addressingRequired(bindingExtensors) || addressingRequired(portExtensors)) {
feature.setAddressingRequired(true);
}
addAddressingFeature(feature);
}
extractWsdlEprs(endpoint);
}
use of org.apache.cxf.ws.addressing.WSAddressingFeature in project cxf by apache.
the class JaxWsEndpointImpl method resolveFeatures.
public final void resolveFeatures() {
AddressingFeature addressing = getAddressingFeature();
if (addressing == null) {
return;
}
if (addressing.isEnabled()) {
WSAddressingFeature feature = getWSAddressingFeature();
if (feature == null) {
feature = new WSAddressingFeature();
addAddressingFeature(feature);
}
feature.setAddressingRequired(addressing.isRequired());
feature.setResponses(addressing.getResponses().toString());
} else {
removeAddressingFeature();
getEndpointInfo().setProperty("org.apache.cxf.ws.addressing.MAPAggregator.addressingDisabled", Boolean.TRUE);
}
}
Aggregations