/** * Method to build a MEP Client with an attachment in the method context. * * @deprecated Please use * {@link #buildMEPClient(EndpointReference, OMElement, Map, String, String, String)} instead. * @param endpoint The endpoint to configure the client for. * @param request The request to add as a SOAP envelope. * @param attachmentMap The attachment map. * @return The built MEP Client * @throws AxisFault on failure to initialize the client. */ @Deprecated private OperationClient buildMEPClient(final EndpointReference endpoint, final OMElement request, final Map<String, DataHandler> attachmentMap) throws AxisFault { ServiceClient serviceClient = new ServiceClient(); Options serviceOptions = new Options(); serviceOptions.setProperty(Constants.Configuration.ENABLE_SWA, Constants.VALUE_TRUE); serviceOptions.setTo(endpoint); serviceOptions.setAction("mediate"); serviceClient.setOptions(serviceOptions); MessageContext messageContext = new MessageContext(); SOAPEnvelope soapEnvelope = TransportUtils.createSOAPEnvelope(request); messageContext.setEnvelope(soapEnvelope); for (String contentId : attachmentMap.keySet()) { messageContext.addAttachment(contentId, attachmentMap.get(contentId)); } OperationClient mepClient = serviceClient.createClient(ServiceClient.ANON_OUT_IN_OP); mepClient.addMessageContext(messageContext); return mepClient; }
/** * Method to build a MEP with a specified soap envelope. * * @deprecated Please use {@link #buildMEPClient(EndpointReference, OMElement, String, String, String)} * instead. * @param endpoint The endpoint to configure the client for. * @param request The request to add as a SOAP envelope * @return The built MEP Client * @throws AxisFault on failure to initialize the client. */ @Deprecated private OperationClient buildMEPClient(final EndpointReference endpoint, final OMElement request) throws AxisFault { ServiceClient serviceClient = new ServiceClient(); Options serviceOptions = new Options(); serviceOptions.setTo(endpoint); serviceOptions.setAction("mediate"); serviceClient.setOptions(serviceOptions); MessageContext messageContext = new MessageContext(); SOAPEnvelope soapEnvelope = TransportUtils.createSOAPEnvelope(request); messageContext.setEnvelope(soapEnvelope); OperationClient mepClient = serviceClient.createClient(ServiceClient.ANON_OUT_IN_OP); mepClient.addMessageContext(messageContext); return mepClient; }
/** * Directly invoke a named operation with a Robust In-Only MEP. This method just sends your * supplied XML and possibly receives a fault. For more control, you can instead create a client * for the operation and use that client to execute the send. * * @param operation name of operation to be invoked (non-<code>null</code>) * @param elem XML to send * @throws AxisFault if something goes wrong while sending it or if a fault is received in * response (per the Robust In-Only MEP). * @see #createClient(QName) */ public void sendRobust(QName operation, OMElement elem) throws AxisFault { MessageContext mc = new MessageContext(); fillSOAPEnvelope(mc, elem); OperationClient mepClient = createClient(operation); mepClient.addMessageContext(mc); mepClient.execute(true); }
/** * Method to build a MEP with a specified soap envelope. * * @deprecated Please use {@link #buildMEPClient(EndpointReference, OMElement, String, String, String)} * instead. * @param endpoint The endpoint to configure the client for. * @param request The request to add as a SOAP envelope * @return The built MEP Client * @throws AxisFault on failure to initialize the client. */ @Deprecated private OperationClient buildMEPClient(final EndpointReference endpoint, final OMElement request) throws AxisFault { ServiceClient serviceClient = new ServiceClient(); Options serviceOptions = new Options(); serviceOptions.setTo(endpoint); serviceOptions.setAction("mediate"); serviceClient.setOptions(serviceOptions); MessageContext messageContext = new MessageContext(); SOAPEnvelope soapEnvelope = TransportUtils.createSOAPEnvelope(request); messageContext.setEnvelope(soapEnvelope); OperationClient mepClient = serviceClient.createClient(ServiceClient.ANON_OUT_IN_OP); mepClient.addMessageContext(messageContext); return mepClient; }
/** * Directly invoke a named operation with a Robust In-Only MEP. This method just sends your * supplied XML and possibly receives a fault. For more control, you can instead create a client * for the operation and use that client to execute the send. * * @param operation name of operation to be invoked (non-<code>null</code>) * @param elem XML to send * @throws AxisFault if something goes wrong while sending it or if a fault is received in * response (per the Robust In-Only MEP). * @see #createClient(QName) */ public void sendRobust(QName operation, OMElement elem) throws AxisFault { MessageContext mc = new MessageContext(); fillSOAPEnvelope(mc, elem); OperationClient mepClient = createClient(operation); mepClient.addMessageContext(mc); mepClient.execute(true); }
/** * Directly invoke a named operation with an In-Only MEP. This method just sends your supplied * XML without the possibility of any response from the service (even an error - though you can * still get client-side errors such as "Host not found"). For more control, you can instead * create a client for the operation and use that client to execute the send. * * @param operation name of operation to be invoked (non-<code>null</code>) * @param elem XML to send * @throws AxisFault if something goes wrong trying to send the XML * @see #createClient(QName) */ public void fireAndForget(QName operation, OMElement elem) throws AxisFault { // look up the appropriate axisop and create the client OperationClient mepClient = createClient(operation); // create a message context and put the payload in there along with any // headers MessageContext mc = new MessageContext(); fillSOAPEnvelope(mc, elem); // add the message context there and have it go mepClient.addMessageContext(mc); mepClient.execute(false); }
private static MessageContext sendReceive(OMElement llomElement, ServiceClient serviceClient) throws AxisFault { MessageContext messageContext = new MessageContext(); fillSOAPEnvelope(messageContext, llomElement, serviceClient); OperationClient operationClient = serviceClient.createClient(ServiceClient.ANON_OUT_IN_OP); operationClient.addMessageContext(messageContext); operationClient.execute(true); MessageContext response = operationClient .getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE); if (serviceClient.getOptions().isCallTransportCleanup()) { response.getEnvelope().build(); serviceClient.cleanupTransport(); return response; } else { return response; } }
/** * Directly invoke a named operation with an In-Only MEP. This method just sends your supplied * XML without the possibility of any response from the service (even an error - though you can * still get client-side errors such as "Host not found"). For more control, you can instead * create a client for the operation and use that client to execute the send. * * @param operation name of operation to be invoked (non-<code>null</code>) * @param elem XML to send * @throws AxisFault if something goes wrong trying to send the XML * @see #createClient(QName) */ public void fireAndForget(QName operation, OMElement elem) throws AxisFault { // look up the appropriate axisop and create the client OperationClient mepClient = createClient(operation); // create a message context and put the payload in there along with any // headers MessageContext mc = new MessageContext(); fillSOAPEnvelope(mc, elem); // add the message context there and have it go mepClient.addMessageContext(mc); mepClient.execute(false); }
/** * Method to build a MEP with a specified soap envelope which created parsing original request, taking the * SOAP action as a parameter. * * @param endpoint The endpoint to configure the client for. * @param request The request to add as a SOAP envelope. * @param action The SOAP action. * @param xpathHeaderExp XPath expression to evaluate the SOAP header. * @param xpathBodyExp XPath expression to evaluate the SOAP body. * @return The built MEP Client. * @throws AxisFault on failure to initialize the client. * @throws JaxenException Thrown on failure to evaluate XPath expression */ private OperationClient buildMEPClient(final EndpointReference endpoint, final OMElement request, final String action, final String xpathHeaderExp, final String xpathBodyExp) throws AxisFault, JaxenException { ServiceClient serviceClient = new ServiceClient(); Options serviceOptions = new Options(); serviceOptions.setTo(endpoint); serviceOptions.setAction(action); serviceClient.setOptions(serviceOptions); MessageContext messageContext = new MessageContext(); SOAPEnvelope soapEnvelope = createSOAPEnvelope(request, xpathHeaderExp, xpathBodyExp); messageContext.setEnvelope(soapEnvelope); OperationClient mepClient = serviceClient.createClient(ServiceClient.ANON_OUT_IN_OP); mepClient.addMessageContext(messageContext); return mepClient; }
OperationClient mepClient = serviceClient.createClient(ServiceClient.ANON_OUT_IN_OP); mepClient.addMessageContext(messageContext); return mepClient;
/** * Directly invoke a named operationQName with an In-Out MEP. This method sends your supplied * XML and receives a response. For more control, you can instead create a client for the * operationQName and use that client to execute the exchange. * <p> * Unless the <code>callTransportCleanup</code> property on the {@link Options} object has been * set to <code>true</code>, the caller must invoke {@link #cleanupTransport()} after * processing the response. * * @param operationQName name of operationQName to be invoked (non-<code>null</code>) * @param xmlPayload the data to send (becomes the content of SOAP body) * @return response OMElement * @throws AxisFault in case of error * @see #cleanupTransport() */ public OMElement sendReceive(QName operationQName, OMElement xmlPayload) throws AxisFault { MessageContext messageContext = new MessageContext(); fillSOAPEnvelope(messageContext, xmlPayload); OperationClient operationClient = createClient(operationQName); operationClient.addMessageContext(messageContext); operationClient.execute(true); MessageContext response = operationClient .getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE); if (options.isCallTransportCleanup()) { response.getEnvelope().build(); cleanupTransport(); } return response.getEnvelope().getBody().getFirstElement(); }
/** * Directly invoke a named operationQName with an In-Out MEP. This method sends your supplied * XML and receives a response. For more control, you can instead create a client for the * operationQName and use that client to execute the exchange. * <p> * Unless the <code>callTransportCleanup</code> property on the {@link Options} object has been * set to <code>true</code>, the caller must invoke {@link #cleanupTransport()} after * processing the response. * * @param operationQName name of operationQName to be invoked (non-<code>null</code>) * @param xmlPayload the data to send (becomes the content of SOAP body) * @return response OMElement * @throws AxisFault in case of error * @see #cleanupTransport() */ public OMElement sendReceive(QName operationQName, OMElement xmlPayload) throws AxisFault { MessageContext messageContext = new MessageContext(); fillSOAPEnvelope(messageContext, xmlPayload); OperationClient operationClient = createClient(operationQName); operationClient.addMessageContext(messageContext); operationClient.execute(true); MessageContext response = operationClient .getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE); if (options.isCallTransportCleanup()) { response.getEnvelope().build(); cleanupTransport(); } return response.getEnvelope().getBody().getFirstElement(); }
/** * Directly invoke a named operation with an In-Out MEP without waiting for a response. This * method sends your supplied XML with response notification to your callback handler. For more * control, you can instead create a client for the operation and use that client to execute the * exchange. * * @param operation name of operation to be invoked (non-<code>null</code>) * @param elem the data to send (becomes the content of SOAP body) * @param callback a Callback which will be notified upon completion * @throws AxisFault in case of error * @see #createClient(QName) */ public void sendReceiveNonBlocking(QName operation, OMElement elem, AxisCallback callback) throws AxisFault { MessageContext mc = new MessageContext(); fillSOAPEnvelope(mc, elem); OperationClient mepClient = createClient(operation); // here a blocking invocation happens in a new thread, so the // progamming model is non blocking mepClient.setCallback(callback); mepClient.addMessageContext(mc); mepClient.execute(false); }
/** * Directly invoke a named operation with an In-Out MEP without waiting for a response. This * method sends your supplied XML with response notification to your callback handler. For more * control, you can instead create a client for the operation and use that client to execute the * exchange. * * @param operation name of operation to be invoked (non-<code>null</code>) * @param elem the data to send (becomes the content of SOAP body) * @param callback a Callback which will be notified upon completion * @throws AxisFault in case of error * @see #createClient(QName) */ public void sendReceiveNonBlocking(QName operation, OMElement elem, AxisCallback callback) throws AxisFault { MessageContext mc = new MessageContext(); fillSOAPEnvelope(mc, elem); OperationClient mepClient = createClient(operation); // here a blocking invocation happens in a new thread, so the // progamming model is non blocking mepClient.setCallback(callback); mepClient.addMessageContext(mc); mepClient.execute(false); }
/** * Method to build a MEP with a specified soap envelope. * * @param endpoint * The endpoint to configure the client for. * @param request * The request to add as a SOAP envelope * @return The built MEP Client * @throws AxisFault * on failure to initialize the client. */ public static OperationClient buildMEPClient(EndpointReference endpoint, OMElement request) throws AxisFault { ServiceClient serviceClient = new ServiceClient(); Options serviceOptions = new Options(); serviceOptions.setTo(endpoint); serviceOptions.setAction("mediate"); serviceClient.setOptions(serviceOptions); MessageContext messageContext = new MessageContext(); SOAPEnvelope soapEnvelope = TransportUtils.createSOAPEnvelope(request); messageContext.setEnvelope(soapEnvelope); OperationClient mepClient = serviceClient.createClient(ServiceClient.ANON_OUT_IN_OP); mepClient.addMessageContext(messageContext); return mepClient; }
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[2].getName()); _operationClient.getOptions().setAction("urn:abort_boxcar"); _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
protected MessageContext send(ClientOptions options, AxisMessage message, QName operationQName, boolean block, String resultMessageLabel) throws Exception { OperationClient mepClient = serviceClient.createClient(operationQName); MessageContext mc = new MessageContext(); mc.setProperty(Constants.Configuration.MESSAGE_TYPE, message.getMessageType()); mc.setEnvelope(message.getEnvelope()); Attachments attachments = message.getAttachments(); if (attachments != null) { mc.setAttachmentMap(attachments); mc.setDoingSwA(true); mc.setProperty(Constants.Configuration.ENABLE_SWA, true); } for (AxisTestClientConfigurator configurator : configurators) { configurator.setupRequestMessageContext(mc); } mc.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, options.getCharset()); mc.setServiceContext(serviceClient.getServiceContext()); if (metrics != null) { mc.setProperty(BaseConstants.METRICS_COLLECTOR, metrics); } mepClient.addMessageContext(mc); mepClient.execute(block); // mepClient.complete(mc); return resultMessageLabel == null ? null : mepClient.getMessageContext(resultMessageLabel); }
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[0].getName()); _operationClient.getOptions().setAction("urn:logout"); _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
protected MessageContext send(ClientOptions options, AxisMessage message, QName operationQName, boolean block, String resultMessageLabel) throws Exception { OperationClient mepClient = serviceClient.createClient(operationQName); MessageContext mc = new MessageContext(); mc.setProperty(Constants.Configuration.MESSAGE_TYPE, message.getMessageType()); mc.setEnvelope(message.getEnvelope()); Attachments attachments = message.getAttachments(); if (attachments != null) { mc.setAttachmentMap(attachments); mc.setDoingSwA(true); mc.setProperty(Constants.Configuration.ENABLE_SWA, true); } for (AxisTestClientConfigurator configurator : configurators) { configurator.setupRequestMessageContext(mc); } mc.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, options.getCharset()); mc.setServiceContext(serviceClient.getServiceContext()); if (metrics != null) { mc.setProperty(BaseConstants.METRICS_COLLECTOR, metrics); } mepClient.addMessageContext(mc); mepClient.getOptions().setAction(""); mepClient.execute(block); // mepClient.complete(mc); return resultMessageLabel == null ? null : mepClient.getMessageContext(resultMessageLabel); }
protected MessageContext send(ClientOptions options, AxisMessage message, QName operationQName, boolean block, String resultMessageLabel) throws Exception { OperationClient mepClient = serviceClient.createClient(operationQName); MessageContext mc = new MessageContext(); mc.setProperty(Constants.Configuration.MESSAGE_TYPE, message.getMessageType()); mc.setEnvelope(message.getEnvelope()); Attachments attachments = message.getAttachments(); if (attachments != null) { mc.setAttachmentMap(attachments); mc.setDoingSwA(true); mc.setProperty(Constants.Configuration.ENABLE_SWA, true); } for (AxisTestClientConfigurator configurator : configurators) { configurator.setupRequestMessageContext(mc); } mc.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, options.getCharset()); mc.setServiceContext(serviceClient.getServiceContext()); if (metrics != null) { mc.setProperty(BaseConstants.METRICS_COLLECTOR, metrics); } mepClient.addMessageContext(mc); mepClient.getOptions().setAction(""); mepClient.execute(block); // mepClient.complete(mc); return resultMessageLabel == null ? null : mepClient.getMessageContext(resultMessageLabel); }