当前位置: 首页>>代码示例>>Java>>正文


Java EndpointReference.addReferenceParameter方法代码示例

本文整理汇总了Java中org.apache.axis2.addressing.EndpointReference.addReferenceParameter方法的典型用法代码示例。如果您正苦于以下问题:Java EndpointReference.addReferenceParameter方法的具体用法?Java EndpointReference.addReferenceParameter怎么用?Java EndpointReference.addReferenceParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.axis2.addressing.EndpointReference的用法示例。


在下文中一共展示了EndpointReference.addReferenceParameter方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addReferenceParameters

import org.apache.axis2.addressing.EndpointReference; //导入方法依赖的package包/类
protected void addReferenceParameters(MessageContext msgctx) {
    EndpointReference to = msgctx.getTo();
    if (options.isManageSession() || (options.getParent() != null &&
            options.getParent().isManageSession())) {
        EndpointReference tepr = sc.getTargetEPR();
        if (tepr != null) {
            Map<QName, OMElement> map = tepr.getAllReferenceParameters();
            if (map != null) {
                Iterator<OMElement> valuse = map.values().iterator();
                while (valuse.hasNext()) {
                    Object refparaelement = valuse.next();
                    if (refparaelement instanceof OMElement) {
                        to.addReferenceParameter((OMElement) refparaelement);
                    }
                }
            }
        }
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:20,代码来源:OperationClient.java

示例2: extractToEprReferenceParameters

import org.apache.axis2.addressing.EndpointReference; //导入方法依赖的package包/类
private void extractToEprReferenceParameters(EndpointReference toEPR, SOAPHeader header,
                                               String namespace) {
    if (Final.WSA_NAMESPACE.equals(namespace)) {
        Iterator headerBlocks = header.getChildElements();
        while (headerBlocks.hasNext()) {
            OMElement headerElement = (OMElement)headerBlocks.next();
            OMAttribute isRefParamAttr =
                headerElement.getAttribute(new QName(namespace, "IsReferenceParameter"));
            if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
                log.trace("extractToEprReferenceParameters: Checking header: " +
                        headerElement.getQName());
            }
            if (isRefParamAttr != null && "true".equals(isRefParamAttr.getAttributeValue())) {
                toEPR.addReferenceParameter(headerElement);
                if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
                    log.trace("extractToEprReferenceParameters: Header: " +
                            headerElement.getQName() +
                    " has IsReferenceParameter attribute. Adding to toEPR.");
                }
            }
        }
    }
    else {
        // there is no exact way to identify ref parameters for Submission version. So let's have a handler
        // at the end of the flow, which puts all the handlers (which are of course mustUnderstand=false)
        // as reference parameters

        // TODO : Chinthaka
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:31,代码来源:AddressingInHandler.java

示例3: addReferenceParameters

import org.apache.axis2.addressing.EndpointReference; //导入方法依赖的package包/类
/**
 * 
 * @param axis2EPR
 * @param referenceParameters
 * @throws Exception
 */
public static void addReferenceParameters(EndpointReference axis2EPR, Element...referenceParameters)
throws Exception {
    if (referenceParameters != null) {
        for (Element element : referenceParameters) {
            OMElement omElement = XMLUtils.toOM(element);
            axis2EPR.addReferenceParameter(omElement);
        }            
    }    	
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:16,代码来源:EndpointReferenceUtils.java

示例4: addRoutingInfo

import org.apache.axis2.addressing.EndpointReference; //导入方法依赖的package包/类
/**
 * Adds the required routing information to the message by adding the <code>wsa:To</code>, <code>wsa:Action</code>
 * and <code>ebint:RoutingInput</code> EPR parameter WS-A headers to the message.
 * <p>NOTE: The actual elements are added to the SOAP envelop later by the WS-A module.
 *
 * @param mc            The current message context
 * @param usrMessage    The User Message the routing input has to be deferred from
 * @param signal        The Signal message for which the routing input must be added
 */
private void addRoutingInfo(final MessageContext mc, final IUserMessage usrMessage, final ISignalMessage signal) {
    // wsa:To
    final EndpointReference toEpr = new EndpointReference(MultiHopConstants.WSA_TO_ICLOUD);

    /* ebint:RoutingInput EPR parameter
    *  The info is the same as contained in the referenced user message but with the To and From swapped and the
    *  MPC and Action extended.
    *  To create this parameter we first create a MessageMetaData object based on the UserMessage and then change
    *  the required fields
    */
    final UserMessage routingInputUsrMsg = new UserMessage(usrMessage);
    // Swap To and From
    routingInputUsrMsg.setReceiver(usrMessage.getSender());
    routingInputUsrMsg.setSender(usrMessage.getReceiver());
    // Extend Action
    routingInputUsrMsg.getCollaborationInfo().setAction(usrMessage.getCollaborationInfo().getAction()
                                                        + MultiHopConstants.GENERAL_RESP_SUFFIX);
    // Extend MPC
    if (signal instanceof IReceipt)
        routingInputUsrMsg.setMPC(usrMessage.getMPC() + MultiHopConstants.RECEIPT_SUFFIX);
    else
        routingInputUsrMsg.setMPC(usrMessage.getMPC() + MultiHopConstants.ERROR_SUFFIX);

    // Create the ebint:RoutingInput element and add it as reference parameter to the To EPR
    toEpr.addReferenceParameter(RoutingInput.createElement(mc.getEnvelope(), routingInputUsrMsg));

    mc.setTo(toEpr);

    // wsa:Action header
    if (signal instanceof IReceipt)
        mc.getOptions().setAction(MultiHopConstants.ONE_WAY_ACTION + MultiHopConstants.RECEIPT_SUFFIX);
    else
        mc.getOptions().setAction(MultiHopConstants.ONE_WAY_ACTION + MultiHopConstants.ERROR_SUFFIX);

    // Set nextMSH as target for the WS-A headers
    mc.setProperty(AddressingConstants.SOAP_ROLE_FOR_ADDRESSING_HEADERS, MultiHopConstants.NEXT_MSH_TARGET);

    // Enable use of WS-A, but prevent optional WS-A headers to be added
    mc.setProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES, Boolean.FALSE);
    mc.setProperty(AddressingConstants.INCLUDE_OPTIONAL_HEADERS, Boolean.FALSE);
}
 
开发者ID:holodeck-b2b,项目名称:Holodeck-B2B,代码行数:51,代码来源:ConfigureMultihop.java

示例5: testAddToSOAPHeader

import org.apache.axis2.addressing.EndpointReference; //导入方法依赖的package包/类
public void testAddToSOAPHeader() throws Exception {
    EndpointReference replyTo = new EndpointReference(
            "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous");
    EndpointReference epr = new EndpointReference("http://www.to.org/service/");

    for (int i = 0; i < 5; i++) {
        epr.addReferenceParameter(
                new QName(Submission.WSA_NAMESPACE, "Reference" + i,
                          AddressingConstants.WSA_DEFAULT_PREFIX),
                "Value " + i * 100);

    }


    SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
    SOAPEnvelope defaultEnvelope = factory.getDefaultEnvelope();

    ConfigurationContext configCtx =
            ConfigurationContextFactory.createEmptyConfigurationContext();
    MessageContext msgCtxt = configCtx.createMessageContext();
    msgCtxt.setProperty(WS_ADDRESSING_VERSION, Submission.WSA_NAMESPACE);
    msgCtxt.setTo(epr);
    msgCtxt.setReplyTo(replyTo);
    msgCtxt.setEnvelope(defaultEnvelope);
    msgCtxt.setWSAAction("http://www.actions.org/action");
    msgCtxt.setMessageID("urn:test:123");

    OMAttribute extAttr = OMAbstractFactory.getOMFactory().createOMAttribute("AttrExt",
                                                                             OMAbstractFactory
                                                                                     .getOMFactory().createOMNamespace(
                                                                                     "http://ws.apache.org/namespaces/axis2",
                                                                                     "axis2"),
                                                                             "123456789");
    ArrayList al = new ArrayList();
    al.add(extAttr);

    msgCtxt.setProperty(AddressingConstants.ACTION_ATTRIBUTES, al);
    msgCtxt.setProperty(AddressingConstants.MESSAGEID_ATTRIBUTES, al);

    outHandler.invoke(msgCtxt);

    OMXMLParserWrapper omBuilder = TestUtil.getOMBuilder("eprTest.xml");

    XMLUnit.setIgnoreWhitespace(true);
    assertXMLEqual(omBuilder.getDocumentElement().toString(), defaultEnvelope.toString());

}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:48,代码来源:AddressingOutHandlerTest.java

示例6: fromSubscription

import org.apache.axis2.addressing.EndpointReference; //导入方法依赖的package包/类
/**
 * (01) <s12:Envelope
 * (02)     xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
 * (03)     xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
 * (04)     xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing"
 * (05)     xmlns:ew="http://www.example.com/warnings"
 * (06)     xmlns:ow="http://www.example.org/oceanwatch" >
 * (07)   <s12:Header>
 * (08)     <wsa:Action>
 * (09) http://schemas.xmlsoap.org/ws/2004/08/eventing/SubscribeResponse
 * (10)     </wsa:Action>
 * (11)     <wsa:RelatesTo>
 * (12)       uuid:e1886c5c-5e86-48d1-8c77-fc1c28d47180
 * (13)     </wsa:RelatesTo>
 * (14)     <wsa:To>http://www.example.com/MyEventSink</wsa:To>
 * (15)     <ew:MySubscription>2597</ew:MySubscription>
 * (16)   </s12:Header>
 * (17)   <s12:Body>
 * (18)     <wse:SubscribeResponse>
 * (19)       <wse:SubscriptionManager>
 * (20)         <wsa:Address>
 * (21)           http://www.example.org/oceanwatch/SubscriptionManager
 * (22)         </wsa:Address>
 * (23)         <wsa:ReferenceParameters>
 * (24)           <wse:Identifier>
 * (25)             uuid:22e8a584-0d18-4228-b2a8-3716fa2097fa
 * (26)           </wse:Identifier>
 * (27)         </wsa:ReferenceParameters>
 * (28)       </wse:SubscriptionManager>
 * (29)       <wse:Expires>2004-07-01T00:00:00.000-00:00</wse:Expires>
 * (30)     </wse:SubscribeResponse>
 * (31)   </s12:Body>
 * (32) </s12:Envelope>
 * Generate the subscription responce message
 *
 * @param subscription The subscription to which the response should be created
 * @return The response envelope.
 */
public SOAPEnvelope fromSubscription(Subscription subscription) {
    SOAPEnvelope message = factory.getDefaultEnvelope();
    EndpointReference subscriptionManagerEPR =
            new EndpointReference(subscription.getEventSinkURL());
    subscriptionManagerEPR.addReferenceParameter(new QName(EventingConstants.WSE_EVENTING_NS,
            EventingConstants.WSE_EN_IDENTIFIER, EventingConstants.WSE_EVENTING_PREFIX),
            subscription.getId());
    OMNamespace eventingNamespace = factory.createOMNamespace(EventingConstants.WSE_EVENTING_NS,
            EventingConstants.WSE_EVENTING_PREFIX);
    OMElement subscribeResponseElement = factory.createOMElement(
            EventingConstants.WSE_EN_SUBSCRIBE_RESPONSE, eventingNamespace);
    try {
        OMElement subscriptionManagerElement = EndpointReferenceHelper.toOM(
                subscribeResponseElement.getOMFactory(),
                subscriptionManagerEPR,
                new QName(EventingConstants.WSE_EVENTING_NS,
                        EventingConstants.WSE_EN_SUBSCRIPTION_MANAGER,
                        EventingConstants.WSE_EVENTING_PREFIX),
                AddressingConstants.Submission.WSA_NAMESPACE);
        subscribeResponseElement.addChild(subscriptionManagerElement);
        OMElement expiresElement =
                factory.createOMElement(EventingConstants.WSE_EN_EXPIRES, eventingNamespace);
        if (subscription.getExpires() != null) {
            factory.createOMText(expiresElement,
                    ConverterUtil.convertToString(subscription.getExpires()));
        } else {
            factory.createOMText(expiresElement, "*");
        }
        subscribeResponseElement.addChild(expiresElement);
        message.getBody().addChild(subscribeResponseElement);
    } catch (AxisFault axisFault) {
        log.error("Unable to create subscription response", axisFault);
        throw new BuilderException("Unable to create subscription response", axisFault);
    }
    return message;
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:75,代码来源:SubscribeCommandBuilder.java


注:本文中的org.apache.axis2.addressing.EndpointReference.addReferenceParameter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。