Java 类javax.xml.ws.wsaddressing.W3CEndpointReference 实例源码

项目:jbossws-cxf    文件:EndpointReferenceTestCase.java   
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());
}
项目:jbossws-cxf    文件:EndpointReferenceBuilderTestCase.java   
@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");
}
项目:jbossws-cxf    文件:EndpointReferenceBuilderTestCase.java   
@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");
}
项目:jbossws-cxf    文件:EndpointServlet.java   
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();
   }
项目:jbossws-cxf    文件:EndpointServlet.java   
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()));      
   }
}
项目:CloudComputing    文件:SOAPServiceImpl.java   
@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;
}
项目:wso2-axis2    文件:JAXWSEndpointReferenceFactoryImpl.java   
/**
 * 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()));
    }
}
项目:wso2-axis2    文件:EndpointReferenceUtilsTests.java   
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());
}
项目:wso2-axis2    文件:CalculatorService.java   
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);
}
项目:service-prefetching    文件:W3CEndpointReferenceUtils.java   
/**
 * 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);
    }
}
项目:tomee    文件:JaxWsProviderWrapper.java   
@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);
}
项目:OpenJSharp    文件:ProviderImpl.java   
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);
            }
        }
    });
}
项目:OpenJSharp    文件:Stub.java   
@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);
}
项目:openjdk-jdk10    文件:ProviderImpl.java   
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);
            }
        }
    });
}
项目:openjdk-jdk10    文件:Stub.java   
@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);
}
项目:openjdk9    文件:ProviderImpl.java   
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);
            }
        }
    });
}
项目:openjdk9    文件:Stub.java   
@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);
}
项目:lookaside_java-1.8.0-openjdk    文件:ProviderImpl.java   
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);
            }
        }
    });
}
项目:lookaside_java-1.8.0-openjdk    文件:Stub.java   
@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);
}
项目:jbossws-cxf    文件:WSDiscoveryTestCase.java   
@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);
   }
}
项目:jbossws-cxf    文件:JBWS2942TestCase.java   
@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"));
}
项目:jbossws-cxf    文件:EndpointReferenceTestCase.java   
private void validateEndpointReferences(final BindingProvider bp) throws Exception
{
   assertEndpointReference(bp.getEndpointReference());
   assertEndpointReference(bp.getEndpointReference(W3CEndpointReference.class));
   try
   {
      bp.getEndpointReference(MyEndpointReference.class);
      fail("WebServiceException expected");
   }
   catch (WebServiceException e)
   {
      //NOP: the provided EndpointReference is not supported by the implementation
   }
   catch (Throwable t)
   {
      fail("WebServiceException expected, got " + t);
   }

   Endpoint port = bp.getEndpointReference().getPort(Endpoint.class);
   assertNotNull(port);
   String retObj = port.echo("Hello");
   assertEquals("Hello", retObj);

   port = bp.getEndpointReference(W3CEndpointReference.class).getPort(Endpoint.class);
   assertNotNull(port);
   retObj = port.echo("Hello");
   assertEquals("Hello", retObj);
}
项目:infobip-open-jdk-8    文件:ProviderImpl.java   
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);
            }
        }
    });
}
项目:infobip-open-jdk-8    文件:Stub.java   
@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);
}
项目:iis    文件:WebServiceMDStoreFacade.java   
@Override
public Iterable<String> deliverMDRecords(String mdStoreId) throws ServiceFacadeException {
    try {
        W3CEndpointReference eprResult = getService().deliverMDRecords(mdStoreId, null, null, null);
        ResultSetClientFactory rsFactory = new ResultSetClientFactory(
                getResultSetPageSize(), getResultSetReadTimeout(), getResultSetConnectionTimeout());
        rsFactory.setServiceResolver(new JaxwsServiceResolverImpl());
        return rsFactory.getClient(eprResult);
    } catch (MDStoreServiceException e) {
        throw new ServiceFacadeException("delivering records for md store " + mdStoreId + " failed!", e);
    }
}
项目:iis    文件:WebServiceObjectStoreFacade.java   
@Override
public Iterable<String> deliverObjects(String objectStoreId, long from, long until) throws ServiceFacadeException {
    try {
        W3CEndpointReference eprResult = getService().deliverObjects(objectStoreId, from, until);
        ResultSetClientFactory rsFactory = new ResultSetClientFactory(
                getResultSetPageSize(), getResultSetReadTimeout(), getResultSetConnectionTimeout());
        rsFactory.setServiceResolver(new JaxwsServiceResolverImpl());
        return rsFactory.getClient(eprResult);
    } catch (ObjectStoreServiceException e) {
        throw new ServiceFacadeException("delivering records for object store " + objectStoreId + " failed!", e);
    }
}
项目:WS-Nu    文件:AbstractNotificationProducer.java   
/**
 * Will try to send the {@link org.oasis_open.docs.wsn.b_2.Notify} to the
 * {@link javax.xml.ws.wsaddressing.W3CEndpointReference} indicated.
 *
 * @param notify               the {@link org.oasis_open.docs.wsn.b_2.Notify} to send
 * @param w3CEndpointReference the reference of the receiving endpoint
 * @throws IllegalAccessException
 */
