Java Code Examples for org.apache.cxf.ws.addressing.EndpointReferenceType#setAddress()
The following examples show how to use
org.apache.cxf.ws.addressing.EndpointReferenceType#setAddress() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WSAFromWSDLTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testNonAnonToAnon() throws Exception { try (AddNumbersPortTypeProxy port = getPort()) { port.getRequestContext() .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + PORT + "/jaxws/addAnon"); AddressingProperties maps = new AddressingProperties(); EndpointReferenceType ref = new EndpointReferenceType(); AttributedURIType add = new AttributedURIType(); add.setValue("http://localhost:" + INVALID_PORT + "/not/a/real/url"); ref.setAddress(add); maps.setReplyTo(ref); maps.setFaultTo(ref); port.getRequestContext() .put("javax.xml.ws.addressing.context", maps); try { port.addNumbers3(-1, 2); } catch (SOAPFaultException e) { assertTrue(e.getFault().getFaultCode().contains("OnlyAnonymousAddressSupported")); } } }
Example 2
Source File: IntegrationBaseTest.java From cxf with Apache License 2.0 | 6 votes |
protected Resource createClient(ReferenceParametersType refParams) { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); Map<String, Object> props = factory.getProperties(); if (props == null) { props = new HashMap<>(); } props.put("jaxb.additionalContextClasses", ExpressionType.class); factory.setProperties(props); factory.setBus(bus); factory.setServiceClass(Resource.class); factory.setAddress(RESOURCE_ADDRESS); Resource proxy = (Resource) factory.create(); // Add reference parameters AddressingProperties addrProps = new AddressingProperties(); EndpointReferenceType endpoint = new EndpointReferenceType(); endpoint.setReferenceParameters(refParams); endpoint.setAddress(ContextUtils.getAttributedURI(RESOURCE_ADDRESS)); addrProps.setTo(endpoint); ((BindingProvider) proxy).getRequestContext().put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, addrProps); return proxy; }
Example 3
Source File: ResourceTest.java From cxf with Apache License 2.0 | 6 votes |
protected Resource createClient(ReferenceParametersType refParams) { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setBus(bus); factory.setServiceClass(Resource.class); factory.setAddress(RESOURCE_LOCAL_ADDRESS); Resource proxy = (Resource) factory.create(); // Add reference parameters AddressingProperties addrProps = new AddressingProperties(); EndpointReferenceType endpoint = new EndpointReferenceType(); endpoint.setReferenceParameters(refParams); endpoint.setAddress(ContextUtils.getAttributedURI(RESOURCE_ADDRESS)); addrProps.setTo(endpoint); ((BindingProvider) proxy).getRequestContext().put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, addrProps); return proxy; }
Example 4
Source File: MAPAggregatorTest.java From cxf with Apache License 2.0 | 6 votes |
@Test(expected = SoapFault.class) public void testTwoWayRequestWithReplyToNone() throws Exception { Message message = new MessageImpl(); Exchange exchange = new ExchangeImpl(); exchange.setOutMessage(message); message.setExchange(exchange); setUpMessageProperty(message, REQUESTOR_ROLE, Boolean.FALSE); AddressingProperties maps = new AddressingProperties(); EndpointReferenceType replyTo = new EndpointReferenceType(); replyTo.setAddress(ContextUtils.getAttributedURI(Names.WSA_NONE_ADDRESS)); maps.setReplyTo(replyTo); AttributedURIType id = ContextUtils.getAttributedURI("urn:uuid:12345"); maps.setMessageID(id); maps.setAction(ContextUtils.getAttributedURI("")); setUpMessageProperty(message, ADDRESSING_PROPERTIES_OUTBOUND, maps); setUpMessageProperty(message, "org.apache.cxf.ws.addressing.map.fault.name", "NoneAddress"); aggregator.mediate(message, false); }
Example 5
Source File: CorbaDestination.java From cxf with Apache License 2.0 | 6 votes |
public CorbaDestination(EndpointInfo ei, OrbConfig config, CorbaTypeMap tm) { address = ei.getExtensor(AddressType.class); binding = ei.getBinding(); reference = new EndpointReferenceType(); AttributedURIType addr = new AttributedURIType(); addr.setValue(address.getLocation()); reference.setAddress(addr); endpointInfo = ei; orbConfig = config; if (tm != null) { typeMap = tm; } else { typeMap = TypeMapCache.get(binding.getService()); } PolicyType policy = ei.getExtensor(PolicyType.class); if (policy != null) { poaName = policy.getPoaname(); isPersistent = policy.isPersistent(); serviceId = policy.getServiceid(); } }
Example 6
Source File: WSAFaultToClientServerTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testOneWayFaultTo() throws Exception { URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl"); QName serviceName = new QName("http://apache.org/hello_world_soap_http", "SOAPServiceAddressing"); Greeter greeter = new SOAPService(wsdl, serviceName).getPort(Greeter.class, new AddressingFeature()); EndpointReferenceType faultTo = new EndpointReferenceType(); AddressingProperties addrProperties = new AddressingProperties(); AttributedURIType epr = new AttributedURIType(); String faultToAddress = "http://localhost:" + FaultToEndpointServer.FAULT_PORT + "/faultTo"; epr.setValue(faultToAddress); faultTo.setAddress(epr); addrProperties.setFaultTo(faultTo); BindingProvider provider = (BindingProvider) greeter; Map<String, Object> requestContext = provider.getRequestContext(); requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + FaultToEndpointServer.PORT + "/jaxws/greeter"); requestContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, addrProperties); greeter.greetMeOneWay("test"); //wait for the fault request int i = 2; while (HelloHandler.getFaultRequestPath() == null && i > 0) { Thread.sleep(500); i--; } assertTrue("FaultTo request fpath isn't expected", "/faultTo".equals(HelloHandler.getFaultRequestPath())); }
Example 7
Source File: WSAEndpointReferenceUtils.java From cxf with Apache License 2.0 | 5 votes |
/** * Create a duplicate endpoint reference sharing all atributes * @param ref the reference to duplicate * @return EndpointReferenceType - the duplicate endpoint reference */ public static EndpointReferenceType duplicate(EndpointReferenceType ref) { EndpointReferenceType reference = WSA_OBJECT_FACTORY.createEndpointReferenceType(); reference.setMetadata(ref.getMetadata()); reference.getAny().addAll(ref.getAny()); reference.setAddress(ref.getAddress()); return reference; }
Example 8
Source File: LocalTransportFactory.java From cxf with Apache License 2.0 | 5 votes |
private static EndpointReferenceType createReference(EndpointInfo ei) { EndpointReferenceType epr = new EndpointReferenceType(); AttributedURIType address = new AttributedURIType(); address.setValue(ei.getAddress()); epr.setAddress(address); return epr; }
Example 9
Source File: MAPAggregatorTest.java From cxf with Apache License 2.0 | 5 votes |
private void setUpConduit(Message message, Exchange exchange) { setUpMessageExchange(message, exchange); Conduit conduit = EasyMock.createMock(Conduit.class); setUpExchangeConduit(message, exchange, conduit); EndpointReferenceType to = ContextUtils.WSA_OBJECT_FACTORY.createEndpointReferenceType(); to.setAddress(ContextUtils.getAttributedURI(expectedTo)); conduit.getTarget(); EasyMock.expectLastCall().andReturn(to).anyTimes(); }
Example 10
Source File: AbstractDestination.java From cxf with Apache License 2.0 | 5 votes |
private static EndpointReferenceType getAnonymousEndpointReference() { final EndpointReferenceType reference = new EndpointReferenceType(); final AttributedURIType a = new AttributedURIType(); a.setValue(EndpointReferenceUtils.ANONYMOUS_ADDRESS); reference.setAddress(a); return reference; }
Example 11
Source File: SimpleEventingIntegrationTest.java From cxf with Apache License 2.0 | 5 votes |
protected JAXBElement<EndpointReferenceType> createDummyNotifyTo() { EndpointReferenceType eventSinkERT = new EndpointReferenceType(); AttributedURIType eventSinkAddr = new AttributedURIType(); eventSinkAddr.setValue("local://dummy-sink"); eventSinkERT.setAddress(eventSinkAddr); return new ObjectFactory().createNotifyTo(eventSinkERT); }
Example 12
Source File: NotificationTest.java From cxf with Apache License 2.0 | 4 votes |
/** * We request only to receive notifications about fires in Russia * and there will be only a fire in Canada. We should not receive * this notification. */ @Test public void withFilterNegative() throws IOException { NotificatorService service = createNotificatorService(); Subscribe subscribe = new Subscribe(); ExpirationType exp = new ExpirationType(); exp.setValue( DurationAndDateUtil.convertToXMLString(DurationAndDateUtil.parseDurationOrTimestamp("PT0S"))); subscribe.setExpires(exp); EndpointReferenceType eventSinkERT = new EndpointReferenceType(); AttributedURIType eventSinkAddr = new AttributedURIType(); String url = TestUtil.generateRandomURLWithHttpTransport(NOTIFICATION_TEST_PORT); eventSinkAddr.setValue(url); eventSinkERT.setAddress(eventSinkAddr); subscribe.setDelivery(new DeliveryType()); subscribe.getDelivery().getContent().add(new ObjectFactory().createNotifyTo(eventSinkERT)); subscribe.setFilter(new FilterType()); subscribe.getFilter().getContent().add("/*[local-name()='fire']/location[text()='Russia']"); eventSourceClient.subscribeOp(subscribe); Server eventSinkServer = createEventSink(url); TestingEventSinkImpl.RECEIVED_FIRES.set(0); service.start(); Emitter emitter = new EmitterImpl(service); emitter.dispatch(new FireEvent("Canada", 8)); try { Thread.sleep(2000); } catch (InterruptedException ex) { ex.printStackTrace(); } eventSinkServer.stop(); if (TestingEventSinkImpl.RECEIVED_FIRES.get() != 0) { Assert.fail("TestingEventSinkImpl should have received 0 events but received " + TestingEventSinkImpl.RECEIVED_FIRES.get()); } }
Example 13
Source File: Proxy.java From cxf with Apache License 2.0 | 4 votes |
Object invoke(OperationInfo oi, ProtocolVariation protocol, Object[] params, Map<String, Object> context, Exchange exchange, Level exceptionLevel) throws RMException { if (LOG.isLoggable(Level.INFO)) { LOG.log(Level.INFO, "Sending out-of-band RM protocol message {0}.", oi == null ? null : oi.getName()); } RMManager manager = reliableEndpoint.getManager(); Bus bus = manager.getBus(); Endpoint endpoint = reliableEndpoint.getEndpoint(protocol); BindingInfo bi = reliableEndpoint.getBindingInfo(protocol); Conduit c = reliableEndpoint.getConduit(); Client client = null; if (params.length > 0 && params[0] instanceof DestinationSequence) { EndpointReferenceType acksTo = ((DestinationSequence)params[0]).getAcksTo(); String acksAddress = acksTo.getAddress().getValue(); AttributedURIType attrURIType = new AttributedURIType(); attrURIType.setValue(acksAddress); EndpointReferenceType acks = new EndpointReferenceType(); acks.setAddress(attrURIType); client = createClient(bus, endpoint, protocol, c, acks); params = new Object[] {}; } else { EndpointReferenceType replyTo = reliableEndpoint.getReplyTo(); client = createClient(bus, endpoint, protocol, c, replyTo); } BindingOperationInfo boi = bi.getOperation(oi); try { if (context != null) { client.getRequestContext().putAll(context); } Object[] result = client.invoke(boi, params, context, exchange); if (result != null && result.length > 0) { return result[0]; } } catch (Exception ex) { org.apache.cxf.common.i18n.Message msg = new org.apache.cxf.common.i18n.Message("SEND_PROTOCOL_MSG_FAILED_EXC", LOG, oi == null ? null : oi.getName()); LOG.log(exceptionLevel, msg.toString(), ex); throw new RMException(msg, ex); } return null; }
Example 14
Source File: WSAEndpointReferenceUtils.java From cxf with Apache License 2.0 | 4 votes |
/** * Set the address of the provided endpoint reference. * @param ref - the endpoint reference * @param address - the address */ public static void setAddress(EndpointReferenceType ref, String address) { AttributedURIType a = WSA_OBJECT_FACTORY.createAttributedURIType(); a.setValue(address); ref.setAddress(a); }
Example 15
Source File: NotificationTest.java From cxf with Apache License 2.0 | 4 votes |
@Test public void withReferenceParameters() throws Exception { NotificatorService service = createNotificatorService(); Subscribe subscribe = new Subscribe(); ExpirationType exp = new ExpirationType(); exp.setValue( DurationAndDateUtil.convertToXMLString(DurationAndDateUtil.parseDurationOrTimestamp("PT0S"))); subscribe.setExpires(exp); EndpointReferenceType eventSinkERT = new EndpointReferenceType(); JAXBElement<String> idqn = new JAXBElement<>(new QName("http://www.example.org", "MyReferenceParameter"), String.class, "380"); JAXBElement<String> idqn2 = new JAXBElement<>(new QName("http://www.example.org", "MyReferenceParameter2"), String.class, "381"); eventSinkERT.setReferenceParameters(new ReferenceParametersType()); eventSinkERT.getReferenceParameters().getAny().add(idqn); eventSinkERT.getReferenceParameters().getAny().add(idqn2); AttributedURIType eventSinkAddr = new AttributedURIType(); String url = TestUtil.generateRandomURLWithHttpTransport(NOTIFICATION_TEST_PORT); eventSinkAddr.setValue(url); eventSinkERT.setAddress(eventSinkAddr); subscribe.setDelivery(new DeliveryType()); subscribe.getDelivery().getContent().add(new ObjectFactory().createNotifyTo(eventSinkERT)); eventSourceClient.subscribeOp(subscribe); Server eventSinkServer = createEventSinkWithReferenceParametersAssertion(url, eventSinkERT.getReferenceParameters()); TestingEventSinkImpl.RECEIVED_FIRES.set(0); service.start(); Emitter emitter = new EmitterImpl(service); emitter.dispatch(new FireEvent("Canada", 8)); for (int i = 0; i < 10; i++) { if (TestingEventSinkImpl.RECEIVED_FIRES.get() == 1) { break; } try { Thread.sleep(1000); } catch (InterruptedException ex) { ex.printStackTrace(); } } eventSinkServer.stop(); int received = TestingEventSinkImpl.RECEIVED_FIRES.get(); if (received != 1) { Assert.fail("TestingEventSinkImpl should have received 1 events but received " + received); } }
Example 16
Source File: NotificationTest.java From cxf with Apache License 2.0 | 4 votes |
@Test public void basicReceptionOfWrappedEvents() throws IOException { NotificatorService service = createNotificatorService(); Subscribe subscribe = new Subscribe(); ExpirationType exp = new ExpirationType(); exp.setValue( DurationAndDateUtil.convertToXMLString(DurationAndDateUtil.parseDurationOrTimestamp("PT0S"))); subscribe.setExpires(exp); EndpointReferenceType eventSinkERT = new EndpointReferenceType(); AttributedURIType eventSinkAddr = new AttributedURIType(); String url = TestUtil.generateRandomURLWithHttpTransport(NOTIFICATION_TEST_PORT); eventSinkAddr.setValue(url); eventSinkERT.setAddress(eventSinkAddr); subscribe.setDelivery(new DeliveryType()); subscribe.getDelivery().getContent().add(new ObjectFactory().createNotifyTo(eventSinkERT)); FormatType formatType = new FormatType(); formatType.setName(EventingConstants.DELIVERY_FORMAT_WRAPPED); subscribe.setFormat(formatType); eventSourceClient.subscribeOp(subscribe); eventSourceClient.subscribeOp(subscribe); eventSourceClient.subscribeOp(subscribe); Server eventSinkServer = createWrappedEventSink(url); TestingWrappedEventSinkImpl.RECEIVED_FIRES.set(0); service.start(); Emitter emitter = new EmitterImpl(service); emitter.dispatch(new FireEvent("Canada", 8)); for (int i = 0; i < 10; i++) { if (TestingWrappedEventSinkImpl.RECEIVED_FIRES.get() == 3) { break; } try { Thread.sleep(1000); } catch (InterruptedException ex) { ex.printStackTrace(); } } eventSinkServer.stop(); if (TestingWrappedEventSinkImpl.RECEIVED_FIRES.get() != 3) { Assert.fail("TestingWrappedEventSinkImpl should have received 3 events but received " + TestingWrappedEventSinkImpl.RECEIVED_FIRES.get()); } }
Example 17
Source File: NotificationTest.java From cxf with Apache License 2.0 | 4 votes |
@Test public void basicReceptionOfEvents() throws IOException { NotificatorService service = createNotificatorService(); Subscribe subscribe = new Subscribe(); ExpirationType exp = new ExpirationType(); exp.setValue( DurationAndDateUtil.convertToXMLString(DurationAndDateUtil.parseDurationOrTimestamp("PT0S"))); subscribe.setExpires(exp); EndpointReferenceType eventSinkERT = new EndpointReferenceType(); AttributedURIType eventSinkAddr = new AttributedURIType(); String url = TestUtil.generateRandomURLWithHttpTransport(NOTIFICATION_TEST_PORT); eventSinkAddr.setValue(url); eventSinkERT.setAddress(eventSinkAddr); subscribe.setDelivery(new DeliveryType()); subscribe.getDelivery().getContent() .add(new ObjectFactory().createNotifyTo(eventSinkERT)); eventSourceClient.subscribeOp(subscribe); eventSourceClient.subscribeOp(subscribe); eventSourceClient.subscribeOp(subscribe); Server eventSinkServer = createEventSink(url); TestingEventSinkImpl.RECEIVED_FIRES.set(0); service.start(); Emitter emitter = new EmitterImpl(service); emitter.dispatch(new FireEvent("Canada", 8)); for (int i = 0; i < 10; i++) { if (TestingEventSinkImpl.RECEIVED_FIRES.get() == 3) { break; } try { Thread.sleep(1000); } catch (InterruptedException ex) { ex.printStackTrace(); } } eventSinkServer.stop(); if (TestingEventSinkImpl.RECEIVED_FIRES.get() != 3) { Assert.fail("TestingEventSinkImpl should have received 3 events but received " + TestingEventSinkImpl.RECEIVED_FIRES.get()); } }
Example 18
Source File: MAPAggregatorTest.java From cxf with Apache License 2.0 | 4 votes |
private void setUpResponder(Message message, Exchange exchange, SetupResponderArgs args, Endpoint endpoint) throws Exception { setUpMessageProperty(message, REQUESTOR_ROLE, Boolean.FALSE); AddressingProperties maps = new AddressingProperties(); EndpointReferenceType replyTo = new EndpointReferenceType(); replyTo.setAddress( ContextUtils.getAttributedURI(args.decoupled ? "http://localhost:9999/decoupled" : Names.WSA_ANONYMOUS_ADDRESS)); maps.setReplyTo(replyTo); EndpointReferenceType faultTo = new EndpointReferenceType(); faultTo.setAddress( ContextUtils.getAttributedURI(args.decoupled ? "http://localhost:9999/fault" : Names.WSA_ANONYMOUS_ADDRESS)); maps.setFaultTo(faultTo); if (!args.noMessageId) { AttributedURIType id = ContextUtils.getAttributedURI("urn:uuid:12345"); maps.setMessageID(id); } if (args.zeroLengthAction) { maps.setAction(ContextUtils.getAttributedURI("")); } setUpMessageProperty(message, ADDRESSING_PROPERTIES_INBOUND, maps); if (!args.outbound) { setUpOneway(message, exchange, args.oneway); if (args.oneway || args.decoupled) { setUpRebase(message, exchange, endpoint); } } if (args.outbound || ((DefaultMessageIdCache) aggregator.getMessageIdCache()) .getMessageIdSet().size() > 0) { if (!args.zeroLengthAction) { Method method = SEI.class.getMethod("op", new Class[0]); setUpMethod(message, exchange, method); setUpMessageProperty(message, REQUESTOR_ROLE, Boolean.FALSE); if (args.fault) { message.setContent(Exception.class, new SoapFault("blah", new Exception(), Fault.FAULT_CODE_SERVER)); expectedAction = "http://foo/bar/SEI/op/Fault/Exception"; } else { expectedAction = "http://foo/bar/SEI/opResponse"; } } setUpMessageProperty(message, REQUESTOR_ROLE, Boolean.FALSE); setUpMessageProperty(message, ADDRESSING_PROPERTIES_INBOUND, maps); if (args.fault) { // REVISIT test double rebase does not occur setUpRebase(message, exchange, endpoint); } expectedTo = args.decoupled ? args.fault ? "http://localhost:9999/fault" : "http://localhost:9999/decoupled" : Names.WSA_ANONYMOUS_ADDRESS; if (maps.getMessageID() != null && maps.getMessageID().getValue() != null) { expectedRelatesTo = maps.getMessageID().getValue(); } else { expectedRelatesTo = Names.WSA_UNSPECIFIED_RELATIONSHIP; } // Now verified via verifyMessage() //EasyMock.eq(SERVER_ADDRESSING_PROPERTIES_OUTBOUND); //EasyMock.reportMatcher(new MAPMatcher()); //message.put(SERVER_ADDRESSING_PROPERTIES_OUTBOUND, // new AddressingPropertiesImpl()); //EasyMock.expectLastCall().andReturn(null); } }
Example 19
Source File: NotificationTest.java From cxf with Apache License 2.0 | 4 votes |
/** * We request only to receive notifications about earthquakes in Russia with Richter scale equal to 3.5 * and there will be one fire in Canada and one earthquake in Russia. We should * receive only one notification. */ @Test public void withFilter2() throws IOException { NotificatorService service = createNotificatorService(); Subscribe subscribe = new Subscribe(); ExpirationType exp = new ExpirationType(); exp.setValue( DurationAndDateUtil.convertToXMLString(DurationAndDateUtil.parseDurationOrTimestamp("PT0S"))); subscribe.setExpires(exp); EndpointReferenceType eventSinkERT = new EndpointReferenceType(); AttributedURIType eventSinkAddr = new AttributedURIType(); String url = TestUtil.generateRandomURLWithHttpTransport(NOTIFICATION_TEST_PORT); eventSinkAddr.setValue(url); eventSinkERT.setAddress(eventSinkAddr); subscribe.setDelivery(new DeliveryType()); subscribe.getDelivery().getContent().add(new ObjectFactory().createNotifyTo(eventSinkERT)); subscribe.setFilter(new FilterType()); subscribe.getFilter().getContent() .add("//*[local-name()='earthquake']/location[text()='Russia']/" + "../richterScale[contains(text(),'3.5')]"); eventSourceClient.subscribeOp(subscribe); Server eventSinkServer = createEventSink(url); TestingEventSinkImpl.RECEIVED_FIRES.set(0); TestingEventSinkImpl.RECEIVED_EARTHQUAKES.set(0); service.start(); Emitter emitter = new EmitterImpl(service); emitter.dispatch(new FireEvent("Canada", 8)); emitter.dispatch(new EarthquakeEvent(3.5f, "Russia")); for (int i = 0; i < 10; i++) { if (TestingEventSinkImpl.RECEIVED_EARTHQUAKES.get() == 1) { break; } try { Thread.sleep(1000); } catch (InterruptedException ex) { ex.printStackTrace(); } } eventSinkServer.stop(); if (TestingEventSinkImpl.RECEIVED_EARTHQUAKES.get() != 1) { Assert.fail("TestingEventSinkImpl should have received 1 earthquake event but received " + TestingEventSinkImpl.RECEIVED_EARTHQUAKES.get()); } if (TestingEventSinkImpl.RECEIVED_FIRES.get() != 0) { Assert.fail("TestingEventSinkImpl should have not received a fire event" + TestingEventSinkImpl.RECEIVED_FIRES.get()); } }
Example 20
Source File: WSAFaultToClientServerTest.java From cxf with Apache License 2.0 | 4 votes |
@Test public void testTwoWayFaultTo() throws Exception { ByteArrayOutputStream input = setupInLogging(); AddNumbersPortType port = getTwoWayPort(); //setup a real decoupled endpoint that will process the fault correctly HTTPConduit c = (HTTPConduit)ClientProxy.getClient(port).getConduit(); c.getClient().setDecoupledEndpoint("http://localhost:" + FaultToEndpointServer.FAULT_PORT2 + "/sendFaultHere"); EndpointReferenceType faultTo = new EndpointReferenceType(); AddressingProperties addrProperties = new AddressingProperties(); AttributedURIType epr = new AttributedURIType(); epr.setValue("http://localhost:" + FaultToEndpointServer.FAULT_PORT2 + "/sendFaultHere"); faultTo.setAddress(epr); addrProperties.setFaultTo(faultTo); BindingProvider provider = (BindingProvider) port; Map<String, Object> requestContext = provider.getRequestContext(); requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + FaultToEndpointServer.PORT + "/jaxws/add"); requestContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, addrProperties); try { port.addNumbers(-1, -2); fail("Exception is expected"); } catch (Exception e) { //do nothing } String in = new String(input.toByteArray()); //System.out.println(in); assertTrue("The response from faultTo endpoint is expected and actual response is " + in, in.indexOf("Address: http://localhost:" + FaultToEndpointServer.FAULT_PORT2 + "/sendFaultHere") > -1); assertTrue("WS addressing header is expected", in.indexOf("http://www.w3.org/2005/08/addressing") > -1); assertTrue("Fault deatil is expected", in.indexOf("Negative numbers cant be added") > -1); ((Closeable)port).close(); }