use of jakarta.xml.ws.soap.AddressingFeature in project metro-jax-ws by eclipse-ee4j.
the class EndpointFeaturesTest method testPublish.
// Tests Endpoint.publish(address, impl, features)
public void testPublish() throws Exception {
int port = PortAllocator.getFreePort();
String address = "http://localhost:" + port + "/hello";
Endpoint endpoint = Endpoint.publish(address, new FeaturesEndpoint(), new AddressingFeature(true, true, AddressingFeature.Responses.ANONYMOUS));
assertTrue(endpoint.isPublished());
publishVerifyStop(address, endpoint);
}
use of jakarta.xml.ws.soap.AddressingFeature in project metro-jax-ws by eclipse-ee4j.
the class SOAPAction2Test method testSOAPActionWithDispatch_WithUse_true_WithWSA.
// when use is true, so action is effective
public void testSOAPActionWithDispatch_WithUse_true_WithWSA() throws JAXBException {
TestEndpoint2 port = new TestEndpointService2().getTestEndpointPort2();
String address = (String) ((BindingProvider) port).getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
Service s = Service.create(new QName("http://client.soapaction_use.server/", "TestEndpointService2"));
s.addPort(new QName("http://client.soapaction_use.server/", "TestEndpointPort2"), SOAPBinding.SOAP11HTTP_BINDING, address);
Dispatch<Object> d = s.createDispatch(new QName("http://client.soapaction_use.server/", "TestEndpointPort2"), JAXBContext.newInstance(ObjectFactory.class), Service.Mode.PAYLOAD, new AddressingFeature());
((BindingProvider) d).getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY, action);
((BindingProvider) d).getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, true);
JAXBElement<String> r = (JAXBElement<String>) d.invoke(new ObjectFactory().createEchoSOAPAction("dummy"));
assertEquals(action, r.getValue());
}
use of jakarta.xml.ws.soap.AddressingFeature in project metro-jax-ws by eclipse-ee4j.
the class SOAPAction2Test method testSOAPActionWithDispatch_WithoutUse_WithWSA.
// when WSA is enabled, use property defaults to true, so action is effective
public void testSOAPActionWithDispatch_WithoutUse_WithWSA() throws JAXBException {
TestEndpoint2 port = new TestEndpointService2().getTestEndpointPort2();
String address = (String) ((BindingProvider) port).getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
Service s = Service.create(new QName("http://client.soapaction_use.server/", "TestEndpointService2"));
s.addPort(new QName("http://client.soapaction_use.server/", "TestEndpointPort2"), SOAPBinding.SOAP11HTTP_BINDING, address);
Dispatch<Object> d = s.createDispatch(new QName("http://client.soapaction_use.server/", "TestEndpointPort2"), JAXBContext.newInstance(ObjectFactory.class), Service.Mode.PAYLOAD, new AddressingFeature());
((BindingProvider) d).getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY, action);
JAXBElement<String> r = (JAXBElement<String>) d.invoke(new ObjectFactory().createEchoSOAPAction("dummy"));
assertEquals(action, r.getValue());
}
use of jakarta.xml.ws.soap.AddressingFeature in project metro-jax-ws by eclipse-ee4j.
the class SOAPAction2Test method testSOAPActionWithDispatch_WithUse_false_WithWSA.
// use is false but WSA is enabled, so action is ineffective
public void testSOAPActionWithDispatch_WithUse_false_WithWSA() throws JAXBException {
TestEndpoint2 port = new TestEndpointService2().getTestEndpointPort2();
String address = (String) ((BindingProvider) port).getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
Service s = Service.create(new QName("http://client.soapaction_use.server/", "TestEndpointService2"));
s.addPort(new QName("http://client.soapaction_use.server/", "TestEndpointPort2"), SOAPBinding.SOAP11HTTP_BINDING, address);
Dispatch<Object> d = new TestEndpointService2().createDispatch(new QName("http://client.soapaction_use.server/", "TestEndpointPort2"), JAXBContext.newInstance(ObjectFactory.class), Service.Mode.PAYLOAD, new AddressingFeature());
((BindingProvider) d).getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY, dummy_action);
((BindingProvider) d).getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, false);
JAXBElement<String> r = (JAXBElement<String>) d.invoke(new ObjectFactory().createEchoSOAPAction("dummy"));
assertEquals(action, r.getValue());
}
use of jakarta.xml.ws.soap.AddressingFeature in project metro-jax-ws by eclipse-ee4j.
the class AddNumbersClient method testMissingActionWithWSDL.
public void testMissingActionWithWSDL() throws Exception {
try {
WebServiceFeature[] features = new WebServiceFeature[] { new AddressingFeature(false) };
Dispatch dispatch = createDispatchWithWSDL(features);
BindingImpl binding = (BindingImpl) dispatch.getBinding();
AddressingVersion addressingVersion = AddressingVersion.fromBinding(binding);
System.out.println("Addressing version is " + addressingVersion);
assertFalse(AddressingVersion.isEnabled(binding));
WsaUtils.invoke(dispatch, WsaUtils.MISSING_ACTION_MESSAGE, WsaUtils.S11_NS, WsaUtils.W3C_WSA_NS, getAddress(), W3CAddressingConstants.WSA_ANONYMOUS_ADDRESS);
fail("SOAPFaultException must be thrown");
} catch (SOAPFaultException sfe) {
assertFault(sfe, W3CAddressingConstants.MAP_REQUIRED_QNAME);
}
}
Aggregations