soapConnection.close(); } catch (Exception e) { System.err.println("Error occurred while sending SOAP Request to Server");
soapConnection.close(); } catch (Exception e) { System.err.println("Error occurred while sending SOAP Request to Server");
soapResponse.writeTo(System.out); soapConnection.close();
private void closeSoapConnection() throws SOAPException { soapConnection.close(); }
@Override public void disconnect() { if (connected) { try { soapConnection.close(); connected = false; } catch (SOAPException e) { logger.info("disconnect() failed", e); } } events.disconnected(); }
public void close() { if (connection != null) { try { connection.close(); } catch (SOAPException e) { log.error(e); throw new JRRuntimeException(e); } connection = null; } }
@Override public void disconnect() { if (connected) { try { soapConnection.close(); connected = false; } catch (SOAPException e) { logger.info("disconnect() failed", e); } } events.disconnected(); receiverEvents.disconnect(); }
/** * Free all the resources belonging to this class. */ public void free() { super.free(); try { if (m_con != null) m_con.close(); } catch (SOAPException ex) { ex.printStackTrace(); } } /**
SOAPBody body = message.getSOAPBody(); QName bodyName = new QName("http://www.webserviceX.NET", "GetAtomicNumber"); SOAPBodyElement bodyElement = body.addBodyElement(bodyName); SOAPElement symbol = bodyElement.addChildElement("MyMetal"); symbol.addTextNode("iron"); SOAPConnection connection = SOAPConnectionFactory.newInstance().createConnection(); SOAPMessage response = connection.call(message, endpoint); connection.close(); message.writeTo(System.out); System.out.println(); response.writeTo(System.out); System.out.println();
public static SOAPMessage call(final SOAPMessage soapMessage, final String endpoint) { SOAPMessage response = null; SOAPConnection connection = null; try { connection = SOAPUtil.getSOAPConnectionFactory().createConnection(); response = connection.call(soapMessage, endpoint); } catch (final Exception e) { throw new RuntimeException("Exception caught while performing call to " + endpoint, e); } finally { if (connection != null) { try { connection.close(); } catch (final Exception e) { // nothing } } } return response; }
/* * soapXMLtoEndpoint sends the soapXMLFileLocation to the endpointURL */ public void soapXMLtoEndpoint(String endpointURL, String soapXMLFileLocation) throws SOAPException { SOAPConnection connection = SOAPConnectionFactory.newInstance().createConnection(); SOAPMessage response = connection.call(xmlStringToSOAPMessage(soapXMLFileLocation), endpointURL); connection.close(); SOAPBody responseBody = response.getSOAPBody(); SOAPBodyElement responseElement = (SOAPBodyElement) responseBody.getChildElements().next(); SOAPElement returnElement = (SOAPElement) responseElement.getChildElements().next(); if (responseBody.getFault() != null) { System.out.println("fault != null"); System.out.println(returnElement.getValue() + " " + responseBody.getFault().getFaultString()); } else { serverResponse = returnElement.getValue(); System.out.println(serverResponse); System.out.println("\nfault == null, got the response properly.\n"); } }
soapConnection.close();
SOAPMessage soapResponse = soapConnection.call(createSOAPRequest(), url); printSOAPResponse(soapResponse); soapConnection.close();
public HttpResponseBean makeCougarSOAPCall(SOAPMessage message, String serviceName, String version, HttpCallBean httpBean) { 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; String host = httpBean.getHost(); String port = httpBean.getPort(); String endPoint = "http://" + host + ":" + port + "/" + serviceName + "Service/" + version; try { response = connection.call(message, endPoint); } catch (SOAPException e) { response = e; } finally { connection.close(); } responseBean.setResponseObject(handleResponse(response, responseBean)); return responseBean; } catch (SOAPException | IOException | ParserConfigurationException | TransformerException e) { throw new RuntimeException(SOAP_CALL_TEXT + e, e); } }
/** * Executes SOAP message * * @param endpointUrl SOAP endpoint * @param message SOAP request * @return SOAP response message * @throws SOAPException in case of a SOAP issue * @throws IOException in case of an IO issue */ public SOAPMessage execute(String endpointUrl, SOAPMessage message) throws SOAPException, IOException { SOAPConnection conn = null; try { conn = SOAPConnectionFactory.newInstance().createConnection(); SOAPMessage response = conn.call(message, endpointUrl); SOAPBody body = response.getSOAPBody(); if (body.hasFault()) throw new SOAPException(body.getFault().getFaultString()); return response; } finally { if (conn != null) conn.close(); } }
System.out.print("Response SOAP Message:"); soapResponse.writeTo(System.out); soapConnection.close();
/** * Forward the SOAP message contained in the specified SOAP message context on * to the specified end-point reference. * * @param ctx Message context to get the message from * @param ref End-point reference to forward to */ protected void forwardMessage(SOAPMessageContext ctx, EndpointReference ref) { try { SOAPConnection soapConn = SOAPConnectionFactory.newInstance().createConnection(); soapConn.call(ctx.getMessage(), new URL(ref.getAddress().toString())); soapConn.close(); SOAPBody responseBody = ctx.getMessage().getSOAPPart().getEnvelope().getBody(); removeAllChildElements(responseBody); } catch (SOAPException e) { throw new JAXRPCException("Failed to forward SOAP message.", e); } catch (MalformedURLException e) { throw new JAXRPCException("Failed to forward SOAP message.", e); } }
/** * Test it! */ public void runTest(Properties properties) { try { Object jibxMessage = createMessage(properties); SOAPMessage soapMessage = createSOAPMessage(jibxMessage); SOAPConnection connection = SOAPConnectionFactory.newInstance().createConnection(); SOAPMessage soapResponse = connection.call(soapMessage, getEndpoint(properties)); connection.close(); Object res = getResponseFromSOAPMessage(soapResponse, getResponseClass(jibxMessage)); checkResponseMessage(properties, res); } catch (SOAPException e) { e.printStackTrace(); } } /**
/** * Test it! */ public void runTest(Properties properties) { try { Object jibxMessage = createMessage(properties); SOAPMessage soapMessage = createSOAPMessage(jibxMessage); SOAPConnection connection = SOAPConnectionFactory.newInstance().createConnection(); SOAPMessage soapResponse = connection.call(soapMessage, getEndpoint(properties)); connection.close(); Object res = getResponseFromSOAPMessage(soapResponse, getResponseClass(jibxMessage)); checkResponseMessage(properties, res); } catch (SOAPException e) { e.printStackTrace(); } } /**
soapConnection.close(); } catch (Exception e) { System.err.println("Error occurred while sending SOAP Request to Server");