Package javax.xml.soap

Examples of javax.xml.soap.SOAPConnection


   public void testSOAPConnection() throws Exception
   {
      SOAPMessage reqMsg = getRequestMessage();
      URL epURL = new URL(TARGET_ENDPOINT_ADDRESS);
      SOAPConnection con = SOAPConnectionFactory.newInstance().createConnection();
      SOAPMessage resMsg = con.call(reqMsg, epURL);
      SOAPEnvelope resEnv = resMsg.getSOAPPart().getEnvelope();

      String response = "";

      SOAPBody body = resEnv.getBody();
View Full Code Here


         "  </ns1:echoString>" +
         " </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-jbws1188");
      SOAPElement soapElement = (SOAPElement)resMessage.getSOAPBody().getChildElements().next();
      soapElement = (SOAPElement)soapElement.getChildElements().next();
      assertEquals("Hello Jimbo!", soapElement.getValue());
   }
View Full Code Here

         "  </ns1:echoString>" +
         " </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-jbws1188");
      SOAPElement soapElement = (SOAPElement)resMessage.getSOAPBody().getChildElements().next();
      soapElement = (SOAPElement)soapElement.getChildElements().next();
      assertEquals("Hello Jimbo!", soapElement.getValue());
   }
View Full Code Here

   public void testProviderMessage() throws Exception
   {
      SOAPMessage reqMsg = getRequestMessage();
      URL epURL = new URL(TARGET_ENDPOINT_ADDRESS);
      SOAPConnection con = SOAPConnectionFactory.newInstance().createConnection();
      SOAPMessage resMsg = con.call(reqMsg, epURL);
      SOAPEnvelope resEnv = resMsg.getSOAPPart().getEnvelope();
      Detail detail = resEnv.getBody().getFault().getDetail();
      assertNotNull(detail);
      SOAPElement exception = (SOAPElement)detail.getDetailEntries().next();
      assertNotNull(exception);
View Full Code Here

            // Create a url endpoint for the recipient of the message.
            URL urlEndpoint = new URL("http://localhost:8080/ReceivingSOAP11Servlet");

            // Send the message to the endpoint using the connection.
            SOAPConnection con = new SOAPConnectionImpl();
            SOAPMessage replymsg = con.call(msg, urlEndpoint);

            // Check if reply message
            if (!validateReplyMessage(replymsg, 1)) {
                //Reply message is correct
            } else {
View Full Code Here

      body.addDocument( JaxpUtils.toDocument( request.toString(  ) ) );
      SOAPHeader header = soapRequestMsg.getSOAPHeader(  );
      addWSAHeaders( header,
                     endpointUrl.toString(  ) );

      SOAPConnection soapConn        = SOAPConnectionFactory.newInstance(  ).createConnection(  );
      SOAPMessage    soapResponseMsg = soapConn.call( soapRequestMsg,
                                                      endpointUrl.toString(  ) );
      Iterator       propElemsIter =
         soapResponseMsg.getSOAPPart(  ).getEnvelope(  ).getBody(  ).getChildElements(  );
      List           propElemsList = toList( propElemsIter );
      SOAPElement[]  soapElemArray = (SOAPElement[]) propElemsList.toArray( new SOAPElement[0] );
View Full Code Here

                                                                          ResourceProperties11Constants.NSPREFIX_WSRP,
                                                                          ResourceProperties11Constants.NSURI_WSRP ) );
      requestElem.addNamespaceDeclaration( propQName.getPrefix(  ),
                                           propQName.getNamespaceURI(  ) );
      SaajUtils.addTextNode( requestElem, propQName.getPrefix(  ) + ":" + propQName.getLocalPart(  ) );
      SOAPConnection soapConn        = SOAPConnectionFactory.newInstance(  ).createConnection(  );
      SOAPMessage    soapResponseMsg = soapConn.call( soapRequestMsg,
                                                      m_endpointRef.getAddress(  ).toString(  ) );
      Iterator       propElemsIter =
         soapResponseMsg.getSOAPPart(  ).getEnvelope(  ).getBody(  ).getChildElements(  );
      List           propElemsList = toList( propElemsIter );
      return (SOAPElement[]) propElemsList.toArray( new SOAPElement[0] );
View Full Code Here

      LOG.debug( MSG.getMessage( Keys.EMITTING_TO_HTTP_DEST,
                                 getDestinationUrl(  ) ) );

      try
      {
         SOAPConnection soapConn = SOAPConnectionFactory.newInstance(  ).createConnection(  );
         SOAPMessage    response = soapConn.call( getNotification(  ),
                                                  getDestinationUrl(  ).toString(  ) );
         LOG.debug( MSG.getMessage( Keys.RESPONSE_TO_EMIT,
                                    response.toString(  ) ) );
      }
      catch ( SOAPException e )
View Full Code Here

    public void setMarshaler(SaajMarshaler marshaler) {
        this.marshaler = marshaler;
    }

    protected boolean transform(MessageExchange exchange, NormalizedMessage in, NormalizedMessage out) throws Exception {
        SOAPConnection connection = getConnectionFactory().createConnection();
        try {
            SOAPMessage inMessage = marshaler.createSOAPMessage(in);
            MimeHeaders mh = inMessage.getMimeHeaders();
            if (mh.getHeader("SOAPAction") == null) {
                if (soapAction != null && soapAction.length() > 0) {
                    mh.addHeader("SOAPAction", soapAction);
                } else {
                    mh.addHeader("SOAPAction", "\"\"");
                }
                inMessage.saveChanges();
            }

            if (logger.isDebugEnabled()) {
                ByteArrayOutputStream buffer = new ByteArrayOutputStream();
                inMessage.writeTo(buffer);
                logger.debug(new String(buffer.toByteArray()));
            }
           
            SOAPMessage response = connection.call(inMessage, soapEndpoint);
            if (response != null) {
                marshaler.toNMS(out, response);
                return true;
            } else {
                return false;
            }
        }
        finally {
            try {
                connection.close();
            }
            catch (SOAPException e) {
                logger.warn("Failed to close connection", e);
            }
        }
View Full Code Here

            //Namespace prefix is empty
            body.addBodyElement(new QName("http://fakeNamespace2.org","echo"))
                          .addTextNode("This is some text");

            SOAPConnection sCon = SOAPConnectionFactory.newInstance().createConnection();
            SOAPMessage response = sCon.call(request, getAddress());
            assertFalse(response.getAttachments().hasNext());
            assertEquals(0, response.countAttachments());

            String requestStr = printSOAPMessage(request);
            String responseStr = printSOAPMessage(response);
            assertTrue(responseStr.indexOf("echo") > -1);
            sCon.close();
        } catch (SOAPException e) {
            e.printStackTrace();
            fail("Unexpected Exception while running test: " + e);
        } catch (IOException e) {
            fail("Unexpected Exception while running test: " + e);
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.