Refine search
@WebEndpoint(name = "WSHttpBinding_IYourService") public IYourService getWSHttpBindingIYourService() { WebServiceFeature wsAddressing = new AddressingFeature(true); IYourService service = super.getPort(new QName("http://xmlns.example.com/services/Your", "WSHttpBinding_IYourService"), IYourService.class, wsAddressing); return service; }
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); } }
while(policyAssertion.hasNext()){ final PolicyAssertion assertion = policyAssertion.next(); if(assertion.getName().equals(addressingAssertionQName)){ final WebServiceFeature feature = AddressingVersion.getFeature(addressingAssertionQName.getNamespaceURI(), true, !assertion.isOptional()); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("Added addressing feature \"" + feature + "\" for element \"" + key + "\""); for (AssertionSet assertions : policy) { for (PolicyAssertion assertion : assertions) { if (assertion.getName().equals(W3CAddressingMetadataConstants.WSAM_ADDRESSING_ASSERTION)) { NestedPolicy nestedPolicy = assertion.getNestedPolicy(); boolean requiresAnonymousResponses = false; try { if (requiresAnonymousResponses) { feature = new AddressingFeature(true, !assertion.isOptional(), AddressingFeature.Responses.ANONYMOUS); } else if (requiresNonAnonymousResponses) { feature = new AddressingFeature(true, !assertion.isOptional(), AddressingFeature.Responses.NON_ANONYMOUS); } else { feature = new AddressingFeature(true, !assertion.isOptional());
@Test public void testDiaptchWithWsaDisable() throws Exception { QName port = new QName("http://apache.org/cxf/systest/ws/addr_feature/", "AddNumbersPort"); Dispatch<SOAPMessage> disptch = getService().createDispatch(port, SOAPMessage.class, javax.xml.ws.Service.Mode.MESSAGE, new AddressingFeature(false)); ((BindingProvider)disptch).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + PORT + "/jaxws/add"); InputStream is = getClass().getResourceAsStream("resources/AddNumbersDispatchReq.xml"); SOAPMessage soapReqMsg = MessageFactory.newInstance().createMessage(null, is); assertNotNull(soapReqMsg); try { disptch.invoke(soapReqMsg); fail("The MAPcodec ate the SOAPFaultException"); } catch (javax.xml.ws.soap.SOAPFaultException e) { //expected } }
final AssertionData addressingData = AssertionData.createAssertionData(W3CAddressingMetadataConstants.WSAM_ADDRESSING_ASSERTION); if (!af.isRequired()) { addressingData.setOptionalAttribute(true); AddressingFeature.Responses responses = af.getResponses(); if (responses == AddressingFeature.Responses.ANONYMOUS) { AssertionData nestedAsserData = AssertionData.createAssertionData(W3CAddressingMetadataConstants.WSAM_ANONYMOUS_NESTED_ASSERTION); return Policy.createPolicy(null, bindingName.getLocalPart() + "_WSAM_Addressing_Policy", assertionSets);
if (feature instanceof AddressingFeature) { AddressingFeature addrFeature = (AddressingFeature)feature; addressingEnabled = addrFeature.isEnabled(); addressingRequired = addrFeature.isRequired(); LOGGER.info("Addressing [enabled = " + addrFeature.isEnabled() + ", required = " + addrFeature.isRequired() + "]"); } else if (feature instanceof MTOMFeature) { MTOMFeature mtom = (MTOMFeature)feature; + ":" + config.getPort().getServiceQName().getLocalPart() + ":" + config.getPort().getPortQName().getLocalPart(), config.getPort().getPortQName(), SEI, null, config.getPort().getServiceQName().getLocalPart(), null, "/" + config.getPort().getServiceName(), addressingEnabled, addressingRequired, "ALL", mtomEnabled, mtomThreshold,
private boolean addressibleElement(XMLStreamReader reader, WSDLFeaturedObject binding) { QName ua = reader.getName(); if (ua.equals(AddressingVersion.W3C.wsdlExtensionTag)) { String required = reader.getAttributeValue(WSDLConstants.NS_WSDL, "required"); binding.addFeature(new AddressingFeature(true, Boolean.parseBoolean(required))); XMLStreamReaderUtil.skipElement(reader); return true; // UsingAddressing is consumed } return false; }
public static TerminationParticipantPortType getTerminationParticipantPort(MAP map) { TerminationParticipantService service = getTerminationParticipantService(); TerminationParticipantPortType port = service.getPort(TerminationParticipantPortType.class, new AddressingFeature(true, true)); BindingProvider bindingProvider = (BindingProvider)port; Map<String, Object> requestContext = bindingProvider.getRequestContext(); AddressingHelper.configureRequestContext(requestContext, map); return port; }
@Test public void testJaxWsPortAccessWithFeature() throws Exception { doTestJaxWsPortAccess(new AddressingFeature()); }
/** * Returns true if <code>binding</code> contains either a {@link AddressingFeature} or * {@link MemberSubmissionAddressingFeature} and is required. * * @param binding The binding * @return true if <code>binding</code> requires WS-Addressing */ public static boolean isRequired(WSBinding binding) { AddressingFeature af = binding.getFeature(AddressingFeature.class); if (af != null) return af.isRequired(); MemberSubmissionAddressingFeature msaf = binding.getFeature(MemberSubmissionAddressingFeature.class); if(msaf != null) return msaf.isRequired(); return false; }
/** * Puts an addressing policy into the PolicyMap if the addressing feature was set. */ public Collection<PolicySubject> update(final PolicyMap policyMap, final SEIModel model, final WSBinding wsBinding) throws PolicyException { LOGGER.entering(policyMap, model, wsBinding); Collection<PolicySubject> subjects = new ArrayList<PolicySubject>(); if (policyMap != null) { final AddressingFeature addressingFeature = wsBinding.getFeature(AddressingFeature.class); if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.finest("addressingFeature = " + addressingFeature); } if ((addressingFeature != null) && addressingFeature.isEnabled()) { //add wsam:Addrressing assertion if not exists. addWsamAddressing(subjects, policyMap, model, addressingFeature); } } // endif policy map not null LOGGER.exiting(subjects); return subjects; }
if ((feature instanceof AddressingFeature) && ((AddressingFeature)feature).isEnabled()) { addressingEnabled = true; SOAPLogger.ROOT_LOGGER.addressingEnabledRequired(String.valueOf(((AddressingFeature)feature).isEnabled()), String.valueOf(((AddressingFeature)feature).isRequired())); } else if (feature instanceof MTOMFeature) { props.put("mtom-enabled", ((MTOMFeature)feature).isEnabled());
private WSDLBoundOperation.ANONYMOUS getResponseRequirement(@Nullable WSDLBoundOperation wbo) { try { if (af.getResponses() == AddressingFeature.Responses.ANONYMOUS) { return WSDLBoundOperation.ANONYMOUS.required; } else if (af.getResponses() == AddressingFeature.Responses.NON_ANONYMOUS) { return WSDLBoundOperation.ANONYMOUS.prohibited; } } catch (NoSuchMethodError e) { //Ignore error, defaut to optional } //wsaw wsdl binding case will have some value set on wbo return wbo != null ? wbo.getAnonymous() : WSDLBoundOperation.ANONYMOUS.optional; }
while(policyAssertion.hasNext()){ final PolicyAssertion assertion = policyAssertion.next(); if(assertion.getName().equals(addressingAssertionQName)){ final WebServiceFeature feature = AddressingVersion.getFeature(addressingAssertionQName.getNamespaceURI(), true, !assertion.isOptional()); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("Added addressing feature \"" + feature + "\" for element \"" + key + "\""); for (AssertionSet assertions : policy) { for (PolicyAssertion assertion : assertions) { if (assertion.getName().equals(W3CAddressingMetadataConstants.WSAM_ADDRESSING_ASSERTION)) { NestedPolicy nestedPolicy = assertion.getNestedPolicy(); boolean requiresAnonymousResponses = false; try { if (requiresAnonymousResponses) { feature = new AddressingFeature(true, !assertion.isOptional(), AddressingFeature.Responses.ANONYMOUS); } else if (requiresNonAnonymousResponses) { feature = new AddressingFeature(true, !assertion.isOptional(), AddressingFeature.Responses.NON_ANONYMOUS); } else { feature = new AddressingFeature(true, !assertion.isOptional());
@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())); }
final AssertionData addressingData = AssertionData.createAssertionData(W3CAddressingMetadataConstants.WSAM_ADDRESSING_ASSERTION); if (!af.isRequired()) { addressingData.setOptionalAttribute(true); AddressingFeature.Responses responses = af.getResponses(); if (responses == AddressingFeature.Responses.ANONYMOUS) { AssertionData nestedAsserData = AssertionData.createAssertionData(W3CAddressingMetadataConstants.WSAM_ANONYMOUS_NESTED_ASSERTION); return Policy.createPolicy(null, bindingName.getLocalPart() + "_WSAM_Addressing_Policy", assertionSets);
if (feature instanceof AddressingFeature) { AddressingFeature addrFeature = (AddressingFeature)feature; addressingEnabled = addrFeature.isEnabled(); addressingRequired = addrFeature.isRequired(); LOGGER.info("Addressing [enabled = " + addrFeature.isEnabled() + ", required = " + addrFeature.isRequired() + "]"); } else if (feature instanceof MTOMFeature) { MTOMFeature mtom = (MTOMFeature)feature; + ":" + config.getPort().getServiceQName().getLocalPart() + ":" + config.getPort().getPortQName().getLocalPart(), config.getPort().getPortQName(), SEI, null, config.getPort().getServiceQName().getLocalPart(), null, "/" + config.getPort().getServiceName(), addressingEnabled, addressingRequired, "ALL", mtomEnabled, mtomThreshold,
private boolean addressibleElement(XMLStreamReader reader, WSDLFeaturedObject binding) { QName ua = reader.getName(); if (ua.equals(AddressingVersion.W3C.wsdlExtensionTag)) { String required = reader.getAttributeValue(WSDLConstants.NS_WSDL, "required"); binding.addFeature(new AddressingFeature(true, Boolean.parseBoolean(required))); XMLStreamReaderUtil.skipElement(reader); return true; // UsingAddressing is consumed } return false; }
public static TerminationParticipantPortType getTerminationParticipantPort(MAP map) { TerminationParticipantService service = getTerminationParticipantService(); TerminationParticipantPortType port = service.getPort(TerminationParticipantPortType.class, new AddressingFeature(true, true)); BindingProvider bindingProvider = (BindingProvider)port; Map<String, Object> requestContext = bindingProvider.getRequestContext(); AddressingHelper.configureRequestContext(requestContext, map); return port; }
features.add(new AddressingFeature(addressing.enabled(), addressing.required(), addressing.responses()));