/** * Add wsa:From SOAP header to the message * @param sh - the SOAP header for the message * @param fromEPR - the (Axis2) EPR to include in the wsa:From * @throws AxisFault - if an error occurs setting the wsa:From into the header */ private void addWSAFromHeader( SOAPHeader sh, EndpointReference fromEPR ) throws AxisFault { OMElement epr = EndpointReferenceHelper.toOM(sh.getOMFactory(), fromEPR, QNAME_WSA_FROM, AddressingConstants.Final.WSA_NAMESPACE); sh.addChild(epr); } // end method addWSAFromHeader
/** * 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; }
public WSMPublisher(int capacity, boolean defaultAsync, String brokerEpr_, boolean isXmlEpr) throws IOException { super(capacity, defaultAsync); if (!isXmlEpr) { brokerEpr = new EndpointReference(brokerEpr_);// EndpointReferenceHelper.fro(brokerEpr_); } else { brokerEpr = EndpointReferenceHelper.fromString(brokerEpr_); } broker = new WseMsgBrokerClient(); broker.init(brokerEpr.getAddress()); }
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()); }
ServiceName serviceName = EndpointReferenceHelper.getServiceNameMetadata(epr, addressingNamespace); QName serviceQName = serviceDescription.getServiceQName();
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()); }
ServiceName serviceName = EndpointReferenceHelper.getServiceNameMetadata(epr, addressingNamespace); QName serviceQName = serviceDescription.getServiceQName();
public static String getBrokerPublishEPR(String brokerURL, String topic) { brokerURL = WorkFlowUtils.formatURLString(brokerURL); EndpointReference encodedEpr = WSEProtocolClient.createEndpointReference(brokerURL, topic); String ret = null; try { OMElement eprCrEl = EndpointReferenceHelper.toOM(OMAbstractFactory.getOMFactory(), encodedEpr, new QName( "EndpointReference"), NameSpaceConstants.WSA_NS.getNamespaceURI()); ret = eprCrEl.toStringWithConsume(); } catch (Exception e) { logger.error("unable to convert broker url", e); } return ret; /* * String epr = null; brokerURL = WorkFlowUtils.formatURLString(brokerURL); if (brokerURL.endsWith("/")) { epr = * brokerURL + STRING_TOPIC + topic; } else { epr = brokerURL + "/" + STRING_TOPIC + topic; } * * epr = "<wsa:EndpointReference " + "xmlns:wsa='http://www.w3.org/2005/08/addressing'>" + "<wsa:Address>" + epr * + "</wsa:Address>" + "</wsa:EndpointReference>"; 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; }
public Subscription renewMessageboxSubscription(String epr, String subscriptionId, String topic, String xpath, boolean subscribePermanatly) throws MsgBrokerClientException { this.subscriptionId = subscriptionId; this.topic = topic; WseMsgBrokerClient wseClient = new WseMsgBrokerClient(); EndpointReference endpointReference = null; try { endpointReference = EndpointReferenceHelper.fromString(epr); } catch (AxisFault f) { throw new MsgBrokerClientException("unable to convert end point reference", f); } subscriptionId = subscribeToBroker(endpointReference.getAddress(), topic, xpath, wseClient, subscribePermanatly); Subscription subscription = new Subscription(this, subscriptionId, topic, callback, this.brokerURL); subscription.setMessageBoxEpr(endpointReference); return subscription; }
private OMElement createMessageEl(EndpointReference eventSinkReferenceEPR, OMElement filterEl, long expireTime) throws AxisFault { OMElement message = factory.createOMElement("Subscribe", NameSpaceConstants.WSE_NS); OMElement delivery = factory.createOMElement("Delivery", NameSpaceConstants.WSE_NS); OMElement expires = factory.createOMElement("Expires", NameSpaceConstants.WSE_NS); expires.setText(Long.toString(expireTime)); message.addChild(expires); OMElement notifyTo = EndpointReferenceHelper.toOM(factory, eventSinkReferenceEPR, new QName( NameSpaceConstants.WSE_NS.getNamespaceURI(), "NotifyTo"), NameSpaceConstants.WSA_NS.getNamespaceURI()); delivery.addChild(notifyTo); message.addChild(delivery); if (filterEl != null) { message.addChild(filterEl); } message.declareNamespace(NameSpaceConstants.WSA_NS); return message; }
/** * 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."); }
private OMElement createMessageEl(EndpointReference eventSinkReferenceEPR, OMElement filterEl, long expireTime) throws AxisFault { OMElement message = factory.createOMElement("Subscribe", NameSpaceConstants.WSE_NS); OMElement delivery = factory.createOMElement("Delivery", NameSpaceConstants.WSE_NS); OMElement expires = factory.createOMElement("Expires", NameSpaceConstants.WSE_NS); expires.setText(Long.toString(expireTime)); message.addChild(expires); OMElement notifyTo = EndpointReferenceHelper.toOM(factory, eventSinkReferenceEPR, new QName( NameSpaceConstants.WSE_NS.getNamespaceURI(), "NotifyTo"), NameSpaceConstants.WSA_NS.getNamespaceURI()); delivery.addChild(notifyTo); message.addChild(delivery); if (filterEl != null) { message.addChild(filterEl); } message.declareNamespace(NameSpaceConstants.WSA_NS); return message; }
/** * 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 OMElement toOMElement(OMElement element) throws OMException,AxisFault { if (epr == null) throw new OMException(SandeshaMessageHelper.getMessage( SandeshaMessageKeys.cannotSetAcksTo, null)); OMFactory factory = element.getOMFactory(); QName acksTo = new QName (rmNamespaceValue,Sandesha2Constants.WSRM_COMMON.ACKS_TO, Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM); OMElement endpointElement = EndpointReferenceHelper.toOM (factory,epr, acksTo ,addressingNamespaceValue); element.addChild(endpointElement); return 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; }
/** * Convert MetadatReference object content to the OMElement representation. * @return OMElement representation of MetadatReference. * @throws MexOMException */ public OMElement toOM() throws MexOMException { if (eprElement == null) { throw new MexOMException( "Must have EndpointReference element in MetadataReference"); } OMElement metadataRef = null; try { metadataRef = EndpointReferenceHelper.toOM(factory, epr, new QName( namespaceValue, MexConstants.SPEC.METADATA_REFERENCE, MexConstants.SPEC.NS_PREFIX), eprElement.getNamespace() .getNamespaceURI()); } catch (AxisFault e) { throw new MexOMException(e); } return metadataRef; }
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; }