Package javax.xml.ws

Examples of javax.xml.ws.Dispatch.invoke()


       
        // The element that is sent should be <getPriceWithAction>
        // so it will resolve to the getPriceWithAction operation
        // defined in the WSDL.
        JAXBElement<GetPriceType> getPrice = of.createGetPriceWithAction(gpt);
        JAXBElement<GetPriceResponseType> getPriceResponse = (JAXBElement<GetPriceResponseType>) dispatch.invoke(getPrice);
       
        GetPriceResponseType value = getPriceResponse.getValue();
        assertNotNull("The response was null", value);
       
        float price = value.getPrice();
View Full Code Here


        Service svc = Service.create(url, new QName("http://jaxws.axis2.apache.org", "EchoService"));
        Dispatch dispatch = svc.createDispatch(new QName("http://jaxws.axis2.apache.org", "EchoPort"),
                String.class, Mode.PAYLOAD);
       
        try {
            dispatch.invoke("");
           
            // If an exception wasn't thrown, then it's an error.
            fail();
        } catch (WebServiceException e) {
            // We should only get a WebServiceException here.  Anything else
View Full Code Here

       
        // The element that is sent should be <getPriceWithAction>
        // so it will resolve to the getPriceWithAction operation
        // defined in the WSDL.
        JAXBElement<GetPriceType> getPrice = of.createGetPriceWithAction(gpt);
        JAXBElement<GetPriceResponseType> getPriceResponse = (JAXBElement<GetPriceResponseType>) dispatch.invoke(getPrice);
       
        GetPriceResponseType value = getPriceResponse.getValue();
        assertNotNull("The response was null", value);
       
        float price = value.getPrice();
View Full Code Here

        Service svc = Service.create(url, new QName("http://jaxws.axis2.apache.org", "EchoService"));
        Dispatch dispatch = svc.createDispatch(new QName("http://jaxws.axis2.apache.org", "EchoPort"),
                String.class, Mode.PAYLOAD);
       
        try {
            dispatch.invoke("");
           
            // If an exception wasn't thrown, then it's an error.
            fail();
        } catch (WebServiceException e) {
            // We should only get a WebServiceException here.  Anything else
View Full Code Here

        Service svc = Service.create(url, new QName("http://jaxws.axis2.apache.org", "EchoService"));
        Dispatch dispatch = svc.createDispatch(new QName("http://jaxws.axis2.apache.org", "EchoPort"),
                String.class, Mode.PAYLOAD);
       
        try {
            dispatch.invoke("");
           
            // If an exception wasn't thrown, then it's an error.
            fail();
        } catch (WebServiceException e) {
            // We should only get a WebServiceException here.  Anything else
View Full Code Here

      Service service = Service.create(wsdlURL, serviceName);
      JAXBContext jbc = JAXBContext.newInstance(new Class[] { SubmitBareRequest.class, SubmitBareResponse.class });
      Dispatch dispatch = service.createDispatch(portName, jbc, Mode.PAYLOAD);

      SubmitBareRequest poReq = new SubmitBareRequest("Ferrari");
      SubmitBareResponse poRes = (SubmitBareResponse)dispatch.invoke(poReq);
      assertEquals("Ferrari", poRes.getProduct());
   }

   public void testDocBareServiceMessageAccess() throws Exception
   {
View Full Code Here

      "  </ns1:SubmitPO>" +
      " </env:Body>" +
      "</env:Envelope>";

      SOAPMessage reqMsg = MessageFactory.newInstance().createMessage(null, new ByteArrayInputStream(reqEnv.getBytes()));
      SOAPMessage resMsg = (SOAPMessage)dispatch.invoke(reqMsg);

      QName qname = new QName(targetNS, "SubmitPOResponse");
      SOAPElement soapElement = (SOAPElement)resMsg.getSOAPBody().getChildElements(qname).next();
      soapElement = (SOAPElement)soapElement.getChildElements(new QName(targetNS, "product")).next();
      assertEquals("Ferrari", soapElement.getValue());
View Full Code Here

      "  </ns1:SubmitNamespacedPO>" +
      " </env:Body>" +
      "</env:Envelope>";

      SOAPMessage reqMsg = MessageFactory.newInstance().createMessage(null, new ByteArrayInputStream(reqEnv.getBytes()));
      SOAPMessage resMsg = (SOAPMessage)dispatch.invoke(reqMsg);

      QName qname = new QName(resultNamespace, "SubmitBareResponse");
      SOAPElement soapElement = (SOAPElement)resMsg.getSOAPBody().getChildElements(qname).next();
      soapElement = (SOAPElement)soapElement.getChildElements(new QName(targetNS, "product")).next();
      assertEquals("Ferrari", soapElement.getValue());
View Full Code Here

      QName serviceName = new QName(targetNS, "DocWrappedService");
      QName portName = new QName(targetNS, "DocWrappedPort");
      Service service = Service.create(wsdlURL, serviceName);
      Dispatch dispatch = service.createDispatch(portName, SOAPMessage.class, Mode.MESSAGE);

      SOAPMessage resMsg = (SOAPMessage) dispatch.invoke(reqMsg);

      QName qname = new QName(targetNS, "SubmitPOResponse");
      SOAPElement soapElement = (SOAPElement)resMsg.getSOAPBody().getChildElements(qname).next();
      soapElement = (SOAPElement)soapElement.getChildElements(new QName("PurchaseOrderAck")).next();
      assertEquals("Ferrari", soapElement.getValue());
View Full Code Here

      String payload = "<ns1:ping xmlns:ns1='http://oneway.samples.jaxws.ws.test.jboss.org/'/>";
      dispatch.invokeOneWay(new StreamSource(new StringReader(payload)));

      payload = "<ns1:feedback xmlns:ns1='http://oneway.samples.jaxws.ws.test.jboss.org/'/>";
      Source retObj = (Source)dispatch.invoke(new StreamSource(new StringReader(payload)));
     
      Element docElement = DOMUtils.sourceToElement(retObj);
      Element retElement = DOMUtils.getFirstChildElement(docElement);
      String retPayload = DOMWriter.printNode(retElement, false);
      assertEquals("<return>result: ok</return>", retPayload);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.