/** * Populates an endpoint reference based on the <code>OMElement</code> that is * passed in. If the http://schemas.xmlsoap.org/ws/2004/08/addressing namespace * is in effect then any reference properties will be saved as reference parameters. * Regardless of the addressing namespace in effect, any elements present in the * <code>OMElement</code> that are not recognised are saved as extensibility elements. * * @param eprOMElement an element of endpoint reference type * @throws AxisFault if unable to locate an address element */ public static EndpointReference fromOM(OMElement eprOMElement) throws AxisFault { EndpointReference epr = new EndpointReference(""); fromOM(epr, eprOMElement); return epr; }
/** * Populates an endpoint reference based on the <code>OMElement</code> that is * passed in. If the http://schemas.xmlsoap.org/ws/2004/08/addressing namespace * is in effect then any reference properties will be saved as reference parameters. * Regardless of the addressing namespace in effect, any elements present in the * <code>OMElement</code> that are not recognised are saved as extensibility elements. * * @param eprOMElement an element of endpoint reference type * @throws AxisFault if unable to locate an address element */ public static EndpointReference fromOM(OMElement eprOMElement) throws AxisFault { EndpointReference epr = new EndpointReference(""); fromOM(epr, eprOMElement); return epr; }
/** * Populates an endpoint reference based on the <code>OMElement</code> and * WS-Addressing namespace that is passed in. * * @param epr an endpoint reference instance to hold the info. * @param eprOMElement an element of endpoint reference type * @param addressingNamespace the namespace of the WS-Addressing spec to comply with. * @throws AxisFault if unable to locate an address element, or if the specified namespace * is different to the actual namespace. * @see #fromOM(OMElement) */ public static void fromOM(EndpointReference epr, OMElement eprOMElement, String addressingNamespace) throws AxisFault { String namespace = fromOM(epr, eprOMElement); if (!namespace.equals(addressingNamespace)) throw new AxisFault("The endpoint reference does not match the specified namespace."); }
/** * Populates an endpoint reference based on the <code>OMElement</code> and * WS-Addressing namespace that is passed in. * * @param epr an endpoint reference instance to hold the info. * @param eprOMElement an element of endpoint reference type * @param addressingNamespace the namespace of the WS-Addressing spec to comply with. * @throws AxisFault if unable to locate an address element, or if the specified namespace * is different to the actual namespace. * @see #fromOM(OMElement) */ public static void fromOM(EndpointReference epr, OMElement eprOMElement, String addressingNamespace) throws AxisFault { String namespace = fromOM(epr, eprOMElement); if (!namespace.equals(addressingNamespace)) throw new AxisFault("The endpoint reference does not match the specified namespace."); }
public static String decodeSubscriptionResponse(OMElement subscriptionReference) throws AxisFault { String subscriptionId = null; EndpointReference subscriptionReferenceEPR = EndpointReferenceHelper.fromOM(subscriptionReference); Map<QName, OMElement> referenceParams = subscriptionReferenceEPR.getAllReferenceParameters(); if (referenceParams != null) { QName identifierQName = new QName(NameSpaceConstants.WSNT_NS.getNamespaceURI(), WsmgCommonConstants.SUBSCRIPTION_ID); OMElement identifierEl = referenceParams.get(identifierQName); subscriptionId = (identifierEl != null) ? identifierEl.getText() : null; } return subscriptionId; }
public static String decodeSubscriptionResponse(OMElement subscriptionReference) throws AxisFault { String subscriptionId = null; EndpointReference subscriptionReferenceEPR = EndpointReferenceHelper.fromOM(subscriptionReference); Map<QName, OMElement> referenceParams = subscriptionReferenceEPR.getAllReferenceParameters(); if (referenceParams != null) { QName identifierQName = new QName(NameSpaceConstants.WSNT_NS.getNamespaceURI(), WsmgCommonConstants.SUBSCRIPTION_ID); OMElement identifierEl = referenceParams.get(identifierQName); subscriptionId = (identifierEl != null) ? identifierEl.getText() : null; } return subscriptionId; }
public static String decodeSubscriptionResponse(OMElement subscriptionReference) throws AxisFault { String subscriptionId = null; EndpointReference subscriptionReferenceEPR = EndpointReferenceHelper.fromOM(subscriptionReference); Map<QName, OMElement> referenceParams = subscriptionReferenceEPR.getAllReferenceParameters(); if (referenceParams != null) { QName identifierQName = new QName(NameSpaceConstants.WSNT_NS.getNamespaceURI(), WsmgCommonConstants.SUBSCRIPTION_ID); OMElement identifierEl = referenceParams.get(identifierQName); subscriptionId = (identifierEl != null) ? identifierEl.getText() : null; } return subscriptionId; }
private EndpointReference lookupEpr(OMNamespace ns2, String localPart) throws AxisFault { OMElement element = target.getFirstChildWithName(new QName(ns2.getNamespaceURI(), localPart)); return EndpointReferenceHelper.fromOM(element); }
public static String decodeSubscriptionResponse(OMElement subscriptionReference) throws AxisFault { String subscriptionId = null; EndpointReference subscriptionReferenceEPR = EndpointReferenceHelper.fromOM(subscriptionReference); Map<QName, OMElement> referenceParams = subscriptionReferenceEPR.getAllReferenceParameters(); if (referenceParams != null) { QName identifierQName = new QName(NameSpaceConstants.WSNT_NS.getNamespaceURI(), WsmgCommonConstants.SUBSCRIPTION_ID); OMElement identifierEl = referenceParams.get(identifierQName); subscriptionId = (identifierEl != null) ? identifierEl.getText() : null; } return subscriptionId; }
/** * Set EPR * * @param element Endpoint Reference Type element */ public void setEPR(OMElement element) throws MexOMException { eprElement = element; try { epr = EndpointReferenceHelper.fromOM(eprElement); } catch (AxisFault e) { throw new MexOMException (e); } }
protected org.apache.axis2.addressing.EndpointReference getEPR(WebServiceBinding wsBinding) { if (wsBinding.getEndPointReference() == null) { return null; } try { DOMSource domSource = new DOMSource(wsBinding.getEndPointReference()); XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(domSource); StAXOMBuilder builder = new StAXOMBuilder(parser); OMElement omElement = builder.getDocumentElement(); org.apache.axis2.addressing.EndpointReference epr = EndpointReferenceHelper.fromOM(omElement); return epr; } catch (IOException e) { throw new RuntimeException(e); } catch (XMLStreamException e) { throw new RuntimeException(e); } catch (FactoryConfigurationError e) { throw new RuntimeException(e); } }
/** * Populates an endpoint reference based on the <code>String</code> that is * passed in. If the http://schemas.xmlsoap.org/ws/2004/08/addressing namespace * is in effect then any reference properties will be saved as reference parameters. * Regardless of the addressing namespace in effect, any elements present in the * <code>String</code> that are not recognised are saved as extensibility elements. * * @param eprString string from the element of endpoint reference type * @throws AxisFault if unable to locate an address element */ public static EndpointReference fromString(String eprString) throws AxisFault { try { return fromOM(AXIOMUtil.stringToOM(eprString)); } catch (XMLStreamException e) { throw AxisFault.makeFault(e); } }
/** * Populates an endpoint reference based on the <code>String</code> that is * passed in. If the http://schemas.xmlsoap.org/ws/2004/08/addressing namespace * is in effect then any reference properties will be saved as reference parameters. * Regardless of the addressing namespace in effect, any elements present in the * <code>String</code> that are not recognised are saved as extensibility elements. * * @param eprString string from the element of endpoint reference type * @throws AxisFault if unable to locate an address element */ public static EndpointReference fromString(String eprString) throws AxisFault { try { return fromOM(AXIOMUtil.stringToOM(eprString)); } catch (XMLStreamException e) { throw AxisFault.makeFault(e); } }
public Object fromOMElement(OMElement element) throws OMException,AxisFault { OMElement acksToPart = element.getFirstChildWithName(new QName( rmNamespaceValue, Sandesha2Constants.WSRM_COMMON.ACKS_TO)); if (acksToPart == null) throw new OMException(SandeshaMessageHelper.getMessage( SandeshaMessageKeys.noAcksToPart, element.toString())); epr = EndpointReferenceHelper.fromOM (acksToPart); // Sniff the addressing namespace from the Address child of the EPR Iterator children = acksToPart.getChildElements(); while(children.hasNext() && addressingNamespaceValue == null) { OMElement child = (OMElement) children.next(); if("Address".equals(child.getLocalName())) { addressingNamespaceValue = child.getNamespace().getNamespaceURI(); } } return this; }
public Object fromOMElement(OMElement endpointElement) throws OMException,AxisFault { epr = EndpointReferenceHelper.fromOM (endpointElement); if (epr==null) { String message = SandeshaMessageHelper.getMessage( SandeshaMessageKeys.invalidElementFoundWithinElement, "EPR", Sandesha2Constants.WSRM_COMMON.ENDPOINT); throw new SandeshaException (message); } // Sniff the addressing namespace from the Address child of the endpointElement Iterator children = endpointElement.getChildElements(); while(children.hasNext() && addressingNamespaceValue == null) { OMElement child = (OMElement) children.next(); if("Address".equals(child.getLocalName())) { addressingNamespaceValue = child.getNamespace().getNamespaceURI(); } } return this; }
public WsrfResourceStub registerPublisher(EndpointReference omEndpointReference) throws AxisFault { // invoker.setMessageId(null); OMElement message = factory.createOMElement(new QName(NameSpaceConstants.WSBR_NS.getNamespaceURI(), "RegisterPublisher")); // builder.newFragment(WsmgConstants.WSBR_NS, // "RegisterPublisher"); // EndpointReference publisherRef; OMElement publisherRef = null; publisherRef = EndpointReferenceHelper.toOM(factory, omEndpointReference, new QName(NameSpaceConstants.WSBR_NS.getNamespaceURI(), "PublisherReference"), NameSpaceConstants.WSA_NS.getNamespaceURI()); message.addChild(publisherRef); ServiceClient client = createServiceClient(message); OMElement responseMessage = client.sendReceive(message); client.cleanupTransport(); OMElement publisherRegistrationRef = responseMessage.getFirstChildWithName(new QName(NameSpaceConstants.WSBR_NS .getNamespaceURI(), "PublisherRegistrationReference")); EndpointReference epr = EndpointReferenceHelper.fromOM(publisherRegistrationRef); return new WsrfResourceStub(epr, getTimeoutInMilliSeconds()); }
private void processEmbeddedEPR(List extensibilityElements, AxisEndpoint axisEndpoint) { Iterator eelts = extensibilityElements.iterator(); while(eelts.hasNext()){ ExtensibilityElement ee = (ExtensibilityElement)eelts.next(); if(AddressingConstants.Final.WSA_ENDPOINT_REFERENCE.equals(ee.getElementType())){ try { Element elt = ((UnknownExtensibilityElement)ee).getElement(); OMElement eprOMElement = XMLUtils.toOM(elt); EndpointReference epr = EndpointReferenceHelper.fromOM(eprOMElement); Map referenceParameters = epr.getAllReferenceParameters(); if(referenceParameters != null){ axisEndpoint.addParameter(AddressingConstants.REFERENCE_PARAMETER_PARAMETER, new ArrayList(referenceParameters.values())); } for (OMElement extensibleElement : epr.getExtensibleElements()) { if (AddressingConstants.QNAME_IDENTITY.equals(extensibleElement.getQName())) { axisEndpoint.addParameter(AddressingConstants.ADDRESSING_IDENTITY_PARAMETER, extensibleElement.cloneOMElement()); break; } } } catch (Exception e) { if(log.isDebugEnabled()){ log.debug("Exception encountered processing embedded wsa:EndpointReference", e); } } } } }
private void processEmbeddedEPR(List extensibilityElements, AxisEndpoint axisEndpoint) { Iterator eelts = extensibilityElements.iterator(); while(eelts.hasNext()){ ExtensibilityElement ee = (ExtensibilityElement)eelts.next(); if(AddressingConstants.Final.WSA_ENDPOINT_REFERENCE.equals(ee.getElementType())){ try { Element elt = ((UnknownExtensibilityElement)ee).getElement(); OMElement eprOMElement = XMLUtils.toOM(elt); EndpointReference epr = EndpointReferenceHelper.fromOM(eprOMElement); Map referenceParameters = epr.getAllReferenceParameters(); if(referenceParameters != null){ axisEndpoint.addParameter(AddressingConstants.REFERENCE_PARAMETER_PARAMETER, new ArrayList(referenceParameters.values())); } for (OMElement extensibleElement : epr.getExtensibleElements()) { if (AddressingConstants.QNAME_IDENTITY.equals(extensibleElement.getQName())) { axisEndpoint.addParameter(AddressingConstants.ADDRESSING_IDENTITY_PARAMETER, extensibleElement.cloneOMElement()); break; } } } catch (Exception e) { if(log.isDebugEnabled()){ log.debug("Exception encountered processing embedded wsa:EndpointReference", e); } } } } }
public WsrfResourceStub registerPublisher(EndpointReference omEndpointReference) throws AxisFault { // invoker.setMessageId(null); OMElement message = factory.createOMElement(new QName(NameSpaceConstants.WSBR_NS.getNamespaceURI(), "RegisterPublisher")); // builder.newFragment(WsmgConstants.WSBR_NS, // "RegisterPublisher"); // EndpointReference publisherRef; OMElement publisherRef = null; publisherRef = EndpointReferenceHelper.toOM(factory, omEndpointReference, new QName(NameSpaceConstants.WSBR_NS.getNamespaceURI(), "PublisherReference"), NameSpaceConstants.WSA_NS.getNamespaceURI()); message.addChild(publisherRef); ServiceClient client = createServiceClient(message); OMElement responseMessage = client.sendReceive(message); client.cleanup(); client.cleanupTransport(); OMElement publisherRegistrationRef = responseMessage.getFirstChildWithName(new QName(NameSpaceConstants.WSBR_NS .getNamespaceURI(), "PublisherRegistrationReference")); EndpointReference epr = EndpointReferenceHelper.fromOM(publisherRegistrationRef); return new WsrfResourceStub(epr, getTimeoutInMilliSeconds()); }
/** * Populates an MetadataReference object based on the endpoint reference type <code>OMElement</code> passed. * @param inElement MetadataReference element * @return MetadataReference * @throws MexOMException */ public MetadataReference fromOM(OMElement element) throws MexOMException{ if (element == null) { throw new MexOMException("Null element passed."); } if (!element.getLocalName().equals(MexConstants.SPEC.METADATA_REFERENCE)) { throw new MexOMException("Invalid element passed."); } eprElement = element; try { epr = EndpointReferenceHelper.fromOM(element); } catch (AxisFault e) { throw new MexOMException (e); } return this; } /**