private void extractWsdlEprs(EndpointInfo endpoint) { //parse the EPR in wsdl List<ExtensibilityElement> portExtensors = endpoint.getExtensors(ExtensibilityElement.class); if (portExtensors != null) { Iterator<ExtensibilityElement> extensionElements = portExtensors.iterator(); QName wsaEpr = new QName(Names.WSA_NAMESPACE_NAME, "EndpointReference"); while (extensionElements.hasNext()) { ExtensibilityElement ext = extensionElements.next(); if (ext instanceof UnknownExtensibilityElement && wsaEpr.equals(ext.getElementType())) { DOMSource domSource = new DOMSource(((UnknownExtensibilityElement)ext).getElement()); W3CEndpointReference w3cEPR = new W3CEndpointReference(domSource); EndpointReferenceType ref = ProviderImpl.convertToInternal(w3cEPR); endpoint.getTarget().setMetadata(ref.getMetadata()); endpoint.getTarget().setReferenceParameters(ref.getReferenceParameters()); endpoint.getTarget().getOtherAttributes().putAll(ref.getOtherAttributes()); } } } }
public void addReferenceParameter(Element element) { ReferenceParametersType refParams = implementation.getReferenceParameters(); if (refParams == null) { refParams = new ReferenceParametersType(); implementation.setReferenceParameters(refParams); } refParams.getAny().add(element); }
public static void applyReferenceParam(EndpointReferenceType toEpr, Object el) { if (null == toEpr.getReferenceParameters()) { toEpr.setReferenceParameters(WSA_OBJECT_FACTORY.createReferenceParametersType()); } toEpr.getReferenceParameters().getAny().add(el); }
public static void applyReferenceParam(EndpointReferenceType toEpr, Object el) { if (null == toEpr.getReferenceParameters()) { toEpr.setReferenceParameters(WSA_OBJECT_FACTORY.createReferenceParametersType()); } toEpr.getReferenceParameters().getAny().add(el); }
public static void applyReferenceParam(EndpointReferenceType toEpr, Object el) { if (null == toEpr.getReferenceParameters()) { toEpr.setReferenceParameters(WSA_OBJECT_FACTORY.createReferenceParametersType()); } toEpr.getReferenceParameters().getAny().add(el); }
public static void applyReferenceParam(EndpointReferenceType toEpr, Object el) { if (null == toEpr.getReferenceParameters()) { toEpr.setReferenceParameters(WSA_OBJECT_FACTORY.createReferenceParametersType()); } toEpr.getReferenceParameters().getAny().add(el); }
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); }
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); }
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); }
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 void extractWsdlEprs(EndpointInfo endpoint) { //parse the EPR in wsdl List<ExtensibilityElement> portExtensors = endpoint.getExtensors(ExtensibilityElement.class); if (portExtensors != null) { Iterator<ExtensibilityElement> extensionElements = portExtensors.iterator(); QName wsaEpr = new QName(Names.WSA_NAMESPACE_NAME, "EndpointReference"); while (extensionElements.hasNext()) { ExtensibilityElement ext = extensionElements.next(); if (ext instanceof UnknownExtensibilityElement && wsaEpr.equals(ext.getElementType())) { DOMSource domSource = new DOMSource(((UnknownExtensibilityElement)ext).getElement()); W3CEndpointReference w3cEPR = new W3CEndpointReference(domSource); EndpointReferenceType ref = ProviderImpl.convertToInternal(w3cEPR); endpoint.getTarget().setMetadata(ref.getMetadata()); endpoint.getTarget().setReferenceParameters(ref.getReferenceParameters()); endpoint.getTarget().getOtherAttributes().putAll(ref.getOtherAttributes()); } } } }
/** * 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; }
/** * 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; }
/** * 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; }
@Override public CreateResponse create(Create body) { Representation representation = body.getRepresentation(); ValidAndTransformHelper.validationAndTransformation( getResourceTypeIdentifiers(), representation, null); ReferenceParametersType refParams = getManager().create(representation); CreateResponse response = new CreateResponse(); response.setResourceCreated(new EndpointReferenceType()); response.getResourceCreated().setReferenceParameters(refParams); response.setRepresentation(body.getRepresentation()); return response; }
@Override public CreateResponse create(Create body) { Representation representation = body.getRepresentation(); ValidAndTransformHelper.validationAndTransformation( getResourceTypeIdentifiers(), representation, null); ReferenceParametersType refParams = getManager().create(representation); CreateResponse response = new CreateResponse(); response.setResourceCreated(new EndpointReferenceType()); response.getResourceCreated().setReferenceParameters(refParams); response.setRepresentation(body.getRepresentation()); return response; }
/** * Convert from 2004/08 EndpointReferenceType to 2005/08 * EndpointReferenceType. * * @param exposed the 2004/08 EndpointReferenceType * @return an equivalent 2005/08 EndpointReferenceType */ public static EndpointReferenceType convert( org.apache.cxf.ws.addressing.v200408.EndpointReferenceType exposed) { EndpointReferenceType internal = ContextUtils.WSA_OBJECT_FACTORY.createEndpointReferenceType(); internal.setAddress(convert(exposed.getAddress())); internal.setReferenceParameters( convert(exposed.getReferenceParameters())); ServiceNameType serviceName = exposed.getServiceName(); AttributedQName portName = exposed.getPortType(); if (serviceName != null && portName != null) { EndpointReferenceUtils.setServiceAndPortName(internal, serviceName.getValue(), portName.getValue().getLocalPart()); } // no direct analogue for ReferenceProperties addAll(internal.getAny(), exposed.getAny()); putAll(internal.getOtherAttributes(), exposed.getOtherAttributes()); return internal; }
/** * Convert from 2004/08 EndpointReferenceType to 2005/08 * EndpointReferenceType. * * @param exposed the 2004/08 EndpointReferenceType * @return an equivalent 2005/08 EndpointReferenceType */ public static EndpointReferenceType convert( org.apache.cxf.ws.addressing.v200408.EndpointReferenceType exposed) { EndpointReferenceType internal = ContextUtils.WSA_OBJECT_FACTORY.createEndpointReferenceType(); internal.setAddress(convert(exposed.getAddress())); internal.setReferenceParameters( convert(exposed.getReferenceParameters())); ServiceNameType serviceName = exposed.getServiceName(); AttributedQName portName = exposed.getPortType(); if (serviceName != null && portName != null) { EndpointReferenceUtils.setServiceAndPortName(internal, serviceName.getValue(), portName.getValue().getLocalPart()); } // no direct analogue for ReferenceProperties addAll(internal.getAny(), exposed.getAny()); putAll(internal.getOtherAttributes(), exposed.getOtherAttributes()); return internal; }
private CreateResponse createLocally(Create body, ResourceReference ref) { Representation representation = body.getRepresentation(); ReferenceParametersType refParams = ref.getResourceManager().create(representation); CreateResponse response = new CreateResponse(); response.setResourceCreated(new EndpointReferenceType()); response.getResourceCreated().setAddress(new AttributedURIType()); response.getResourceCreated() .getAddress() .setValue(ref.getResourceURL()); response.getResourceCreated() .setReferenceParameters(refParams); response.setRepresentation(body.getRepresentation()); return response; }
private CreateResponse createLocally(Create body, ResourceReference ref) { Representation representation = body.getRepresentation(); ReferenceParametersType refParams = ref.getResourceManager().create(representation); CreateResponse response = new CreateResponse(); response.setResourceCreated(new EndpointReferenceType()); response.getResourceCreated().setAddress(new AttributedURIType()); response.getResourceCreated() .getAddress() .setValue(ref.getResourceURL()); response.getResourceCreated() .setReferenceParameters(refParams); response.setRepresentation(body.getRepresentation()); return response; }