/** * Parse an EndpointReferenceType from a DOM element. Handles all of * the WS-Addressing namespaces currently supported. * @param ref * @throws JAXBException */ public static EndpointReferenceType parseEndpointReference(Element ref) throws JAXBException { Element child = DOMUtils.getFirstElement(ref); String tns = null; while (child != null && tns == null) { if (isSupported(child.getNamespaceURI())) { tns = child.getNamespaceURI(); } child = DOMUtils.getNextElement(child); } if (tns == null) { return null; } JAXBContext ctx = getExposedJAXBContext(tns); JAXBElement<?> o = ctx.createUnmarshaller().unmarshal(ref, getExposedReferenceType(tns)); if (o != null) { return convertToNative(o.getValue()); } return convertToNative(null); } /**
/** * Converts a version specific EndpointReferenceType to the native version * used internally by CXF * @param exposed */ public static EndpointReferenceType convertToNative(Object exposed) { if (EndpointReferenceType.class.isInstance(exposed)) { return (EndpointReferenceType)exposed; } else if (Names200408.EPR_TYPE.isInstance(exposed)) { return convert((org.apache.cxf.ws.addressing.v200408.EndpointReferenceType)exposed); } else if (Names200403.EPR_TYPE.isInstance(exposed)) { return convert((org.apache.cxf.ws.addressing.v200403.EndpointReferenceType)exposed); } return null; }
/** * Convert from 2004/08 ReferenceParametersType to 2005/08 * ReferenceParametersType. * * @param exposed the 2004/08 ReferenceParametersType * @return an equivalent 2005/08 ReferenceParametersType */ public static ReferenceParametersType convert( org.apache.cxf.ws.addressing.v200408.ReferenceParametersType exposed) { ReferenceParametersType internal = null; if (exposed != null) { internal = ContextUtils.WSA_OBJECT_FACTORY.createReferenceParametersType(); addAll(internal.getAny(), exposed.getAny()); } return internal; } // THERE IS NO ReferenceParametersType for 2004/03
/** * 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; }
org.apache.cxf.ws.addressing.v200403.EndpointReferenceType exposed = Names200403.WSA_OBJECT_FACTORY .createEndpointReferenceType(); exposed.setAddress(convertTo200403(internal.getAddress())); addAll(exposed.getAny(), internal.getAny()); putAll(exposed.getOtherAttributes(), internal.getOtherAttributes()); return exposed;
if (org.apache.cxf.ws.addressing.VersionTransformer.isSupported(headerURI)) { if (unmarshaller == null) { JAXBContext jaxbContext = org.apache.cxf.ws.addressing.VersionTransformer.getExposedJAXBContext(headerURI); unmarshaller = jaxbContext.createUnmarshaller();
/** * Convert from 2004/03 AttributedURI to 2005/08 AttributedURI. * * @param exposed the 2004/03 AttributedURI * @return an equivalent 2005/08 AttributedURIType */ public static AttributedURIType convert(org.apache.cxf.ws.addressing.v200403.AttributedURI exposed) { AttributedURIType internal = ContextUtils.WSA_OBJECT_FACTORY.createAttributedURIType(); String internalValue = Names200403.WSA_ANONYMOUS_ADDRESS.equals(exposed.getValue()) ? Names.WSA_ANONYMOUS_ADDRESS : Names200403.WSA_NONE_ADDRESS.equals(exposed.getValue()) ? Names.WSA_NONE_ADDRESS : exposed.getValue(); internal.setValue(internalValue); putAll(internal.getOtherAttributes(), exposed.getOtherAttributes()); return internal; }
public static String findMEXLocation(Element ref) { Element el = DOMUtils.getFirstElement(ref); while (el != null) { if ("Address".equals(el.getLocalName()) && VersionTransformer.isSupported(el.getNamespaceURI()) && "MetadataReference".equals(ref.getLocalName())) { return DOMUtils.getContent(el); } String ad = findMEXLocation(el); if (ad != null) { return ad; } el = DOMUtils.getNextElement(el); } return null; }
private Marshaller getMarshaller() throws JAXBException { JAXBContext jaxbContext = org.apache.cxf.ws.addressing.VersionTransformer.getExposedJAXBContext(currentNamespaceURI); Marshaller marshaller = jaxbContext.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE); return marshaller; }
/** * 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; }
org.apache.cxf.ws.addressing.v200403.EndpointReferenceType exposed = Names200403.WSA_OBJECT_FACTORY .createEndpointReferenceType(); exposed.setAddress(convertTo200403(internal.getAddress())); addAll(exposed.getAny(), internal.getAny()); putAll(exposed.getOtherAttributes(), internal.getOtherAttributes()); return exposed;
if (org.apache.cxf.ws.addressing.VersionTransformer.isSupported(headerURI)) { if (unmarshaller == null) { JAXBContext jaxbContext = org.apache.cxf.ws.addressing.VersionTransformer.getExposedJAXBContext(headerURI); unmarshaller = jaxbContext.createUnmarshaller();
/** * Convert from 2004/03 AttributedURI to 2005/08 AttributedURI. * * @param exposed the 2004/03 AttributedURI * @return an equivalent 2005/08 AttributedURIType */ public static AttributedURIType convert(org.apache.cxf.ws.addressing.v200403.AttributedURI exposed) { AttributedURIType internal = ContextUtils.WSA_OBJECT_FACTORY.createAttributedURIType(); String internalValue = Names200403.WSA_ANONYMOUS_ADDRESS.equals(exposed.getValue()) ? Names.WSA_ANONYMOUS_ADDRESS : Names200403.WSA_NONE_ADDRESS.equals(exposed.getValue()) ? Names.WSA_NONE_ADDRESS : exposed.getValue(); internal.setValue(internalValue); putAll(internal.getOtherAttributes(), exposed.getOtherAttributes()); return internal; }
protected String findMEXLocation(Element ref) { Element el = DOMUtils.getFirstElement(ref); while (el != null) { if ("Address".equals(el.getLocalName()) && VersionTransformer.isSupported(el.getNamespaceURI()) && "MetadataReference".equals(ref.getLocalName())) { return DOMUtils.getContent(el); } String ad = findMEXLocation(el); if (ad != null) { return ad; } el = DOMUtils.getNextElement(el); } return null; }
org.apache.cxf.ws.addressing.VersionTransformer.getExposedJAXBContext( maps.getNamespaceURI()); QName duplicate = maps.getDuplicate();
/** * 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; }
/** * Parse an EndpointReferenceType from a DOM element. Handles all of * the WS-Addressing namespaces currently supported. * @param ref * @throws JAXBException */ public static EndpointReferenceType parseEndpointReference(Element ref) throws JAXBException { Element child = DOMUtils.getFirstElement(ref); String tns = null; while (child != null && tns == null) { if (isSupported(child.getNamespaceURI())) { tns = child.getNamespaceURI(); } child = DOMUtils.getNextElement(child); } if (tns == null) { return null; } JAXBContext ctx = getExposedJAXBContext(tns); JAXBElement<?> o = ctx.createUnmarshaller().unmarshal(ref, getExposedReferenceType(tns)); if (o != null) { return convertToNative(o.getValue()); } return convertToNative(null); } /**
org.apache.cxf.ws.addressing.v200403.EndpointReferenceType exposed = Names200403.WSA_OBJECT_FACTORY .createEndpointReferenceType(); exposed.setAddress(convertTo200403(internal.getAddress())); addAll(exposed.getAny(), internal.getAny()); putAll(exposed.getOtherAttributes(), internal.getOtherAttributes()); return exposed;
/** * Convert from 2004/03 AttributedURI to 2005/08 AttributedURI. * * @param exposed the 2004/03 AttributedURI * @return an equivalent 2005/08 AttributedURIType */ public static AttributedURIType convert(org.apache.cxf.ws.addressing.v200403.AttributedURI exposed) { AttributedURIType internal = ContextUtils.WSA_OBJECT_FACTORY.createAttributedURIType(); String internalValue = Names200403.WSA_ANONYMOUS_ADDRESS.equals(exposed.getValue()) ? Names.WSA_ANONYMOUS_ADDRESS : Names200403.WSA_NONE_ADDRESS.equals(exposed.getValue()) ? Names.WSA_NONE_ADDRESS : exposed.getValue(); internal.setValue(internalValue); putAll(internal.getOtherAttributes(), exposed.getOtherAttributes()); return internal; }
protected String findMEXLocation(Element ref) { Element el = DOMUtils.getFirstElement(ref); while (el != null) { if ("Address".equals(el.getLocalName()) && VersionTransformer.isSupported(el.getNamespaceURI()) && "MetadataReference".equals(ref.getLocalName())) { return DOMUtils.getContent(el); } String ad = findMEXLocation(el); if (ad != null) { return ad; } el = DOMUtils.getNextElement(el); } return null; }