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


Java EndpointReference.getAddress方法代码示例

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


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

示例1: setUp

import org.apache.axis2.addressing.EndpointReference; //导入方法依赖的package包/类
protected void setUp() throws Exception {
        targetEPR =
                new EndpointReference("http://127.0.0.1:"
                        + (UtilServer.TESTING_PORT)
//                        + 8000
                        + "/axis2/services/ComplexDataTypesDocLitBare");
        stub = new org.tempuri.complex.ComplexDataTypesDocLitBareStub(null, targetEPR.getAddress());
        String className = "org.tempuri.complex.ComplexDataTypesDocLitBare";
        UtilServer.start();
        Parameter generateBare = new Parameter();
        generateBare.setName(Java2WSDLConstants.DOC_LIT_BARE_PARAMETER);
        generateBare.setValue("true");
        UtilServer.getConfigurationContext().getAxisConfiguration().addParameter(generateBare);
        AxisService service = AxisService.createService(
                className, UtilServer.getConfigurationContext().getAxisConfiguration());
        service.addParameter(generateBare);
        service.setName("ComplexDataTypesDocLitBare");
        service.setClassLoader(Thread.currentThread().getContextClassLoader());
        UtilServer.deployService(service);
    }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:21,代码来源:ComplexDataTypesDocLitBareTest.java

示例2: setUp