@WebMethod(exclude = true)
public void sendSingleNotify(Notify notify, W3CEndpointReference w3CEndpointReference) {
    if (hub == null) {
        Log.e("AbstractNotificationProducer", "Tried to send message with hub null. If a quickBuild is available," +
                " consider running this before sending messages");
        return;
    }

    Log.d("AbstractNotificationProducer", "Was told to send single notify to a target");
    InternalMessage outMessage = new InternalMessage(STATUS_OK | STATUS_HAS_MESSAGE | STATUS_ENDPOINTREF_IS_SET, notify);
    outMessage.getRequestInformation().setEndpointReference(ServiceUtilities.getAddress(w3CEndpointReference));
    Log.d("AbstractNotificationProducer", "Forwarding Notify");
    hub.acceptLocalMessage(outMessage);
}
项目:OLD-OpenJDK8    文件:ProviderImpl.java   
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);
            }
        }
    });
}
项目:OLD-OpenJDK8    文件:Stub.java   
@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);
}
项目:wso2-axis2    文件:JAXWSEndpointReferenceFactoryImpl.java   
public <T extends EndpointReference> String getAddressingNamespace(Class<T> clazz) {
    String addressingNamespace = null;

    if (W3CEndpointReference.class.isAssignableFrom(clazz)) {
        addressingNamespace = Final.WSA_NAMESPACE;
    } else if (SubmissionEndpointReference.class.isAssignableFrom(clazz)) {
        addressingNamespace = Submission.WSA_NAMESPACE;
    } else  {
        throw ExceptionFactory.makeWebServiceException(Messages.getMessage("unknownClassType", 
                                                       clazz.toString()));
    }

    return addressingNamespace;
}
项目:wso2-axis2    文件:AddSEIClient.java   
/**
 * @param args
 */
