| Method from org.apache.axis2.client.ServiceClient Detail: |
public void addHeader(OMElement header) {
if (headers == null) {
headers = new ArrayList< OMElement >();
}
headers.add(header);
}
Add an arbitrary XML element as a header to be sent with outgoing messages. |
public void addHeader(SOAPHeaderBlock header) {
if (headers == null) {
headers = new ArrayList< OMElement >();
}
headers.add(header);
}
Add SOAP Header to be sent with outgoing messages. |
public void addHeadersToEnvelope(SOAPEnvelope envelope) {
if (headers != null) {
SOAPHeader soapHeader = envelope.getHeader();
for (Object header : headers) {
soapHeader.addChild((OMElement)header);
}
}
}
Add all configured headers to a SOAP envelope. |
public void addStringHeader(QName headerName,
String headerText) throws AxisFault {
if (headerName.getNamespaceURI() == null || "".equals(headerName.getNamespaceURI())) {
throw new AxisFault(
"Failed to add string header, you have to have namespaceURI for the QName");
}
OMElement omElement = OMAbstractFactory.getOMFactory().createOMElement(headerName, null);
omElement.setText(headerText);
addHeader(omElement);
}
Add a simple header containing some text to be sent with interactions. |
public void cleanup() throws AxisFault {
// if a configuration context was created for this client there'll also
// be a service group, so discard that
if (!createConfigCtx) {
String serviceGroupName = axisService.getAxisServiceGroup().getServiceGroupName();
AxisConfiguration axisConfiguration = configContext.getAxisConfiguration();
AxisServiceGroup asg = axisConfiguration.getServiceGroup(serviceGroupName);
if ((asg != null) && removeAxisService) {
axisConfiguration.removeServiceGroup(serviceGroupName);
}
} else {
configContext.terminate();
}
}
Clean up configuration created with this client. Call this method when you're done using the
client, in order to discard any associated resources. |
public void cleanupTransport() throws AxisFault {
if (getLastOperationContext() != null) {
MessageContext outMessageContext =
getLastOperationContext()
.getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
if (outMessageContext != null) {
outMessageContext.getTransportOut().getSender().cleanup(outMessageContext);
}
}
}
|
public OperationClient createClient(QName operationQName) throws AxisFault {
AxisOperation axisOperation = axisService.getOperation(operationQName);
if (axisOperation == null) {
throw new AxisFault(Messages
.getMessage("operationnotfound", operationQName.getLocalPart()));
}
// add the option properties to the service context
String key;
for (Object o : options.getProperties().keySet()) {
key = (String)o;
serviceContext.setProperty(key, options.getProperties().get(key));
}
OperationClient operationClient = axisOperation.createClient(serviceContext, options);
// if overide options have been set, that means we need to make sure
// those options override the options of even the operation client. So,
// what we do is switch the parents around to make that work.
if (overrideOptions != null) {
overrideOptions.setParent(operationClient.getOptions());
operationClient.setOptions(overrideOptions);
}
return operationClient;
}
Create an operation client with the appropriate message exchange pattern (MEP). This method
creates a full-function MEP client which can be used to exchange messages for a specific
operation. It configures the constructed operation client to use the current normal and
override options. This method is used internally, and also by generated client stub code. |
public void disengageModule(QName moduleName) {
disengageModule(moduleName.getLocalPart());
} Deprecated! Please - use String version instead
Disengage a module for this service client |
public void disengageModule(String moduleName) {
synchronized (this.axisConfig) {
AxisModule module = axisConfig.getModule(moduleName);
if (module != null) {
try {
axisService.disengageModule(module);
} catch (AxisFault axisFault) {
log.error(axisFault.getMessage(), axisFault);
}
}
}
}
Disengage a module for this service client |
public void engageModule(QName moduleName) throws AxisFault {
engageModule(moduleName.getLocalPart());
} Deprecated! Please - use String version instead
Engage a module for this service client. |
public void engageModule(String moduleName) throws AxisFault {
synchronized (this.axisConfig) {
AxisModule module = axisConfig.getModule(moduleName);
if (module != null) {
axisService.engageModule(module);
} else {
throw new AxisFault("Unable to engage module : " + moduleName);
}
}
}
Engage a module for this service client. |
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof ServiceClient))
return false;
final ServiceClient other = (ServiceClient)obj;
return hashCode == other.hashCode;
}
|
protected void finalize() throws Throwable {
super.finalize();
cleanup();
}
|
public void fireAndForget(OMElement elem) throws AxisFault {
fireAndForget(ANON_OUT_ONLY_OP, elem);
}
Directly invoke an anonymous 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. |
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);
}
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. |
public AxisConfiguration getAxisConfiguration() {
synchronized (this.axisConfig) {
return axisConfig;
}
}
Get the AxisConfiguration |
public AxisService getAxisService() {
return axisService;
}
Return the AxisService this is a client for. This is primarily useful when the AxisService is
created anonymously or from WSDL as otherwise the user had the AxisService to start with. |
public OperationContext getLastOperationContext() {
return serviceContext.getLastOperationContext();
}
Gets the last OperationContext |
public EndpointReference getMyEPR(String transport) throws AxisFault {
return serviceContext.getMyEPR(transport);
}
Get the endpoint reference for this client using a particular transport. |
public Options getOptions() {
return options;
}
Get the basic client configuration from this service interaction. |
public Options getOverrideOptions() {
return overrideOptions;
}
Get the client configuration used to override the normal options set by an operation client. |
public ServiceContext getServiceContext() {
return serviceContext;
}
|
public EndpointReference getTargetEPR() {
return serviceContext.getTargetEPR();
}
Get the endpoint reference for the service. |
public int hashCode() {
return this.hashCode;
}
|
public void removeHeaders() {
if (headers != null) {
headers.clear();
}
}
Remove all headers for outgoing message. |
public OMElement sendReceive(OMElement elem) throws AxisFault {
return sendReceive(ANON_OUT_IN_OP, elem);
}
Directly invoke an anonymous operation 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
operation and use that client to execute the exchange. |
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. |
public void sendReceiveNonBlocking(OMElement elem,
Callback callback) throws AxisFault {
sendReceiveNonBlocking(ANON_OUT_IN_OP, elem, callback);
} Deprecated! Please - use the AxisCallback interface rather than Callback, which has been
deprecated
Directly invoke an anonymous 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. |
public void sendReceiveNonBlocking(OMElement elem,
AxisCallback callback) throws AxisFault {
sendReceiveNonBlocking(ANON_OUT_IN_OP, elem, callback);
}
Directly invoke an anonymous 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. |
public void sendReceiveNonBlocking(QName operation,
OMElement elem,
Callback 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);
} Deprecated! Please - use the AxisCallback interface rather than Callback, which has been
deprecated
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. |
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. |
public void sendRobust(OMElement elem) throws AxisFault {
sendRobust(ANON_ROBUST_OUT_ONLY_OP, elem);
}
Directly invoke an anonymous 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. |
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 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. |
public void setAxisService(AxisService axisService) throws AxisFault {
if (axisService == null) {
// AxisFault?
throw new IllegalArgumentException("AxisService is null");
}
synchronized (this.axisConfig) {
axisConfig.removeService(this.axisService.getName());
this.axisService = axisService;
axisService.setClientSide(true);
axisConfig.addService(axisService);
}
AxisServiceGroup axisServiceGroup = axisService.getAxisServiceGroup();
ServiceGroupContext serviceGroupContext =
configContext.createServiceGroupContext(axisServiceGroup);
this.serviceContext = serviceGroupContext.getServiceContext(axisService);
}
Configure the ServiceClient to interact with the Web service described by the specified
AxisService object. |
public void setCachingOperationContext(boolean cachingOpContext) {
serviceContext.setCachingOperationContext(cachingOpContext);
} Deprecated!
Sets whether or not to cache the last OperationContext |
public void setOptions(Options options) {
this.options = options;
}
Set the basic client configuration related to this service interaction. |
public void setOverrideOptions(Options overrideOptions) {
this.overrideOptions = overrideOptions;
}
Set a client configuration to override the normal options used by an operation client. Any
values set in this configuration will be used for each client, with the standard values for
the client still used for any values not set in the override configuration. |
public void setTargetEPR(EndpointReference targetEpr) {
serviceContext.setTargetEPR(targetEpr);
options.setTo(targetEpr);
}
Set the endpoint reference for the service. |