use of com.sun.xml.ws.developer.MemberSubmissionAddressingFeature in project metro-jax-ws by eclipse-ee4j.
the class AddNumbersClient method testCustomFault1.
/**
* This test tests the functionality of OnewayFeature and AddressingFeature the way it being used in WS-AT implementation
* In WS-AT impl, Server-side has to send fault messages to predefined coordinator and this test replicates that usage.
*
* @throws Exception
*/
public void testCustomFault1() throws Exception {
SOAPFault fault = SOAPFactory.newInstance().createFault("custom fault from client", SOAPConstants.SOAP_SENDER_FAULT);
WSEndpointReference to = new WSEndpointReference(getAddress(), AddressingVersion.MEMBER);
OneWayFeature owf = new OneWayFeature();
owf.setRelatesToID("uuid:foobar");
WSService service = WSService.create();
service.addPort(PORT_QNAME, SOAPBinding.SOAP11HTTP_BINDING, getAddress());
Dispatch<Source> dispatch = service.createDispatch(PORT_QNAME, to, Source.class, Service.Mode.PAYLOAD, new MemberSubmissionAddressingFeature(true), owf);
// Since this fault is not a wsdl operation, we need to set SOAPAction for correct wsa:Action
dispatch.getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, true);
dispatch.getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY, "http://example.com/myfault");
try {
dispatch.invokeOneWay(new DOMSource(fault));
} catch (WebServiceException e) {
// since the server-side is not provider based for this test.
// it does n't know from the fault message request that it is oneway and throws 500 code.
// so, expect a WebServcieException here.
}
}
use of com.sun.xml.ws.developer.MemberSubmissionAddressingFeature in project metro-jax-ws by eclipse-ee4j.
the class AddNumbersClient method testFaultToRefpsWithWSDL.
// bug RespectBindingFeature will turn off enabled features in the wsdl
// but not features that have been explicitly set by the client
public void testFaultToRefpsWithWSDL() throws Exception {
try {
MemberSubmissionAddressingFeature addressingFeature = new MemberSubmissionAddressingFeature(true);
RespectBindingFeature bindingFeature = new RespectBindingFeature(false);
WebServiceFeature[] features = new WebServiceFeature[] { addressingFeature, bindingFeature };
Dispatch dispatch = createDispatchWithWSDL(features);
BindingImpl binding = (BindingImpl) dispatch.getBinding();
boolean enabled = AddressingVersion.isEnabled(binding);
if (enabled) {
System.out.println("Addressing is Enabled");
} else {
System.out.println("Addressing is disabled");
}
assertTrue(enabled == true);
WsaUtils.invoke(dispatch, WsaUtils.FAULT_TO_REFPS_MESSAGE, WsaUtils.S11_NS, WsaUtils.W3C_WSA_NS, getAddress(), W3CAddressingConstants.WSA_ANONYMOUS_ADDRESS, W3CAddressingConstants.WSA_ANONYMOUS_ADDRESS, CORRECT_ACTION);
fail("SOAPFaultException must be thrown");
} catch (SOAPFaultException sfe) {
assertTrue("Got SOAPFaultException", true);
}
}
use of com.sun.xml.ws.developer.MemberSubmissionAddressingFeature in project metro-jax-ws by eclipse-ee4j.
the class WSAActionTest method testMethodInvocation.
// test of runtime configuration - check dump messages
public void testMethodInvocation() {
WSAAction port = new WSAActionService().getWSAActionPort(new MemberSubmissionAddressingFeature(true));
port.myWebMethod();
}
use of com.sun.xml.ws.developer.MemberSubmissionAddressingFeature in project metro-jax-ws by eclipse-ee4j.
the class WSAActionFromJavaTest method test.
public void test() {
WSAActionFromJavaService service = new WSAActionFromJavaService();
setupCheckingHanlder(service);
WSAActionFromJava port = service.getWSAActionFromJavaPort(new MemberSubmissionAddressingFeature(true));
port.echo("test");
}
Aggregations