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


Java W3CEndpointReference类代码示例

本文整理汇总了Java中javax.xml.ws.wsaddressing.W3CEndpointReference的典型用法代码示例。如果您正苦于以下问题:Java W3CEndpointReference类的具体用法?Java W3CEndpointReference怎么用?Java W3CEndpointReference使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: assertEndpointReference

import javax.xml.ws.wsaddressing.W3CEndpointReference; //导入依赖的package包/类
private void assertEndpointReference(EndpointReference epr) throws Exception
{
   assertEquals(W3CEndpointReference.class.getName(), epr.getClass().getName());
   Element endpointReference = DOMUtils.parse(epr.toString());
   assertEquals("EndpointReference", endpointReference.getNodeName());
   assertEquals("http://www.w3.org/2005/08/addressing", endpointReference.getAttribute("xmlns"));
   NodeList addresses = endpointReference.getElementsByTagName("Address");
   assertEquals(1, addresses.getLength());
   URL eprAddress = new URL(addresses.item(0).getFirstChild().getNodeValue());
   URL ENDPOINT_ADDRESS = new URL(baseURL.toString() + "/jaxws-endpointReference");

   //compare hosts' IPs
   String eprAddressHost = InetAddress.getByName(eprAddress.getHost()).getHostAddress();
   String endpointAddressHost = InetAddress.getByName(ENDPOINT_ADDRESS.getHost()).getHostAddress();
   assertEquals(eprAddressHost, endpointAddressHost);
   assertEquals(ENDPOINT_ADDRESS.toString().replace(ENDPOINT_ADDRESS.getHost(), eprAddress.getHost()), eprAddress.toString());
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:18,代码来源:EndpointReferenceTestCase.java

示例2: testParsedInterfaceName

import javax.xml.ws.wsaddressing.W3CEndpointReference; //导入依赖的package包/类
@Test
public void testParsedInterfaceName() throws Exception
{
   W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder(); 
   builder = builder.address(URL);
   Element element = DOMUtils.parse(XML_INTERFACE_NAME);
   builder = builder.metadata(element);
   builder = builder.serviceName(SERVICE_QNAME);
   builder = builder.endpointName(PORT_QNAME);
   builder = builder.wsdlDocumentLocation(WSDL_URL);
   element = DOMUtils.parse(XML_REF_PARAM1);
   builder = builder.referenceParameter(element);
   element = DOMUtils.parse(XML_REF_PARAM2);
   builder = builder.referenceParameter(element);
   W3CEndpointReference epr = builder.build();
   DOMResult dr = new DOMResult(); 
   epr.writeTo(dr);
   Node endpointReferenceElement = dr.getNode();
   Logger.getLogger(this.getClass()).info(DOMUtils.node2String(endpointReferenceElement));
   assertMetaData(endpointReferenceElement);
   assertRefParam(endpointReferenceElement, PARAM1_QNAME, "Hello");
   assertRefParam(endpointReferenceElement, PARAM2_QNAME, "World");
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:24,代码来源:EndpointReferenceBuilderTestCase.java

示例3: testConstructedInterfaceName

import javax.xml.ws.wsaddressing.W3CEndpointReference; //导入依赖的package包/类
@Test
public void testConstructedInterfaceName() throws Exception
{
   W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder(); 
   builder = builder.address(URL);
   builder = builder.serviceName(SERVICE_QNAME);
   builder = builder.endpointName(PORT_QNAME);
   builder = builder.interfaceName(PORT_TYPE_QNAME);
   builder = builder.wsdlDocumentLocation(WSDL_URL);
   Element element = DOMUtils.parse(XML_REF_PARAM1);
   builder = builder.referenceParameter(element);
   element = DOMUtils.parse(XML_REF_PARAM2);
   builder = builder.referenceParameter(element);
   W3CEndpointReference epr = builder.build();
   DOMResult dr = new DOMResult(); 
   epr.writeTo(dr);
   Node endpointReferenceElement = dr.getNode();
   Logger.getLogger(this.getClass()).info(DOMUtils.node2String(endpointReferenceElement));
   assertMetaData(endpointReferenceElement);
   assertRefParam(endpointReferenceElement, PARAM1_QNAME, "Hello");
   assertRefParam(endpointReferenceElement, PARAM2_QNAME, "World");
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:23,代码来源:EndpointReferenceBuilderTestCase.java

示例4: doGet

import javax.xml.ws.wsaddressing.W3CEndpointReference; //导入依赖的package包/类
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
   {
      // Create the port
//    URL wsdlURL = getServletContext().getResource("/WEB-INF/wsdl/TestService.wsdl");
      URL wsdlURL = new URL("http://" + hostName + ":8082/jaxws-endpoint?wsdl");
      QName qname = new QName("http://org.jboss.ws/jaxws/endpoint", "EndpointService");
      Service service = Service.create(wsdlURL, qname);
      EndpointInterface port = (EndpointInterface)service.getPort(EndpointInterface.class);

      // Invoke the endpoint
      String param = req.getParameter("param");
      String retStr = port.echo(param);
      
      //Test epr
      DocumentBuilder builder = getDocumentBuilder();
      assertEndpointReference(endpoint1.getEndpointReference(DOMUtils.parse(TEST_ELEMENT, builder)), TEST_ELEMENT, builder);
      assertEndpointReference(endpoint1.getEndpointReference(W3CEndpointReference.class, (Element[])null), null, builder);

      // Return the result
      PrintWriter pw = new PrintWriter(res.getWriter());
      pw.print(retStr);
      pw.close();
   }
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:24,代码来源:EndpointServlet.java

示例5: assertEndpointReference

import javax.xml.ws.wsaddressing.W3CEndpointReference; //导入依赖的package包/类
private void assertEndpointReference(EndpointReference epr, String refPar, DocumentBuilder builder) throws IOException
{
   Logger.getLogger(this.getClass()).info("epr: "+epr);
   assert(W3CEndpointReference.class.getName().equals(epr.getClass().getName()));
   Element endpointReference = DOMUtils.parse(epr.toString(), builder);
   assert("EndpointReference".equals(endpointReference.getNodeName()));
   assert("http://www.w3.org/2005/08/addressing".equals(endpointReference.getAttribute("xmlns")));
   NodeList addresses = endpointReference.getElementsByTagName("Address");
   assert(addresses.getLength() == 1);
   assert(("http://" + hostName + ":8082/jaxws-endpoint").equals(addresses.item(0).getFirstChild().getNodeValue()));
   if (refPar != null)
   {
 	 Element refEle = DOMUtils.parse(refPar, builder);
 	 NodeList nodeList = endpointReference.getElementsByTagNameNS(refEle.getNamespaceURI(), refEle.getLocalName());
 	 assert(nodeList.getLength() == 1);
 	 assert(refEle.getTextContent().equals(nodeList.item(0).getTextContent()));   	 
   }
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:19,代码来源:EndpointServlet.java

示例6: registerCallback

import javax.xml.ws.wsaddressing.W3CEndpointReference; //导入依赖的package包/类
@SuppressWarnings("restriction")
@WebMethod
public String registerCallback(
		W3CEndpointReference reference) {

	WebServiceFeature[] wfs = new WebServiceFeature[] {};

	Notifications callback = (Notifications) reference.getPort(
			Notifications.class, wfs);

	System.out.println("Invoking callback object");
	boolean resp = callback.notifyClient(System.currentTimeMillis()
			+ " message from server");
	if (resp) {
		System.out
				.println("Displayed message on the client .... Response from callback object");
	} else {
		System.out
				.println("Did not display message on the client ... Response from callback object");
	}
	return null;
}
 
开发者ID:vdialani,项目名称:CloudComputing,代码行数:23,代码来源:SOAPServiceImpl.java

示例7: JAXWSEndpointReferenceFactoryImpl

import javax.xml.ws.wsaddressing.W3CEndpointReference; //导入依赖的package包/类
/**
 * Constructor
 */
public JAXWSEndpointReferenceFactoryImpl() {
    super();

    try { 
        jaxbContext =(JAXBContext)
          AccessController.doPrivileged(
             new PrivilegedExceptionAction() {
                                            
                 public Object run() throws JAXBException {
                     return JAXBContext.newInstance(W3CEndpointReference.class,
                                                    SubmissionEndpointReference.class);
                 }
             });
    }
    catch (Exception e) {
        throw new WebServiceException(Messages.getMessage("jaxbContextFailure", 
                                                          e.toString()));
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:23,代码来源:JAXWSEndpointReferenceFactoryImpl.java

示例8: test200508ConversionStartingFromAxis2

import javax.xml.ws.wsaddressing.W3CEndpointReference; //导入依赖的package包/类
public void test200508ConversionStartingFromAxis2() throws Exception {
    XMLStreamReader parser =
        XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(EPR200508));
    StAXOMBuilder builder = new StAXOMBuilder(parser);
    OMElement omElement = builder.getDocumentElement();
    
    EndpointReference axis2EPR =
        EndpointReferenceHelper.fromOM(omElement);
    W3CEndpointReference jaxwsEPR =
        (W3CEndpointReference) EndpointReferenceUtils.convertFromAxis2(axis2EPR, Final.WSA_NAMESPACE);
    assertXMLEqual(EPR200508, jaxwsEPR.toString());
 
    EndpointReference axis2Result =
        EndpointReferenceUtils.createAxis2EndpointReference("");
    String addressingNamespace = EndpointReferenceUtils.convertToAxis2(axis2Result, jaxwsEPR);
    OMElement eprElement =
        EndpointReferenceHelper.toOM(OMF, axis2Result, ELEMENT200508, addressingNamespace);
    assertXMLEqual(EPR200508, eprElement.toString());
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:20,代码来源:EndpointReferenceUtilsTests.java

示例9: getTicket

import javax.xml.ws.wsaddressing.W3CEndpointReference; //导入依赖的package包/类
public W3CEndpointReference getTicket() {
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setNamespaceAware(true);
    Element element = null;

    try {
        DocumentBuilder builder = factory.newDocumentBuilder();
        Document document = builder.newDocument();

        element =
                document.createElementNS("http://calculator.jaxws.axis2.apache.org", "TicketId");
        element.appendChild(document.createTextNode("123456789"));
    } catch (ParserConfigurationException pce) {
        // Parser with specified options can't be built
        pce.printStackTrace();
        throw new WebServiceException("Unable to create ticket.", pce);
    }

    return (W3CEndpointReference) getContext().getEndpointReference(element);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:21,代码来源:CalculatorService.java

示例10: getReferenceParameters

import javax.xml.ws.wsaddressing.W3CEndpointReference; //导入依赖的package包/类
/**
 * Get a list of all reference parameters contained in the passed endpoint
 * reference.
 * 
 * @param aEndpointReference
 *            The endpoint reference to retrieve the reference parameters.
 *            May not be <code>null</code>.
 * @return A mutable element list
 */
@SuppressWarnings("unchecked")
public static List<Element> getReferenceParameters(
		final W3CEndpointReference aEndpointReference) {
	try {
		// Get the "referenceParameters" value of the endpoint reference
		final Object aReferenceParameters = s_aFieldReferenceParameters
				.get(aEndpointReference);
		if (aReferenceParameters == null)
			return null;

		// Get the "elements" out of the "referenceParameters" field
		return (List<Element>) s_aFieldElementsElements
				.get(aReferenceParameters);
	} catch (final Throwable t) {
		throw new IllegalStateException(t);
	}
}
 
开发者ID:whummer,项目名称:service-prefetching,代码行数:27,代码来源:W3CEndpointReferenceUtils.java

示例11: createW3CEndpointReference

import javax.xml.ws.wsaddressing.W3CEndpointReference; //导入依赖的package包/类
@Override
public W3CEndpointReference createW3CEndpointReference(final String address,
                                                       final QName serviceName,
                                                       final QName portName,
                                                       final List<Element> metadata,
                                                       final String wsdlDocumentLocation,
                                                       final List<Element> referenceParameters) {

    return (W3CEndpointReference) invoke21Delegate(delegate, createW3CEndpointReference,
        address,
        serviceName,
        portName,
        metadata,
        wsdlDocumentLocation,
        referenceParameters);
}
 
开发者ID:apache,项目名称:tomee,代码行数:17,代码来源:JaxWsProviderWrapper.java

示例12: getEPRJaxbContext

import javax.xml.ws.wsaddressing.W3CEndpointReference; //导入依赖的package包/类
private static JAXBContext getEPRJaxbContext() {
    // EPRs have package and private fields, so we need privilege escalation.
    // this access only fixed, known set of classes, so doing that
    // shouldn't introduce security vulnerability.
    return AccessController.doPrivileged(new PrivilegedAction<JAXBContext>() {
        public JAXBContext run() {
            try {
                return JAXBContext.newInstance(MemberSubmissionEndpointReference.class, W3CEndpointReference.class);
            } catch (JAXBException e) {
                throw new WebServiceException("Error creating JAXBContext for W3CEndpointReference. ", e);
            }
        }
    });
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:ProviderImpl.java

示例13: getEndpointReference

import javax.xml.ws.wsaddressing.W3CEndpointReference; //导入依赖的package包/类
@Override
public final W3CEndpointReference getEndpointReference() {
    if (binding.getBindingID().equals(HTTPBinding.HTTP_BINDING)) {
        throw new java.lang.UnsupportedOperationException(
                    ClientMessages.UNSUPPORTED_OPERATION("BindingProvider.getEndpointReference()", "XML/HTTP Binding", "SOAP11 or SOAP12 Binding"));
    }
    return getEndpointReference(W3CEndpointReference.class);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:Stub.java

示例14: testProbeAndResolve

import javax.xml.ws.wsaddressing.W3CEndpointReference; //导入依赖的package包/类
@Test
@RunAsClient
public void testProbeAndResolve() throws Exception
{
   Bus bus = null;
   try {
      bus = BusFactory.newInstance().createBus();
      WSDiscoveryClient client = new WSDiscoveryClient(bus);
      ProbeType pt = new ProbeType();
      ScopesType scopes = new ScopesType();
      pt.setScopes(scopes);
      final String serverHost = getServerHost().replace("127.0.0.1", "localhost");
      final int serverPort = getServerPort();
      List<ProbeMatchType> pmts = client.probe(pt, TIMEOUT).getProbeMatch();
      assertFalse("There must be some services discovered, check that you have allowed UDP broadcast on port 3072", pmts.isEmpty());
      
      List<ProbeMatchType> pmtsForHost = filterProbeMatchesForHost(pmts, serverHost);
      assertFalse("There must be some services discovered for current host " + serverHost
              + ", found only " + dbgProbeMatchTypeList(pmts), pmtsForHost.isEmpty());
      
      List<ResolveMatchType> rmts = new LinkedList<ResolveMatchType>();
      for (ProbeMatchType pmt : pmtsForHost) {
         W3CEndpointReference epr = pmt.getEndpointReference();
         ResolveMatchType rmt = client.resolve(epr, TIMEOUT);
         assertNotNull("Could not resolve (timeout = " + TIMEOUT  + " ms) reference: " + epr, rmt);
         rmts.add(rmt);
      }
      
      final QName typeName = new QName("http://www.jboss.org/jbossws/ws-extensions/wsdd", "ServiceIface");
      checkResolveMatches(rmts, "http://" + serverHost + ":" + serverPort + "/jaxws-samples-wsdd/WSDDService", typeName);
      checkResolveMatches(rmts, "http://" + serverHost + ":" + serverPort + "/jaxws-samples-wsdd2/WSDDService", typeName);
      checkResolveMatches(rmts, "http://" + serverHost + ":" + serverPort + "/jaxws-samples-wsdd2/AnotherWSDDService", typeName);
      client.close();
   } finally {
      bus.shutdown(true);
   }
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:38,代码来源:WSDiscoveryTestCase.java

示例15: testEmptyMetadataDropped

import javax.xml.ws.wsaddressing.W3CEndpointReference; //导入依赖的package包/类
@Test
@RunAsClient
public void testEmptyMetadataDropped() 
{
   W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
   builder.address("http://bar");
   W3CEndpointReference epr = builder.build();
   StringWriter writer = new StringWriter();
   epr.writeTo(new StreamResult(writer));
   String eprString = writer.toString();
   assertTrue(eprString.contains("EndpointReference"));
   assertTrue(eprString.contains("Address"));
   assertFalse(eprString.contains("Metadata"));
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:15,代码来源:JBWS2942TestCase.java


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