Package javax.xml.soap

Examples of javax.xml.soap.SOAPConnection


      MessageFactory factory = MessageFactory.newInstance();
      MimeHeaders mimeHeaders = new MimeHeaders();
      mimeHeaders.addHeader("Content-Type", "text/xml; charset=UTF-8");
      SOAPMessage reqMsg = factory.createMessage(mimeHeaders, new ByteArrayInputStream(reqEnv.getBytes("UTF-8")));

      SOAPConnection con = SOAPConnectionFactory.newInstance().createConnection();
      String targetAddress = "http://" + getServerHost() + ":8080/jaxrpc-jbws812";
      SOAPMessage resMsg = con.call(reqMsg, targetAddress);
     
      SOAPEnvelope resEnv = resMsg.getSOAPPart().getEnvelope();
      Name name = resEnv.createName("echoSimpleResponse", "ns1", "http://org.jboss.test.ws/jbws812");
      SOAPElement soapElement = (SOAPElement)resMsg.getSOAPBody().getChildElements(name).next();
      soapElement = (SOAPElement)soapElement.getChildElements(resEnv.createName("result")).next();
View Full Code Here


    */
   public void testSOAPConnectionGet() throws Exception
   {
      URL servletURL = new URL("http://" + getServerHost() + ":8080" + "/jaxrpc-jbws1093/ServletTest?type=soapMessage");

      SOAPConnection con = SOAPConnectionFactory.newInstance().createConnection();
      SOAPMessage resMessage = con.get(servletURL);
      SOAPEnvelope env = resMessage.getSOAPPart().getEnvelope();

      String envStr = DOMWriter.printNode(env, false);
      String expStr = "<ztrade:GetLastTradePriceResponse xmlns:ztrade='http://wombat.ztrade.com'><Price>95.12</Price></ztrade:GetLastTradePriceResponse>";
      assertTrue(envStr.contains(expStr));
View Full Code Here

     
      MessageFactory msgFactory = MessageFactory.newInstance();
      SOAPMessage soapMessage = msgFactory.createMessage(null, new ByteArrayInputStream(reqEnv.getBytes()));
     
      SOAPConnectionFactory conFactory = SOAPConnectionFactory.newInstance();
      SOAPConnection con = conFactory.createConnection();
      SOAPMessage resMessage = con.call(soapMessage, "http://" + getServerHost() + ":8080/jaxrpc-jbws1125");
      SOAPElement soapElement = (SOAPElement)resMessage.getSOAPBody().getChildElements().next();
      assertEquals("noParamPartResponse", soapElement.getElementName().getLocalName());
     
   }
View Full Code Here

         "  </ns1:echo>" +
         " </env:Body>" +
         "</env:Envelope>";
     
      SOAPMessage reqMessage = factory.createMessage(null, new ByteArrayInputStream(reqStr.getBytes()));
      SOAPConnection con = SOAPConnectionFactory.newInstance().createConnection();
      SOAPMessage resMessage = con.call(reqMessage, "http://" + getServerHost() + ":8080/jaxrpc-jbws1186");
      SOAPElement soapElement = (SOAPElement)resMessage.getSOAPBody().getChildElements().next();
      soapElement = (SOAPElement)soapElement.getChildElements().next();
      assertEquals("1", soapElement.getAttribute("xsi:nil"));
   }
View Full Code Here

   private SOAPMessage sendMessage(final String message) throws SOAPException, IOException
   {
      MessageFactory msgFactory = MessageFactory.newInstance();
      SOAPMessage reqMsg = msgFactory.createMessage(null, new ByteArrayInputStream(message.getBytes()));

      SOAPConnection con = SOAPConnectionFactory.newInstance().createConnection();
      SOAPMessage resMsg = con.call(reqMsg, TARGET_ENDPOINT_ADDRESS);

      return resMsg;
   }