public static void main(String[] args) {
    long start = System.currentTimeMillis();

    try {
        //Validate input
        if (args.length != 2)
            throw new IllegalArgumentException("Usage: java AddClient <integer 1> <integer 2>");

        int value0 = Integer.parseInt(args[0]);
        int value1 = Integer.parseInt(args[1]);

        //Retrieve ticket
        CalculatorService service = new CalculatorService();
        Calculator port1 = service.getCalculatorServicePort();
        W3CEndpointReference epr = port1.getTicket();

        //Add numbers
        Calculator port2 = epr.getPort(Calculator.class, new AddressingFeature());
        int answer = port2.add(value0, value1);
        System.out.println("The answer is: " + answer);
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    finally {
        long end = System.currentTimeMillis();
        long time = end - start;
        System.out.println("Time: " + time + " ms.");
    }
}
项目:service-prefetching    文件:W3CEndpointReferenceUtils.java   
/**
 * Get the address contained in the passed endpoint reference.
 * 
 * @param aEndpointReference
 *            The endpoint reference to retrieve the address from. May not
 *            be <code>null</code>.
 * @return The contained address.
 */
public static String getAddress(
        final W3CEndpointReference aEndpointReference) {
    try {
        // Get the "address" value of the endpoint reference
        final Object aAddress = s_aFieldAddress.get(aEndpointReference);
        if (aAddress == null)
            return null;

        // Get the "uri" out of the "address" field
        return (String) s_aFieldAddressURI.get(aAddress);
    } catch (final Throwable t) {
        throw new IllegalStateException(t);
    }
}
项目:service-prefetching    文件:WSClient.java   
public static SOAPEnvelope invokePOST(W3CEndpointReference epr, 
        SOAPEnvelope request) throws IOException {
    if(cachedResponseObject != null) {
        return cachedResponseObject; // TODO
    }

    String endpointURL = W3CEndpointReferenceUtils.getAddress(epr);
    URL url = new URL(endpointURL);
    URLConnection conn = url.openConnection();
    conn.setDoOutput(true);
    String theRequest = toString(request);
    //System.out.println("sending request: " + theRequest);
    conn.setRequestProperty("Content-Type", "text/xml");
    BufferedWriter w = new BufferedWriter(new OutputStreamWriter(conn.getOutputStream()));
    theRequest = theRequest.trim();
    w.write(theRequest);
    w.close();
    BufferedReader r = new BufferedReader(new InputStreamReader(conn.getInputStream()));
    StringBuilder b = new StringBuilder();
    String temp;
    while((temp = r.readLine()) != null) {
        b.append(temp);
        b.append("\n");
    }
    String originalResult = b.toString();
    String result = originalResult.trim();
    try {
        Element resultElement = toElement(result);
        SOAPEnvelope env = toEnvelope(resultElement);
        return env;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
项目:openjdk-icedtea7    文件:ProviderImpl.java   
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);
            }
        }
    });
}
项目:tomee    文件:EjbMessageContext.java   
public <T extends EndpointReference> T getEndpointReference(Class<T> clazz, Element... referenceParameters) {
    if (W3CEndpointReference.class.isAssignableFrom(clazz)) {
        return clazz.cast(getEndpointReference(referenceParameters));
    } else {
        throw new WebServiceException("Endpoint reference type not supported: " + clazz);
    }
}
项目:tomee    文件:JaxWsProviderWrapperTest.java   
@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 null;
}
项目:tomee    文件:ProviderWrapper.java   
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);
}
项目:onvifjava    文件:ObjectFactory.java   
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link W3CEndpointReference }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "http://docs.oasis-open.org/wsn/b-2", name = "ConsumerReference")
public JAXBElement<W3CEndpointReference> createConsumerReference(W3CEndpointReference value) {
    return new JAXBElement<W3CEndpointReference>(_ConsumerReference_QNAME, W3CEndpointReference.class, null, value);
}
项目:onvifjava    文件:ObjectFactory.java   
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link W3CEndpointReference }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "http://docs.oasis-open.org/wsn/b-2", name = "ProducerReference")
public JAXBElement<W3CEndpointReference> createProducerReference(W3CEndpointReference value) {
    return new JAXBElement<W3CEndpointReference>(_ProducerReference_QNAME, W3CEndpointReference.class, null, value);
}
项目:onvifjava    文件:ObjectFactory.java   
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link W3CEndpointReference }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "http://docs.oasis-open.org/wsn/b-2", name = "SubscriptionReference")
public JAXBElement<W3CEndpointReference> createSubscriptionReference(W3CEndpointReference value) {
    return new JAXBElement<W3CEndpointReference>(_SubscriptionReference_QNAME, W3CEndpointReference.class, null, value);
}