Package javax.xml.soap

Examples of javax.xml.soap.SOAPConnectionFactory


     @return True if sent and compared.
     */
    public boolean echoUsingSAAJ(String filename) throws Exception {
        String endPointURLString =  "http://localhost:" +opts.getPort() + "/axis/services/urn:EchoAttachmentsService";

        SOAPConnectionFactory soapConnectionFactory =
                javax.xml.soap.SOAPConnectionFactory.newInstance();
        SOAPConnection soapConnection =
                soapConnectionFactory.createConnection();

        MessageFactory messageFactory =
                MessageFactory.newInstance();
        SOAPMessage soapMessage =
                messageFactory.createMessage();
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);
        msg.saveChanges();
       
        SOAPConnection con = conFac.createConnection();
        URL endpoint = new URL("http://localhost:" + PORT
                               + "/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit1");
        SOAPMessage response = con.call(msg, endpoint);
        QName sayHiResp = new QName("http://apache.org/hello_world_rpclit", "sayHiResponse");
        assertNotNull(response.getSOAPBody().getChildElements(sayHiResp));
View Full Code Here

    public TestAttachment(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

        //smsg.writeTo(System.out);
        assertTrue(se != null);
    }

    private SOAPEnvelope getSOAPEnvelope() throws Exception {
        SOAPConnectionFactory scFactory = SOAPConnectionFactory.newInstance();
        SOAPConnection con = scFactory.createConnection();

        MessageFactory factory = MessageFactory.newInstance();
        SOAPMessage message = factory.createMessage();
        SOAPEnvelope envelope = message.getSOAPPart().getEnvelope();
        return envelope;
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

      DocumentBuilder builder = getDocumentBuilder();
      Document doc = builder.parse(new ByteArrayInputStream(MessageTestService.request.getBytes()));
      reqMsg.getSOAPBody().addDocument(doc);

      SOAPConnectionFactory conFactory = SOAPConnectionFactory.newInstance();
      SOAPConnection con = conFactory.createConnection();
      SOAPMessage resMsg = con.call(reqMsg, new URL(TARGET_ENDPOINT));

      SOAPBody soapBody = resMsg.getSOAPBody();
      SOAPElement soapElement = (SOAPElement)soapBody.getChildElements().next();
View Full Code Here

      DocumentBuilder builder = getDocumentBuilder();
      Document doc = builder.parse(new ByteArrayInputStream(MessageTestService.request.getBytes()));
      reqMsg.getSOAPBody().addDocument(doc);

      SOAPConnectionFactory conFactory = SOAPConnectionFactory.newInstance();
      SOAPConnection con = conFactory.createConnection();
      SOAPMessage resMsg = con.call(reqMsg, new URL(TARGET_ENDPOINT));

      SOAPBody soapBody = resMsg.getSOAPBody();
      SOAPElement soapElement = (SOAPElement)soapBody.getChildElements().next();
View Full Code Here

   /** Send the message and validate the result
    */
   private void sendAndValidateMimeMessage(String rpcMethodName, SOAPMessage msg, long count) throws SOAPException, MalformedURLException
   {
      SOAPConnectionFactory conFactory = SOAPConnectionFactory.newInstance();
      SOAPConnection con = conFactory.createConnection();
      SOAPMessage resMessage = con.call(msg, new URL("http://" + getServerHost() + ":8080/jaxrpc-jbws801"));
      SOAPBody soapBody = resMessage.getSOAPBody();
      SOAPEnvelope soapEnvelope = (SOAPEnvelope)soapBody.getParentElement();

      Name rpcName = soapEnvelope.createName(rpcMethodName + "Response", NS_PREFIX, NS_URI);
View Full Code Here

   public void testCall() throws Exception
   {
      MessageFactory msgFactory = MessageFactory.newInstance();
      SOAPMessage soapMessage = msgFactory.createMessage(null, new ByteArrayInputStream(getMessage().getBytes()));

      SOAPConnectionFactory conFactory = SOAPConnectionFactory.newInstance();
      SOAPConnection con = conFactory.createConnection();
      SOAPMessage resMessage = con.call(soapMessage, getEndpointAddress());

      SOAPElement soapElement = (SOAPElement)resMessage.getSOAPBody().getChildElements().next();
      assertEquals("echoMessageResponse", soapElement.getElementName().getLocalName());
   }
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.