View Full Code Here

        try
        {
           SOAPMessage message = this.createSOAPMessage(request);
           //Make the SAAJ Call now
           SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
           SOAPConnection connection = soapConnectionFactory.createConnection();
           SOAPMessage soapResponse = connection.call(message, endpointURL.toURL());
          
           SOAPBody soapBody = soapResponse.getSOAPBody();
           boolean hasFault = soapBody.hasFault();
           if(hasFault)
           {
View Full Code Here

   }

   public void testNamespacedDocWrappedServiceMessageAccess() throws Exception
   {
      MessageFactory msgFactory = MessageFactory.newInstance();
      SOAPConnection con = SOAPConnectionFactory.newInstance().createConnection();

      String purchaseNamespace = "http://namespace/purchase";
      String resultNamespace = "http://namespace/result";
      String stringNamespace = "http://namespace/string";

      String reqEnv =
      "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
      " <env:Header/>" +
      " <env:Body>" +
      "  <ns1:SubmitNamespacedPO xmlns:ns1='" + targetNS + "'>" +
      "   <ns2:NamespacedPurchaseOrder xmlns:ns2='" + purchaseNamespace + "'>Ferrari</ns2:NamespacedPurchaseOrder>" +
      "   <ns3:NamespacedString xmlns:ns3='" + stringNamespace + "'>message</ns3:NamespacedString>" +
      "  </ns1:SubmitNamespacedPO>" +
      " </env:Body>" +
      "</env:Envelope>";
      SOAPMessage reqMsg = msgFactory.createMessage(null, new ByteArrayInputStream(reqEnv.getBytes()));
      URL epURL = new URL("http://" + getServerHost() + ":8080/jaxws-samples-soapbinding/DocWrappedService");

      SOAPMessage resMsg = con.call(reqMsg, epURL);

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

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

      MessageFactory msgFactory = MessageFactory.newInstance();
      SOAPConnection con = SOAPConnectionFactory.newInstance().createConnection();
      SOAPMessage reqMsg = msgFactory.createMessage(null, new ByteArrayInputStream(reqString.getBytes()));

      URL epURL = new URL("http://" + getServerHost() + ":8080/jaxws-samples-provider-jaxb/ProviderEndpoint");
      SOAPMessage resMsg = con.call(reqMsg, epURL);
      SOAPEnvelope resEnv = resMsg.getSOAPPart().getEnvelope();

      Element child = (Element)resEnv.getBody().getChildElements().next();
      JAXBContext jc = JAXBContext.newInstance(new Class[]{UserType.class});
      UserType user = (UserType)jc.createUnmarshaller().unmarshal(new DOMSource(child));
View Full Code Here

         "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
         "  <env:Body>" + reqString + "</env:Body>" +
         "</env:Envelope>";

      MessageFactory msgFactory = MessageFactory.newInstance();
      SOAPConnection con = SOAPConnectionFactory.newInstance().createConnection();
      SOAPMessage reqMsg = msgFactory.createMessage(null, new ByteArrayInputStream(reqEnvStr.getBytes()));

      URL epURL = new URL("http://" + getServerHost() + ":8080/jaxws-samples-provider-payload");
      SOAPMessage resMsg = con.call(reqMsg, epURL);
      SOAPEnvelope resEnv = resMsg.getSOAPPart().getEnvelope();

      SOAPHeader soapHeader = resEnv.getHeader();
      if (soapHeader != null)
         soapHeader.detachNode();
View Full Code Here

   }

   public void testMessageAccess() throws Exception
   {
      MessageFactory msgFactory = MessageFactory.newInstance();
      SOAPConnection con = SOAPConnectionFactory.newInstance().createConnection();

      String reqEnv =
      "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
      " <env:Header/>" +
      " <env:Body>" +
      "  <ns1:locateCustomer xmlns:ns1='" + targetNS + "'>" +
      "   <FirstName>Mickey</FirstName>" +
      "   <LastName>Mouse</LastName>" +
      "   <Address>" +
      "     <address>Wall Street</address>" +
      "   </Address>" +
      "  </ns1:locateCustomer>" +
      " </env:Body>" +
      "</env:Envelope>";
      SOAPMessage reqMsg = msgFactory.createMessage(null, new ByteArrayInputStream(reqEnv.getBytes()));

      URL epURL = new URL("http://" + getServerHost() + ":8080/jaxws-samples-webresult");

      SOAPMessage resMsg = con.call(reqMsg, epURL);

      QName qname = new QName(targetNS, "locateCustomerResponse");
      SOAPElement soapElement = (SOAPElement)resMsg.getSOAPBody().getChildElements(qname).next();
      soapElement = (SOAPElement)soapElement.getChildElements(new QName("CustomerRecord")).next();
      assertNotNull("Expected CustomerRecord", soapElement);
View Full Code Here

TOP

Related Classes of javax.xml.soap.SOAPConnection

Copyright © 2018 www.massapicom. 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.