public List<Object> getReferenceParameters() { List<Object> list = new LinkedList<Object>(); ReferenceParametersType refParams = implementation.getReferenceParameters(); if (refParams != null) { List<Object> any = refParams.getAny(); if (any != null) { list.addAll(any); } } return list; }
public void addReferenceParameter(Element element) { ReferenceParametersType refParams = implementation.getReferenceParameters(); if (refParams == null) { refParams = new ReferenceParametersType(); implementation.setReferenceParameters(refParams); } refParams.getAny().add(element); }
/** * Create an instance of {@link ReferenceParametersType } * */ public ReferenceParametersType createReferenceParametersType() { return new ReferenceParametersType(); }
/** * Create an instance of {@link ReferenceParametersType } * */ public ReferenceParametersType createReferenceParametersType() { return new ReferenceParametersType(); }
private String getUUID(ReferenceParametersType ref) { for (Object object : ref.getAny()) { if (object instanceof JAXBElement) { JAXBElement<?> element = (JAXBElement<?>) object; QName qName = element.getName(); if ( REF_NAMESPACE.equals(qName.getNamespaceURI()) && REF_LOCAL_NAME.equals(qName.getLocalPart())) { return (String) element.getValue(); } } else if (object instanceof Element) { Element element = (Element) object; if ( REF_NAMESPACE.equals(element.getNamespaceURI()) && REF_LOCAL_NAME.equals(element.getLocalName())) { return element.getTextContent(); } } } throw new UnknownResource(); }
@Override public ReferenceParametersType create(Representation initRepresentation) { // Store xmlResource String uuid = UUID.randomUUID().toString(); Element representationEl = (Element) initRepresentation.getAny(); if (representationEl == null) { storage.put(uuid, ""); } else { storage.put(uuid, StaxUtils.toString(representationEl)); } Element uuidEl = DOMUtils.getEmptyDocument().createElementNS(REF_NAMESPACE, REF_LOCAL_NAME); uuidEl.setTextContent(uuid); // Create referenceParameter ReferenceParametersType refParam = new ReferenceParametersType(); refParam.getAny().add(uuidEl); return refParam; }
/** * Create an instance of {@link ReferenceParametersType } * */ public ReferenceParametersType createReferenceParametersType() { return new ReferenceParametersType(); }
private String getUUID(ReferenceParametersType ref) { for (Object object : ref.getAny()) { if (object instanceof JAXBElement) { JAXBElement<?> element = (JAXBElement<?>) object; QName qName = element.getName(); if ( REF_NAMESPACE.equals(qName.getNamespaceURI()) && REF_LOCAL_NAME.equals(qName.getLocalPart())) { return (String) element.getValue(); } } else if (object instanceof Element) { Element element = (Element) object; if ( REF_NAMESPACE.equals(element.getNamespaceURI()) && REF_LOCAL_NAME.equals(element.getLocalName())) { return element.getTextContent(); } } } throw new UnknownResource(); }
@Override public ReferenceParametersType create(Representation initRepresentation) { // Store xmlResource String uuid = UUID.randomUUID().toString(); Element representationEl = (Element) initRepresentation.getAny(); if (representationEl == null) { storage.put(uuid, ""); } else { storage.put(uuid, StaxUtils.toString(representationEl)); } Element uuidEl = DOMUtils.getEmptyDocument().createElementNS(REF_NAMESPACE, REF_LOCAL_NAME); uuidEl.setTextContent(uuid); // Create referenceParameter ReferenceParametersType refParam = new ReferenceParametersType(); refParam.getAny().add(uuidEl); return refParam; }
/** * Create an instance of {@link ReferenceParametersType } * */ public ReferenceParametersType createReferenceParametersType() { return new ReferenceParametersType(); }
public List<Object> getReferenceParameters() { List<Object> list = new LinkedList<Object>(); ReferenceParametersType refParams = implementation.getToEndpointReference().getReferenceParameters(); if (refParams != null) { List<Object> any = refParams.getAny(); if (any != null) { list.addAll(any); } } return list; }
public void addReferenceParameter(Element refParam) { EndpointReferenceType eprt = implementation.getToEndpointReference(); ReferenceParametersType refParams = eprt.getReferenceParameters(); if (refParams == null) { refParams = new ReferenceParametersType(); eprt.setReferenceParameters(refParams); } eprt.getReferenceParameters().getAny().add(refParam); //implementation.getToEndpointReference().getReferenceParameters().getAny().add(refParam); }
private String extractStringElementFromAny(QName elementQName, EndpointReferenceType epr) { String elementStringValue = null; if (null != epr.getReferenceParameters()) { for (Object o : epr.getReferenceParameters().getAny()) { if (o instanceof JAXBElement) { JAXBElement<?> el = (JAXBElement<?>)o; if (el.getName().equals(elementQName)) { elementStringValue = (String)el.getValue(); } } } } return elementStringValue; } }
protected void grantSubscriptionManagerReference(SubscriptionTicket ticket, SubscriptionTicketGrantingResponse response) { EndpointReferenceType subscriptionManagerReference = new EndpointReferenceType(); subscriptionManagerReference.setAddress(getSubscriptionManagerAddress()); // generate a ID for this subscription UUID uuid = UUID.randomUUID(); JAXBElement<String> idqn = new JAXBElement<>(new QName(subscriptionIdNamespace, subscriptionIdElementName), String.class, uuid.toString()); subscriptionManagerReference.setReferenceParameters(new ReferenceParametersType()); subscriptionManagerReference.getReferenceParameters().getAny().add(idqn); ticket.setUuid(uuid); response.setSubscriptionManagerReference(subscriptionManagerReference); response.setUUID(uuid); }
private String extractStringElementFromAny(QName elementQName, EndpointReferenceType epr) { String elementStringValue = null; if (null != epr.getReferenceParameters()) { for (Object o : epr.getReferenceParameters().getAny()) { if (o instanceof JAXBElement) { JAXBElement<?> el = (JAXBElement<?>)o; if (el.getName().equals(elementQName)) { elementStringValue = (String)el.getValue(); } } } } return elementStringValue; } }
protected void grantSubscriptionManagerReference(SubscriptionTicket ticket, SubscriptionTicketGrantingResponse response) { EndpointReferenceType subscriptionManagerReference = new EndpointReferenceType(); subscriptionManagerReference.setAddress(getSubscriptionManagerAddress()); // generate a ID for this subscription UUID uuid = UUID.randomUUID(); JAXBElement<String> idqn = new JAXBElement<>(new QName(subscriptionIdNamespace, subscriptionIdElementName), String.class, uuid.toString()); subscriptionManagerReference.setReferenceParameters(new ReferenceParametersType()); subscriptionManagerReference.getReferenceParameters().getAny().add(idqn); ticket.setUuid(uuid); response.setSubscriptionManagerReference(subscriptionManagerReference); response.setUUID(uuid); }
private String extractStringElementFromAny(QName elementQName, EndpointReferenceType epr) { String elementStringValue = null; if (null != epr.getReferenceParameters()) { for (Object o : epr.getReferenceParameters().getAny()) { if (o instanceof JAXBElement) { JAXBElement<?> el = (JAXBElement<?>)o; if (el.getName().equals(elementQName)) { elementStringValue = (String)el.getValue(); } } } } return elementStringValue; } }
factory.setServiceClass(...); factory.setAddress(...); factory.getFeatures().add(new WSAddressingFeature()); SomePortType client = (SomePortType) factory.create(); AddressingProperties maps = new AddressingPropertiesImpl(); EndpointReferenceType epr = new EndpointReferenceType(); //Then you can add referenceParameters to the epr ReferenceParametersType ref = new ReferenceParametersType(); List<Object> paras = ref.getAny(); Country ctry = new Country("xx"); JAXBContext ctx = JAXBContext.newInstance(new Class[] {Country.class }); Marshaller marshaller = ctx.createMarshaller(); DOMResult res = new DOMResult(); marshaller.marshal(ctry, res); Element elt = ((Document) res.getNode()).getDocumentElement(); any.add(elt); epr.setReferenceParameters(ref); maps.setTo(epr); ((BindingProvider)client).getRequestContext() .put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, maps);
private String extractStringElementFromAny(QName elementQName, EndpointReferenceType epr) { String elementStringValue = null; if (null != epr.getReferenceParameters()) { for (Object o : epr.getReferenceParameters().getAny()) { if (o instanceof JAXBElement) { JAXBElement<?> el = (JAXBElement<?>)o; if (el.getName().equals(elementQName)) { elementStringValue = (String)el.getValue(); } } } } return elementStringValue; } }
/** * Builds an new endpoint reference using the current target reference as a template. * The supplied id is endcoded using a reference parameter. * This requires the ws-a interceptors to propagate the reference parameters * on subsequent invokes using the returned reference. * @param id the id to encode in the new reference * @return the new reference with the id encoded as a reference parameter * @see org.apache.cxf.transport.MultiplexDestination#getAddressWithId(java.lang.String) */ public EndpointReferenceType getAddressWithId(String id) { EndpointReferenceType epr = EndpointReferenceUtils.duplicate( EndpointReferenceUtils.mint(reference, bus)); ReferenceParametersType newParams = new org.apache.cxf.ws.addressing.ObjectFactory() .createReferenceParametersType(); ReferenceParametersType existingParams = epr.getReferenceParameters(); if (null != existingParams) { newParams.getAny().addAll(existingParams.getAny()); } newParams.getAny().add(new JAXBElement<String>(MULTIPLEX_ID_QNAME, String.class, id)); epr.setReferenceParameters(newParams); return epr; }