import org.apache.axis2.addressing.EndpointReference; //导入方法依赖的package包/类
protected void setUp() throws Exception {
    String className = "org.tempuri.complex.ComplexDataTypes";
    UtilServer.start();
    AxisService   service = AxisService.createService(
            className, UtilServer.getConfigurationContext().getAxisConfiguration());
    service.setElementFormDefault(true);
    service.setName("ComplexDataTypes");
    service.setClassLoader(Thread.currentThread().getContextClassLoader());

    UtilServer.deployService(service);
     targetEPR =
            new EndpointReference("http://127.0.0.1:"
                    + (UtilServer.TESTING_PORT)
                    + "/axis2/services/ComplexDataTypes");
    stub  = new org.tempuri.complex.ComplexDataTypesComplexDataTypesHttpSoap11EndpointStub(null,targetEPR.getAddress());
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:17,代码来源:ComplexDataTypesComplexDataTypesSOAP11Test.java

示例3: processToEPR

import org.apache.axis2.addressing.EndpointReference; //导入方法依赖的package包/类
private void processToEPR() throws AxisFault {
    EndpointReference epr = messageContextOptions.getTo();
    if (epr != null && !isAddressingHeaderAlreadyAvailable(WSA_TO, false)) {
        try {
            processToEPRReferenceInformation(epr.getAllReferenceParameters());
        }
        catch (Exception e) {
            throw new AxisFault(AddressingMessages.getMessage("referenceParameterError"), e);
        }
        String address = epr.getAddress();
        if (address != null && address.length()!=0) {
            if (!includeOptionalHeaders && isFinalAddressingNamespace &&
                    epr.isWSAddressingAnonymous())
            {
                return; //Omit the header.
            }
            createSOAPHeaderBlock(address, WSA_TO, epr.getAddressAttributes());
        }
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:21,代码来源:AddressingOutHandler.java

示例4: testMessageWithOmittedReplyTo

import org.apache.axis2.addressing.EndpointReference; //导入方法依赖的package包/类
public void testMessageWithOmittedReplyTo() {
    try {
        Options options = testMessageWithOmittedHeaders("noReplyTo");
        EndpointReference epr = options.getReplyTo();
        String address = epr.getAddress();

        assertEquals("The address of the ReplyTo endpoint reference is not the none URI.",
                     AddressingConstants.Final.WSA_NONE_URI, address);
    }
    catch (AxisFault af) {
        af.printStackTrace();
        log.error(af.getMessage());
        fail("An unexpected AxisFault was thrown due to a missing ReplyTo header.");
    }
    catch (Exception e) {
        e.printStackTrace();
        log.error(e.getMessage());
        fail(" An Exception has occured " + e.getMessage());
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:21,代码来源:AddressingSubmissionInHandlerTest.java

示例5: testMessageWithOmittedReplyTo

import org.apache.axis2.addressing.EndpointReference; //导入方法依赖的package包/类
public void testMessageWithOmittedReplyTo() {
    try {
        Options options = testMessageWithOmittedHeaders("noReplyTo");
        EndpointReference epr = options.getReplyTo();
        String address = epr.getAddress();

        assertEquals("The address of the ReplyTo endpoint reference is not the anonymous URI.",
                     AddressingConstants.Final.WSA_ANONYMOUS_URL, address);
    }
    catch (AxisFault af) {
        af.printStackTrace();
        log.error(af.getMessage());
        fail("An unexpected AxisFault was thrown due to a missing ReplyTo header.");
    }
    catch (Exception e) {
        e.printStackTrace();
        log.error(e.getMessage());
        fail(" An Exception has occured " + e.getMessage());
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:21,代码来源:AddressingFinalInHandlerTest.java

示例6: testMessageWithOmittedTo

import org.apache.axis2.addressing.EndpointReference; //导入方法依赖的package包/类
public void testMessageWithOmittedTo() {
    try {
        Options options = testMessageWithOmittedHeaders("noTo");
        EndpointReference epr = options.getTo();
        String address = epr.getAddress();

        assertEquals("The address of the To endpoint reference is not the anonymous URI.",
                     AddressingConstants.Final.WSA_ANONYMOUS_URL, address);
    }
    catch (AxisFault af) {
        af.printStackTrace();
        log.error(af.getMessage());
        fail("An unexpected AxisFault was thrown due to a missing To header.");
    }
    catch (Exception e) {
        e.printStackTrace();
        log.error(e.getMessage());
        fail(" An Exception has occured " + e.getMessage());
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:21,代码来源:AddressingFinalInHandlerTest.java

示例7: findOperation

import org.apache.axis2.addressing.EndpointReference; //导入方法依赖的package包/类
public AxisOperation findOperation(AxisService service, MessageContext messageContext)
        throws AxisFault {

    EndpointReference toEPR = messageContext.getTo();
    if (toEPR != null) {
        String filePart = toEPR.getAddress();
        String operation  = Utils.getOperationName(filePart, service.getName());

        if (operation != null) {
            QName operationName = new QName(operation);
            log.debug(messageContext.getLogIDString() +
                    " Checking for Operation using QName(target endpoint URI fragment) : " +
                    operationName);
            return service.getOperation(operationName);
        } else {
            log.debug(messageContext.getLogIDString() +
                    " Attempted to check for Operation using target endpoint URI, but the operation fragment was missing");
            return null;
        }
    } else {
        log.debug(messageContext.getLogIDString() +
                " Attempted to check for Operation using null target endpoint URI");
        return null;
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:26,代码来源:RequestURIBasedOperationDispatcher.java

示例8: getWsdlInformation

import org.apache.axis2.addressing.EndpointReference; //导入方法依赖的package包/类
private String getWsdlInformation(String serviceName, AxisConfiguration axisConfig)
        throws AxisFault {
    String ip;
    try {
        ip = NetworkUtils.getLocalHostname();
    } catch (SocketException e) {
        throw new AxisFault("Cannot get local host name", e);
    }
    TransportInDescription http = axisConfig.getTransportIn("http");
    if (http != null) {
        EndpointReference epr =
                ((HttpTransportListener) http.getReceiver()).
                getEPRForService(serviceName, ip);
        String wsdlUrlPrefix = epr.getAddress();
        if (wsdlUrlPrefix.endsWith("/")) {
            wsdlUrlPrefix = wsdlUrlPrefix.substring(0, wsdlUrlPrefix.length() - 1);
        }
        return wsdlUrlPrefix + "?wsdl";
    }
    return null;
}
 
开发者ID:wso2,项目名称:carbon-commons,代码行数:22,代码来源:WSDL2Code.java

示例9: getService

import org.apache.axis2.addressing.EndpointReference; //导入方法依赖的package包/类
/**
 * Find the WS-D target service identified by the given WS-D identifier.
 *
 * @param epr WS-D service identifier
 * @return a TargetService instance with the given ID or null if no such service exists
 * @throws Exception if an error occurs while accessing the registry
 */
public static TargetService getService(EndpointReference epr) throws Exception {
    ServiceManager serviceManager = new ServiceManager(getRegistry());

    String serviceId = epr.getAddress();
    //This part is use to remove the prefix of Service ID
    if(serviceId.startsWith(DiscoveryConstants.EPR_ADDRESS_PREFIX)){
        serviceId = serviceId.replace(DiscoveryConstants.EPR_ADDRESS_PREFIX, "");
    }

    Service service = serviceManager.getService(serviceId);
    if (service == null) {
        return null;
    }

    return getTargetService(service);
}
 
开发者ID:wso2,项目名称:carbon-governance,代码行数:24,代码来源:DiscoveryServiceUtils.java

示例10: getPhoneNumber

import org.apache.axis2.addressing.EndpointReference; //导入方法依赖的package包/类
/**
 * given the EPR it will return the phone number that the EPR represents
 * this assumes a EPR of format
 * sms://<phone_number>/
 *
 * @param epr
 * @return
 */
public static String getPhoneNumber(EndpointReference epr) throws Exception {

    String eprAddress = epr.getAddress();
    String protocal = eprAddress.substring(0, 3);
    if (protocal != null && protocal.equals("sms")) {
        String parts[] = eprAddress.split("/");
        String phoneNumber = parts[2];
        return phoneNumber;
    } else {
        throw new Exception("Invalid Epr for the SMS Transport : Epr must be of format sms://<phone_number>/");
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2-transports,代码行数:21,代码来源:SMSTransportUtils.java

示例11: SimpleAddServiceClient

import org.apache.axis2.addressing.EndpointReference; //导入方法依赖的package包/类
/**
 * Constructor used by the default JUnit test case.
 * 
 * @param target
 * @throws AxisFault
 */
public SimpleAddServiceClient(EndpointReference target) throws AxisFault {
	ConfigurationContext context = 
		ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-classes", "test-resources/axis2.xml");
	serviceStub = new SimpleAddServiceStub(context, target.getAddress());
	//serviceStub = new SimpleAddServiceStub();
	ServiceClient client=  serviceStub._getServiceClient();
	Options options = client.getOptions();
	options.setProperty(Constants.Configuration.MESSAGE_TYPE, "application/soap+fastinfoset");
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:16,代码来源:SimpleAddServiceClient.java

示例12: setupCorrectTransportOut

import org.apache.axis2.addressing.EndpointReference; //导入方法依赖的package包/类
/**
 * Ensure that if the scheme of the To EPR for the response is different than the
 * transport used for the request that the correct TransportOut is available
 */
private static void setupCorrectTransportOut(MessageContext context) throws AxisFault {
    // Determine that we have the correct transport available.
    TransportOutDescription transportOut = context.getTransportOut();

    try {
        EndpointReference responseEPR = context.getTo();
        if (context.isServerSide() && responseEPR != null) {
            if (!responseEPR.hasAnonymousAddress() && !responseEPR.hasNoneAddress()) {
                URI uri = new URI(responseEPR.getAddress());
                String scheme = uri.getScheme();
                if ((transportOut == null) || !transportOut.getName().equals(scheme)) {
                    ConfigurationContext configurationContext =
                            context.getConfigurationContext();
                    transportOut = configurationContext.getAxisConfiguration()
                            .getTransportOut(scheme);
                    if (transportOut == null) {
                        throw new AxisFault("Can not find the transport sender : " + scheme);
                    }
                    context.setTransportOut(transportOut);
                }
                if (context.getOperationContext() != null) {
                    context.getOperationContext().setProperty(
                            Constants.DIFFERENT_EPR, Constants.VALUE_TRUE);
                }
            }
        }
    } catch (URISyntaxException urise) {
        throw AxisFault.makeFault(urise);
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:35,代码来源:MessageContextBuilder.java

示例13: invoke

import org.apache.axis2.addressing.EndpointReference; //导入方法依赖的package包/类
/**
 * Process and SOAP message
 */
public InvocationResponse invoke(MessageContext messageContext) throws AxisFault {

    EndpointReference ref = null;

    // Get id, type and content
    Long id;
    Integer type;
    // 'soap request' must be called first
    if (messageContext.getFLOW() == MessageContext.IN_FLOW) {
        // show soap message inside the 'soap request' pane in the applet
        id = assignMessageId(messageContext);
        type = new Integer(SOAPMonitorConstants.SOAP_MONITOR_REQUEST);
        ref = messageContext.getTo();
    } else if (messageContext.getFLOW() == MessageContext.OUT_FLOW) {
        id = getMessageId(messageContext);
        // show soap message inside the 'soap response' pane in the applet
        type = new Integer(SOAPMonitorConstants.SOAP_MONITOR_RESPONSE);
        ref = messageContext.getFrom();
    } else if (messageContext.getFLOW() == MessageContext.IN_FAULT_FLOW) {
        id = getMessageId(messageContext);
        // show soap message inside the 'soap request' pane in the applet
        type = new Integer(SOAPMonitorConstants.SOAP_MONITOR_REQUEST);
        ref = messageContext.getFaultTo();
    } else if (messageContext.getFLOW() == MessageContext.OUT_FAULT_FLOW) {
        id = getMessageId(messageContext);
        // show soap message inside the 'soap response' pane in the applet
        type = new Integer(SOAPMonitorConstants.SOAP_MONITOR_RESPONSE);
        // TODO - How do I get an EPR on MessageContext.OUT_FAULT_FLOW ?
    } else {
        throw new IllegalStateException("unknown FLOW detected in messageContext: " + messageContext.getFLOW());
    }

    String target = null;
    if (ref != null) {
        target = ref.getAddress();
    }
    // Check for null target
    if (target == null) {
        target = "";
    }

    // Get the SOAP portion of the message
    String soap = null;
    if (messageContext.getEnvelope() != null) {
        soap = messageContext.getEnvelope().toString();
    }
    // If we have an id and a SOAP portion, then send the
    // message to the SOAP monitor service
    if ((id != null) && (soap != null)) {
        SOAPMonitorService.publishMessage(id, type, target, soap);
    }
    return InvocationResponse.CONTINUE;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:57,代码来源:SOAPMonitorHandler.java

示例14: inferInTransport

import org.apache.axis2.addressing.EndpointReference; //导入方法依赖的package包/类
public static TransportInDescription inferInTransport(AxisConfiguration ac,
                                                                   Options options,
                                                                   MessageContext msgCtxt)
        throws AxisFault {
    String listenerTransportProtocol = options.getTransportInProtocol();
    if (listenerTransportProtocol == null) {
        EndpointReference replyTo = msgCtxt.getReplyTo();
        if (replyTo != null) {
            try {
                URI uri = new URI(replyTo.getAddress());
                listenerTransportProtocol = uri.getScheme();
            } catch (URISyntaxException e) {
                //need to ignore
            }
        } else {
            //assume listener transport as sender transport
            if (msgCtxt.getTransportOut() != null) {
                listenerTransportProtocol = msgCtxt.getTransportOut().getName();
            }
        }
    }
    TransportInDescription transportIn = null;
    if (options.isUseSeparateListener() || msgCtxt.getOptions().isUseSeparateListener()) {
        if ((listenerTransportProtocol != null) && !"".equals(listenerTransportProtocol)) {
            transportIn = ac.getTransportIn(listenerTransportProtocol);
            ListenerManager listenerManager =
                    msgCtxt.getConfigurationContext().getListenerManager();
            if (transportIn == null) {
                // TODO : User should not be mandated to give an IN transport. If it is not given, we should
                // ask from the ListenerManager to give any available transport for this client.
                log.error(Messages.getMessage("unknownTransport",
                                                        listenerTransportProtocol));
                throw new AxisFault(Messages.getMessage("unknownTransport",
                                                        listenerTransportProtocol));
            }
            synchronized (ClientUtils.class) {
                if (!listenerManager.isListenerRunning(transportIn.getName())) {
                    listenerManager.addListener(transportIn, false);
                }
            }
        }
        if (msgCtxt.getAxisService() != null) {
            if (!msgCtxt.isEngaged(Constants.MODULE_ADDRESSING)) {
                log.error(Messages.getMessage("2channelNeedAddressing"));
                throw new AxisFault(Messages.getMessage("2channelNeedAddressing"));
            }
        } else {
            if (!ac.isEngaged(Constants.MODULE_ADDRESSING)) {
                log.error(Messages.getMessage("2channelNeedAddressing"));
                throw new AxisFault(Messages.getMessage("2channelNeedAddressing"));
            }
        }
    }

    return transportIn;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:57,代码来源:ClientUtils.java

示例15: processDocument

import org.apache.axis2.addressing.EndpointReference; //导入方法依赖的package包/类
/**
 * @return Returns the document element.
 */
public OMElement processDocument(InputStream inputStream, String contentType,
                                 MessageContext messageContext)
        throws AxisFault {

    MultipleEntryHashMap parameterMap = new MultipleEntryHashMap();
    SOAPFactory soapFactory;
    AxisBindingOperation axisBindingOperation =
            (AxisBindingOperation) messageContext.getProperty(
                    Constants.AXIS_BINDING_OPERATION);
    String queryParameterSeparator = null;
    String templatedPath = null;
    if (axisBindingOperation != null) {
        queryParameterSeparator = (String) axisBindingOperation
                .getProperty(WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR);
        templatedPath =
                (String) axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_LOCATION);
    }
    if (queryParameterSeparator == null) {
        queryParameterSeparator =
                WSDL20DefaultValueHolder.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR_DEFAULT;
    }

    AxisEndpoint axisEndpoint =
            (AxisEndpoint) messageContext.getProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME);
    if (axisEndpoint != null) {
        AxisBinding axisBinding = axisEndpoint.getBinding();
        String soapVersion =
                (String) axisBinding.getProperty(WSDL2Constants.ATTR_WSOAP_VERSION);
        soapFactory = getSOAPFactory(soapVersion);
    } else {
        soapFactory = getSOAPFactory(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
    }
    EndpointReference endpointReference = messageContext.getTo();
    if (endpointReference == null) {
        throw new AxisFault("Cannot create DocumentElement without destination EPR");
    }

    String requestURL = endpointReference.getAddress();
    try {
        requestURL = extractParametersUsingHttpLocation(templatedPath, parameterMap,
                                                        requestURL,
                                                        queryParameterSeparator);
    } catch (UnsupportedEncodingException e) {
        throw AxisFault.makeFault(e);
    }

    String query = requestURL;
    int index;
    if ((index = requestURL.indexOf("?")) > -1) {
        query = requestURL.substring(index + 1);
    }

    extractParametersFromRequest(parameterMap, query, queryParameterSeparator,
                                 (String) messageContext.getProperty(
                                         Constants.Configuration.CHARACTER_SET_ENCODING),
                                 inputStream);

    messageContext.setProperty(Constants.REQUEST_PARAMETER_MAP, parameterMap);
    return BuilderUtil.buildsoapMessage(messageContext, parameterMap,
                                        soapFactory);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:65,代码来源:XFormURLEncodedBuilder.java


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