Package javax.xml.soap

Examples of javax.xml.soap.SOAPConnectionFactory


   private void doTestSoapConnection(boolean disableChunking) throws Exception
   {
      SOAPFactory soapFac = SOAPFactory.newInstance();
      MessageFactory msgFac = MessageFactory.newInstance();
      SOAPConnectionFactory conFac = SOAPConnectionFactory.newInstance();
      SOAPMessage msg = msgFac.createMessage();

      if (disableChunking)
      {
         // this is the custom header checked by ServiceImpl
         msg.getMimeHeaders().addHeader("Transfer-Encoding-Disabled", "true");
         // this is a hint to SOAPConnection that the chunked encoding is not needed
         msg.getMimeHeaders().addHeader("Transfer-Encoding", "disabled");
      }

      QName sayHi = new QName("http://www.jboss.org/jbossws/saaj", "sayHello");
      msg.getSOAPBody().addChildElement(soapFac.createElement(sayHi));
      AttachmentPart ap1 = msg.createAttachmentPart();

      char[] content = new char[16 * 1024];
      Arrays.fill(content, 'A');

      ap1.setContent(new String(content), "text/plain");
      msg.addAttachmentPart(ap1);

      AttachmentPart ap2 = msg.createAttachmentPart();
      ap2.setContent("Attachment content - Part 2", "text/plain");
      msg.addAttachmentPart(ap2);
      msg.saveChanges();

      SOAPConnection con = conFac.createConnection();

      final String serviceURL = "http://" + getServerHost() + ":8080/saaj-soap-connection";

      URL endpoint = new URL(serviceURL);
      SOAPMessage response = con.call(msg, endpoint);
View Full Code Here


     * @return the SOAPconnection object
     * @throws SOAPException
     *             if unable to create connection
     */
    private static SOAPConnection createConnection() throws SOAPException {
        SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory
                .newInstance();
        SOAPConnection connection = soapConnectionFactory.createConnection();
        return connection;
    }
View Full Code Here

         "</env:Envelope>";
     
      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

        Element response = null;
        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

    try {
     
      //Debugging code
      ByteArrayOutputStream outStream = new ByteArrayOutputStream();
      message.writeTo(outStream);
      SOAPConnectionFactory connectionFactory = SOAPConnectionFactory
          .newInstance();
      SOAPConnection connection = connectionFactory.createConnection();

      // this can either be a SOAPException or SOAPMessage
      HttpResponseBean responseBean = new HttpResponseBean();
      Object response;
View Full Code Here

   
    @Test
    public void testSWA() throws Exception {
        SOAPFactory soapFac = SOAPFactory.newInstance();
        MessageFactory msgFac = MessageFactory.newInstance();
        SOAPConnectionFactory conFac = SOAPConnectionFactory.newInstance();
        SOAPMessage msg = msgFac.createMessage();
       
        QName sayHi = new QName("http://apache.org/hello_world_rpclit", "sayHiWAttach");
        msg.getSOAPBody().addChildElement(soapFac.createElement(sayHi));
        AttachmentPart ap1 = msg.createAttachmentPart();
        ap1.setContent("Attachment content", "text/plain");
        msg.addAttachmentPart(ap1);
        AttachmentPart ap2 = msg.createAttachmentPart();
        ap2.setContent("Attachment content - Part 2", "text/plain");
        msg.addAttachmentPart(ap2);
       
        SOAPConnection con = conFac.createConnection();
        URL endpoint = new URL("http://localhost:9008/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit1");
        SOAPMessage response = con.call(msg, endpoint);
        QName sayHiResp = new QName("http://apache.org/hello_world_rpclit", "sayHiResponse");
        assertNotNull(response.getSOAPBody().getChildElements(sayHiResp));
        assertEquals(2, response.countAttachments());
View Full Code Here

import javax.xml.soap.SOAPException;

public class SoapConnectionFactoryImpl extends SOAPConnectionFactory {
   
    private SOAPConnectionFactory getSOAPConnectionFactory() throws SOAPException {
        SOAPConnectionFactory factory =
            (SOAPConnectionFactory) SaajFactoryFinder.find("javax.xml.soap.SOAPConnectionFactory");
        return factory;
       
    }
View Full Code Here

    public AttachmentTest(String name) {
        super(name);
    }
   
    public void testStringAttachment() throws Exception {
      SOAPConnectionFactory scFactory = SOAPConnectionFactory.newInstance();
      SOAPConnection con = scFactory.createConnection();
     
      MessageFactory factory = MessageFactory.newInstance();
      SOAPMessage message = factory.createMessage();
      AttachmentPart attachment = message.createAttachmentPart();
      String stringContent = "Update address for Sunny Skies " +
View Full Code Here

      message.removeAllAttachments();
      assertTrue(message.countAttachments()==0);
    }
   
    public void testMultipleAttachments() throws Exception {
        SOAPConnectionFactory scFactory = SOAPConnectionFactory.newInstance();
        SOAPConnection con = scFactory.createConnection();

        MessageFactory factory = MessageFactory.newInstance();
        SOAPMessage msg = factory.createMessage();
        java.net.URL url1 = new java.net.URL("http://slashdot.org/slashdot.xml");
        java.net.URL url2 = new java.net.URL("http://www.apache.org/LICENSE.txt");
View Full Code Here

        searchUDDI(args[0], args[1]);
    }

    public static void searchUDDI(String name, String url) throws Exception {
        // Create the connection and the message factory.
        SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance();
        SOAPConnection connection = scf.createConnection();
        MessageFactory msgFactory = MessageFactory.newInstance();

        // Create a message
        SOAPMessage msg = msgFactory.createMessage();
View Full Code Here

TOP

Related Classes of javax.xml.soap.SOAPConnectionFactory

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.