Methods Summary |
---|
public void | addAttachmentPart(java.lang.Object attachment)This method adds an attachment.
Note: Not part of JAX-RPC specification.
attachmentParts.add(attachment);
|
public void | addFault(javax.xml.namespace.QName qname, java.lang.Class cls, javax.xml.namespace.QName xmlType, boolean isComplex)Add a fault for this operation.
Note: Not part of JAX-RPC specificaion.
if (operationSetManually) {
throw new RuntimeException(
Messages.getMessage("operationAlreadySet"));
}
if (operation == null) {
operation = new OperationDesc();
}
FaultDesc fault = new FaultDesc();
fault.setQName(qname);
fault.setClassName(cls.getName());
fault.setXmlType(xmlType);
fault.setComplex(isComplex);
operation.addFault(fault);
|
public void | addHeader(org.apache.axis.message.SOAPHeaderElement header)Add a header which should be inserted into each outgoing message
we generate.
Note: Not part of JAX-RPC specification.
if (myHeaders == null) {
myHeaders = new Vector();
}
myHeaders.add(header);
|
public void | addParameter(javax.xml.namespace.QName paramName, javax.xml.namespace.QName xmlType, javax.xml.rpc.ParameterMode parameterMode)Adds the specified parameter to the list of parameters for the
operation associated with this Call object.
Note: Not part of JAX-RPC specification.
Class javaType = null;
TypeMapping tm = getTypeMapping();
if (tm != null) {
javaType = tm.getClassForQName(xmlType);
}
addParameter(paramName, xmlType, javaType, parameterMode);
|
public void | addParameter(javax.xml.namespace.QName paramName, javax.xml.namespace.QName xmlType, java.lang.Class javaType, javax.xml.rpc.ParameterMode parameterMode)Adds the specified parameter to the list of parameters for the
operation associated with this Call object.
Note: Not part of JAX-RPC specification.
if (operationSetManually) {
throw new RuntimeException(
Messages.getMessage("operationAlreadySet"));
}
if (operation == null)
operation = new OperationDesc();
ParameterDesc param = new ParameterDesc();
byte mode = ParameterDesc.IN;
if (parameterMode == ParameterMode.INOUT) {
mode = ParameterDesc.INOUT;
param.setIsReturn(true);
} else if (parameterMode == ParameterMode.OUT) {
mode = ParameterDesc.OUT;
param.setIsReturn(true);
}
param.setMode(mode);
param.setQName(new QName(paramName.getNamespaceURI(),Utils.getLastLocalPart(paramName.getLocalPart())));
param.setTypeQName( xmlType );
param.setJavaType( javaType );
operation.addParameter(param);
parmAndRetReq = true;
|
public void | addParameter(java.lang.String paramName, javax.xml.namespace.QName xmlType, javax.xml.rpc.ParameterMode parameterMode)Adds the specified parameter to the list of parameters for the
operation associated with this Call object.
Class javaType = null;
TypeMapping tm = getTypeMapping();
if (tm != null) {
javaType = tm.getClassForQName(xmlType);
}
addParameter(new QName("", paramName), xmlType,
javaType, parameterMode);
|
public void | addParameter(java.lang.String paramName, javax.xml.namespace.QName xmlType, java.lang.Class javaType, javax.xml.rpc.ParameterMode parameterMode)Adds a parameter type and mode for a specific operation. Note that the
client code is not required to call any addParameter and setReturnType
methods before calling the invoke method. A Call implementation class
can determine the parameter types by using the Java reflection and
configured type mapping registry.
addParameter(new QName("", paramName), xmlType,
javaType, parameterMode);
|
public void | addParameterAsHeader(javax.xml.namespace.QName paramName, javax.xml.namespace.QName xmlType, javax.xml.rpc.ParameterMode parameterMode, javax.xml.rpc.ParameterMode headerMode)Adds a parameter type as a soap:header.
Class javaType = null;
TypeMapping tm = getTypeMapping();
if (tm != null) {
javaType = tm.getClassForQName(xmlType);
}
addParameterAsHeader(paramName, xmlType, javaType,
parameterMode, headerMode);
|
public void | addParameterAsHeader(javax.xml.namespace.QName paramName, javax.xml.namespace.QName xmlType, java.lang.Class javaType, javax.xml.rpc.ParameterMode parameterMode, javax.xml.rpc.ParameterMode headerMode)Adds a parameter type as a soap:header.
if (operationSetManually) {
throw new RuntimeException(
Messages.getMessage("operationAlreadySet"));
}
if (operation == null)
operation = new OperationDesc();
ParameterDesc param = new ParameterDesc();
param.setQName(new QName(paramName.getNamespaceURI(),Utils.getLastLocalPart(paramName.getLocalPart())));
param.setTypeQName(xmlType);
param.setJavaType(javaType);
if (parameterMode == ParameterMode.IN) {
param.setMode(ParameterDesc.IN);
}
else if (parameterMode == ParameterMode.INOUT) {
param.setMode(ParameterDesc.INOUT);
}
else if (parameterMode == ParameterMode.OUT) {
param.setMode(ParameterDesc.OUT);
}
if (headerMode == ParameterMode.IN) {
param.setInHeader(true);
}
else if (headerMode == ParameterMode.INOUT) {
param.setInHeader(true);
param.setOutHeader(true);
}
else if (headerMode == ParameterMode.OUT) {
param.setOutHeader(true);
}
operation.addParameter(param);
parmAndRetReq = true;
|
public static synchronized void | addTransportPackage(java.lang.String packageName)Add a package to the system protocol handler search path. This
enables users to create their own URLStreamHandler classes, and thus
allow custom protocols to be used in Axis (typically on the client
command line).
For instance, if you add "samples.transport" to the packages property,
and have a class samples.transport.tcp.Handler, the system will be able
to parse URLs of the form "tcp://host:port..."
Note: Not part of JAX-RPC specification.
if (transportPackages == null) {
transportPackages = new ArrayList();
String currentPackages =
AxisProperties.getProperty(TRANSPORT_PROPERTY);
if (currentPackages != null) {
StringTokenizer tok = new StringTokenizer(currentPackages,
"|");
while (tok.hasMoreTokens()) {
transportPackages.add(tok.nextToken());
}
}
}
if (transportPackages.contains(packageName)) {
return;
}
transportPackages.add(packageName);
StringBuffer currentPackages = new StringBuffer();
for (Iterator i = transportPackages.iterator(); i.hasNext();) {
String thisPackage = (String) i.next();
currentPackages.append(thisPackage);
currentPackages.append('|");
}
final String transportProperty = currentPackages.toString();
java.security.AccessController.doPrivileged(new java.security.PrivilegedAction() {
public Object run() {
try {
System.setProperty(TRANSPORT_PROPERTY, transportProperty);
} catch (SecurityException se){
}
return null;
}
});
|
public void | clearHeaders()Clear the list of headers which we insert into each message
Note: Not part of JAX-RPC specification.
myHeaders = null;
|
public void | clearOperation()
operation = null;
operationSetManually = false;
|
public java.lang.String | getEncodingStyle()Returns the encoding style as a URI that should be used for the SOAP
message.
return msgContext.getEncodingStyle();
|
private java.lang.Class | getJavaTypeForQName(javax.xml.namespace.QName name)Get the javaType for a given parameter.
if (operation == null) {
return null;
}
ParameterDesc param = operation.getOutputParamByQName(name);
return param == null ? null : param.getJavaType();
|
public boolean | getMaintainSession()Get the value of maintainSession flag.
return maintainSession;
|
public org.apache.axis.MessageContext | getMessageContext()Obtain a reference to our MessageContext.
Note: Not part of JAX-RPC specification.
return msgContext;
|
public org.apache.axis.description.OperationDesc | getOperation()
return operation;
|
public javax.xml.namespace.QName | getOperationName()Returns the operation name associated with this Call object.
return( operationName );
|
public org.apache.axis.constants.Style | getOperationStyle()Get the operation style.
if (operation != null) {
return operation.getStyle();
}
return Style.DEFAULT;
|
public org.apache.axis.constants.Use | getOperationUse()Get the operation use.
if (operation != null) {
return operation.getUse();
}
return Use.DEFAULT;
|
public java.util.Map | getOutputParams()Get the output parameters (if any) from the last invocation.
This allows named access - if you need sequential access, use
getOutputValues().
if (isNeverInvoked) {
throw new JAXRPCException(
Messages.getMessage("outputParamsUnavailable"));
}
return this.outParams;
|
public java.util.List | getOutputValues()Returns a List values for the output parameters of the last
invoked operation.
if (isNeverInvoked) {
throw new JAXRPCException(
Messages.getMessage("outputParamsUnavailable"));
}
return outParamsList;
|
private java.lang.Object[] | getParamList(java.lang.Object[] params)Convert the list of objects into RPCParam's based on the paramNames,
paramXMLTypes and paramModes variables. If those aren't set then just
return what was passed in.
int numParams = 0 ;
// If we never set-up any names... then just return what was passed in
//////////////////////////////////////////////////////////////////////
if (log.isDebugEnabled()) {
log.debug( "operation=" + operation);
if (operation != null) {
log.debug("operation.getNumParams()=" +
operation.getNumParams());
}
}
if ( operation == null || operation.getNumParams() == 0 ) {
return( params );
}
// Count the number of IN and INOUT params, this needs to match the
// number of params passed in - if not throw an error
/////////////////////////////////////////////////////////////////////
numParams = operation.getNumInParams();
if ( params == null || numParams != params.length ) {
throw new JAXRPCException(
Messages.getMessage(
"parmMismatch00",
(params == null) ? "no params" : "" + params.length,
"" + numParams
)
);
}
log.debug( "getParamList number of params: " + params.length);
// All ok - so now produce an array of RPCParams
//////////////////////////////////////////////////
Vector result = new Vector();
int j = 0 ;
ArrayList parameters = operation.getParameters();
for (int i = 0; i < parameters.size(); i++) {
ParameterDesc param = (ParameterDesc)parameters.get(i);
if (param.getMode() != ParameterDesc.OUT) {
QName paramQName = param.getQName();
// Create an RPCParam if param isn't already an RPCParam.
RPCParam rpcParam = null;
Object p = params[j++];
if(p instanceof RPCParam) {
rpcParam = (RPCParam)p;
} else {
rpcParam = new RPCParam(paramQName.getNamespaceURI(),
paramQName.getLocalPart(),
p);
}
// Attach the ParameterDescription to the RPCParam
// so that the serializer can use the (javaType, xmlType)
// information.
rpcParam.setParamDesc(param);
// Add the param to the header or vector depending
// on whether it belongs in the header or body.
if (param.isInHeader()) {
addHeader(new RPCHeaderParam(rpcParam));
} else {
result.add(rpcParam);
}
}
}
return( result.toArray() );
|
public javax.xml.namespace.QName | getParameterTypeByName(java.lang.String paramName)Return the QName of the type of the parameters with the given name.
QName paramQName = new QName("", paramName);
return getParameterTypeByQName(paramQName);
|
public javax.xml.namespace.QName | getParameterTypeByQName(javax.xml.namespace.QName paramQName)Return the QName of the type of the parameters with the given name.
Note: Not part of JAX-RPC specification.
ParameterDesc param = operation.getParamByQName(paramQName);
if (param != null) {
return param.getTypeQName();
}
return( null );
|
public java.lang.String | getPassword()Get the password.
return password;
|
public javax.xml.namespace.QName | getPortName()Returns the fully qualified name of the port for this Call object
(if there is one).
return( portName );
|
public javax.xml.namespace.QName | getPortTypeName()Returns the fully qualified name of the port type for this Call object
(if there is one).
return portTypeName == null ? new QName("") : portTypeName;
|
public java.lang.Object | getProperty(java.lang.String name)Returns the value associated with the named property.
if (name == null || !isPropertySupported(name)) {
throw new JAXRPCException(name == null ?
Messages.getMessage("badProp03") :
Messages.getMessage("badProp05", name));
}
return myProperties.get(name);
|
public java.util.Iterator | getPropertyNames()
propertyNames.add(USERNAME_PROPERTY);
propertyNames.add(PASSWORD_PROPERTY);
propertyNames.add(SESSION_MAINTAIN_PROPERTY);
propertyNames.add(OPERATION_STYLE_PROPERTY);
propertyNames.add(SOAPACTION_USE_PROPERTY);
propertyNames.add(SOAPACTION_URI_PROPERTY);
propertyNames.add(ENCODINGSTYLE_URI_PROPERTY);
propertyNames.add(Stub.ENDPOINT_ADDRESS_PROPERTY);
propertyNames.add(TRANSPORT_NAME);
propertyNames.add(ATTACHMENT_ENCAPSULATION_FORMAT);
propertyNames.add(CONNECTION_TIMEOUT_PROPERTY);
propertyNames.add(CHARACTER_SET_ENCODING);
return propertyNames.iterator();
|
public org.apache.axis.Message | getResponseMessage()Directly get the response message in our MessageContext.
Shortcut for having to go thru the msgContext
Note: Not part of JAX-RPC specification.
return msgContext.getResponseMessage();
|
public javax.xml.namespace.QName | getReturnType()Returns the QName of the type of the return value of this Call - or null
if not set.
Note: Not part of JAX-RPC specification.
if (operation != null)
return operation.getReturnType();
return null;
|
public java.lang.String | getSOAPActionURI()Get the soapAction URI.
return SOAPActionURI;
|
public Service | getService()Get the Service object associated with this Call object.
Note: Not part of JAX-RPC specification.
return this.service;
|
public boolean | getStreaming()
return useStreaming;
|
public java.lang.String | getTargetEndpointAddress()Returns the URL of the target Web Service.
try {
if ( transport == null ) return( null );
return( transport.getUrl() );
}
catch( Exception exp ) {
return( null );
}
|
public java.lang.Integer | getTimeout()
return timeout;
|
public Transport | getTransportForProtocol(java.lang.String protocol)Get the Transport registered for the given protocol.
Note: Not part of JAX-RPC specification.
Class transportClass = (Class)transports.get(protocol);
Transport ret = null;
if (transportClass != null) {
try {
ret = (Transport)transportClass.newInstance();
} catch (InstantiationException e) {
} catch (IllegalAccessException e) {
}
}
return ret;
|
public org.apache.axis.encoding.TypeMapping | getTypeMapping()
// Get the TypeMappingRegistry
TypeMappingRegistry tmr = msgContext.getTypeMappingRegistry();
// If a TypeMapping is not available, add one.
return tmr.getOrMakeTypeMapping(getEncodingStyle());
|
public java.lang.String | getUsername()Get the user name.
return username;
|
public static synchronized void | initialize()Set up the default transport URL mappings.
This must be called BEFORE doing non-standard URL parsing (i.e. if you
want the system to accept a "local:" URL). This is why the Options class
calls it before parsing the command-line URL argument.
Note: Not part of JAX-RPC specification.
addTransportPackage("org.apache.axis.transport");
setTransportForProtocol("java",
org.apache.axis.transport.java.JavaTransport.class);
setTransportForProtocol("local",
org.apache.axis.transport.local.LocalTransport.class);
setTransportForProtocol("http", HTTPTransport.class);
setTransportForProtocol("https", HTTPTransport.class);
|
public java.lang.Object | invoke(javax.xml.namespace.QName operationName, java.lang.Object[] params)Invokes a specific operation using a synchronous request-response interaction mode. The invoke method takes
as parameters the object values corresponding to these defined parameter types. Implementation of the invoke
method must check whether the passed parameter values correspond to the number, order and types of parameters
specified in the corresponding operation specification.
QName origOpName = this.operationName;
this.operationName = operationName;
try {
return this.invoke(params);
}
catch (AxisFault af) {
this.operationName = origOpName;
if(af.detail != null && af.detail instanceof RemoteException) {
throw ((RemoteException)af.detail);
}
throw af;
}
catch (java.rmi.RemoteException re) {
this.operationName = origOpName;
throw re;
}
catch (RuntimeException re) {
this.operationName = origOpName;
throw re;
}
catch (Error e) {
this.operationName = origOpName;
throw e;
}
|
public java.lang.Object | invoke(java.lang.Object[] params)Invokes the operation associated with this Call object using the
passed in parameters as the arguments to the method.
For Messaging (ie. non-RPC) the params argument should be an array
of SOAPBodyElements. All of them need to be SOAPBodyElements,
if any of them are not this method will default back to RPC. In the
Messaging case the return value will be a vector of SOAPBodyElements.
long t0=0, t1=0;
if( tlog.isDebugEnabled() ) {
t0=System.currentTimeMillis();
}
/* First see if we're dealing with Messaging instead of RPC. */
/* If ALL of the params are SOAPBodyElements then we're doing */
/* Messaging, otherwise just fall through to normal RPC processing. */
/********************************************************************/
SOAPEnvelope env = null ;
int i ;
for ( i = 0 ; params != null && i < params.length ; i++ )
if ( !(params[i] instanceof SOAPBodyElement) ) break ;
if ( params != null && params.length > 0 && i == params.length ) {
/* ok, we're doing Messaging, so build up the message */
/******************************************************/
isMsg = true ;
env = new SOAPEnvelope(msgContext.getSOAPConstants(),
msgContext.getSchemaVersion());
for (i = 0; i < params.length; i++) {
env.addBodyElement((SOAPBodyElement) params[i]);
}
Message msg = new Message( env );
setRequestMessage(msg);
invoke();
msg = msgContext.getResponseMessage();
if (msg == null) {
if (msgContext.isPropertyTrue(FAULT_ON_NO_RESPONSE, false)) {
throw new AxisFault(Messages.getMessage("nullResponse00"));
} else {
return null;
}
}
env = msg.getSOAPEnvelope();
return( env.getBodyElements() );
}
if ( operationName == null ) {
throw new AxisFault( Messages.getMessage("noOperation00") );
}
try {
Object res=this.invoke(operationName.getNamespaceURI(),
operationName.getLocalPart(), params);
if( tlog.isDebugEnabled() ) {
t1=System.currentTimeMillis();
tlog.debug("axis.Call.invoke: " + (t1-t0) + " " + operationName);
}
return res;
}
catch( AxisFault af) {
if(af.detail != null && af.detail instanceof RemoteException) {
throw ((RemoteException)af.detail);
}
throw af;
}
catch( Exception exp ) {
entLog.debug(Messages.getMessage("toAxisFault00"), exp);
throw AxisFault.makeFault(exp);
}
|
public org.apache.axis.message.SOAPEnvelope | invoke(org.apache.axis.Message msg)/
/**
Invoke the service with a custom Message.
This method simplifies invoke(SOAPEnvelope).
Note: Not part of JAX-RPC specification.
try {
setRequestMessage( msg );
invoke();
msg = msgContext.getResponseMessage();
if (msg == null) {
if (msgContext.isPropertyTrue(FAULT_ON_NO_RESPONSE, false)) {
throw new AxisFault(Messages.getMessage("nullResponse00"));
} else {
return null;
}
}
SOAPEnvelope res = null;
res = msg.getSOAPEnvelope();
return res;
}
catch (Exception exp) {
if (exp instanceof AxisFault) {
throw (AxisFault) exp ;
}
entLog.debug(Messages.getMessage("toAxisFault00"), exp);
throw new AxisFault(
Messages.getMessage("errorInvoking00", "\n" + exp));
}
|
public org.apache.axis.message.SOAPEnvelope | invoke(org.apache.axis.message.SOAPEnvelope env)Invoke the service with a custom SOAPEnvelope.
Note: Not part of JAX-RPC specification.
try {
Message msg = new Message( env );
if (getProperty(CHARACTER_SET_ENCODING) != null) {
msg.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, getProperty(CHARACTER_SET_ENCODING));
} else if (msgContext.getProperty(CHARACTER_SET_ENCODING) != null) {
msg.setProperty(CHARACTER_SET_ENCODING, msgContext.getProperty(CHARACTER_SET_ENCODING));
}
setRequestMessage( msg );
invoke();
msg = msgContext.getResponseMessage();
if (msg == null) {
if (msgContext.isPropertyTrue(FAULT_ON_NO_RESPONSE, false)) {
throw new AxisFault(Messages.getMessage("nullResponse00"));
} else {
return null;
}
}
return( msg.getSOAPEnvelope() );
}
catch( Exception exp ) {
if ( exp instanceof AxisFault ) {
throw (AxisFault) exp ;
}
entLog.debug(Messages.getMessage("toAxisFault00"), exp);
throw AxisFault.makeFault(exp);
}
|
public java.lang.Object | invoke(java.lang.String namespace, java.lang.String method, java.lang.Object[] args)Invoke an RPC service with a method name and arguments.
This will call the service, serializing all the arguments, and
then deserialize the return value.
Note: Not part of JAX-RPC specification.
if (log.isDebugEnabled()) {
log.debug("Enter: Call::invoke(ns, meth, args)");
}
/**
* Since JAX-RPC requires us to specify all or nothing, if setReturnType
* was called (returnType != null) and we have args but addParameter
* wasn't called (paramXMLTypes == null), then toss a fault.
*/
if (getReturnType() != null && args != null && args.length != 0
&& operation.getNumParams() == 0) {
throw new AxisFault(Messages.getMessage("mustSpecifyParms"));
}
RPCElement body = new RPCElement(namespace, method, getParamList(args));
Object ret = invoke( body );
if (log.isDebugEnabled()) {
log.debug("Exit: Call::invoke(ns, meth, args)");
}
return ret;
|
public java.lang.Object | invoke(java.lang.String method, java.lang.Object[] args)Convenience method to invoke a method with a default (empty)
namespace. Calls invoke() above.
Note: Not part of JAX-RPC specification.
return invoke("", method, args);
|
public java.lang.Object | invoke(org.apache.axis.message.RPCElement body)Invoke an RPC service with a pre-constructed RPCElement.
Note: Not part of JAX-RPC specification.
if (log.isDebugEnabled()) {
log.debug("Enter: Call::invoke(RPCElement)");
}
/**
* Since JAX-RPC requires us to specify a return type if we've set
* parameter types, check for this case right now and toss a fault
* if things don't look right.
*/
if (!invokeOneWay && operation != null &&
operation.getNumParams() > 0 && getReturnType() == null) {
// TCK:
// Issue an error if the return type was not set, but continue processing.
//throw new AxisFault(Messages.getMessage("mustSpecifyReturnType"));
log.error(Messages.getMessage("mustSpecifyReturnType"));
}
SOAPEnvelope reqEnv =
new SOAPEnvelope(msgContext.getSOAPConstants(),
msgContext.getSchemaVersion());
SOAPEnvelope resEnv = null ;
Message reqMsg = new Message( reqEnv );
Message resMsg = null ;
Vector resArgs = null ;
Object result = null ;
// Clear the output params
outParams = new HashMap();
outParamsList = new ArrayList();
// Set both the envelope and the RPCElement encoding styles
try {
body.setEncodingStyle(getEncodingStyle());
setRequestMessage(reqMsg);
reqEnv.addBodyElement(body);
reqEnv.setMessageType(Message.REQUEST);
invoke();
} catch (Exception e) {
entLog.debug(Messages.getMessage("toAxisFault00"), e);
throw AxisFault.makeFault(e);
}
resMsg = msgContext.getResponseMessage();
if (resMsg == null) {
if (msgContext.isPropertyTrue(FAULT_ON_NO_RESPONSE, false)) {
throw new AxisFault(Messages.getMessage("nullResponse00"));
} else {
return null;
}
}
resEnv = resMsg.getSOAPEnvelope();
SOAPBodyElement bodyEl = resEnv.getFirstBody();
if (bodyEl == null) {
return null;
}
if (bodyEl instanceof RPCElement) {
try {
resArgs = ((RPCElement) bodyEl).getParams();
} catch (Exception e) {
log.error(Messages.getMessage("exception00"), e);
throw AxisFault.makeFault(e);
}
if (resArgs != null && resArgs.size() > 0) {
// If there is no return, then we start at index 0 to create the outParams Map.
// If there IS a return, then we start with 1.
int outParamStart = 0;
// If we have resArgs and the returnType is specified, then the first
// resArgs is the return. If we have resArgs and neither returnType
// nor paramXMLTypes are specified, then we assume that the caller is
// following the non-JAX-RPC AXIS shortcut of not having to specify
// the return, in which case we again assume the first resArgs is
// the return.
// NOTE 1: the non-JAX-RPC AXIS shortcut allows a potential error
// to escape notice. If the caller IS NOT following the non-JAX-RPC
// shortcut but instead intentionally leaves returnType and params
// null (ie., a method that takes no parameters and returns nothing)
// then, if we DO receive something it should be an error, but this
// code passes it through. The ideal solution here is to require
// this caller to set the returnType to void, but there's no void
// type in XML.
// NOTE 2: we should probably verify that the resArgs element
// types match the expected returnType and paramXMLTypes, but I'm not
// sure how to do that since the resArgs value is a Java Object
// and the returnType and paramXMLTypes are QNames.
// GD 03/15/02 : We're now checking for invalid metadata
// config at the top of this method, so don't need to do it
// here. Check for void return, though.
boolean findReturnParam = false;
QName returnParamQName = null;
if (operation != null) {
returnParamQName = operation.getReturnQName();
}
if (!XMLType.AXIS_VOID.equals(getReturnType())) {
if (returnParamQName == null) {
// Assume the first param is the return
RPCParam param = (RPCParam)resArgs.get(0);
result = param.getObjectValue();
outParamStart = 1;
} else {
// If the QName of the return value was given to us, look
// through the result arguments to find the right name
findReturnParam = true;
}
}
// The following loop looks at the resargs and
// converts the value to the appropriate return/out parameter
// value. If the return value is found, is value is
// placed in result. The remaining resargs are
// placed in the outParams list (note that if a resArg
// is found that does not match a operation parameter qname,
// it is still placed in the outParms list).
for (int i = outParamStart; i < resArgs.size(); i++) {
RPCParam param = (RPCParam) resArgs.get(i);
Class javaType = getJavaTypeForQName(param.getQName());
Object value = param.getObjectValue();
// Convert type if needed
if (javaType != null && value != null &&
!javaType.isAssignableFrom(value.getClass())) {
value = JavaUtils.convert(value, javaType);
}
// Check if this parameter is our return
// otherwise just add it to our outputs
if (findReturnParam &&
returnParamQName.equals(param.getQName())) {
// found it!
result = value;
findReturnParam = false;
} else {
outParams.put(param.getQName(), value);
outParamsList.add(value);
}
}
// added by scheu:
// If the return param is still not found, that means
// the returned value did not have the expected qname.
// The soap specification indicates that this should be
// accepted (and we also fail interop tests if we are strict here).
// Look through the outParms and find one that
// does not match one of the operation parameters.
if (findReturnParam) {
Iterator it = outParams.keySet().iterator();
while (findReturnParam && it.hasNext()) {
QName qname = (QName) it.next();
ParameterDesc paramDesc =
operation.getOutputParamByQName(qname);
if (paramDesc == null) {
// Doesn't match a paramter, so use this for the return
findReturnParam = false;
result = outParams.remove(qname);
}
}
}
// If we were looking for a particular QName for the return and
// still didn't find it, throw an exception
if (findReturnParam) {
String returnParamName = returnParamQName.toString();
throw new AxisFault(Messages.getMessage("noReturnParam",
returnParamName));
}
}
} else {
// This is a SOAPBodyElement, try to treat it like a return value
try {
result = bodyEl.getValueAsType(getReturnType());
} catch (Exception e) {
// just return the SOAPElement
result = bodyEl;
}
}
if (log.isDebugEnabled()) {
log.debug("Exit: Call::invoke(RPCElement)");
}
// Convert type if needed
if (operation != null && operation.getReturnClass() != null) {
result = JavaUtils.convert(result, operation.getReturnClass());
}
return( result );
|
public void | invoke()Invoke this Call with its established MessageContext
(perhaps because you called this.setRequestMessage())
Note: Not part of JAX-RPC specification.
if (log.isDebugEnabled()) {
log.debug("Enter: Call::invoke()");
}
isNeverInvoked = false;
Message reqMsg = null ;
SOAPEnvelope reqEnv = null ;
msgContext.reset();
msgContext.setResponseMessage(null);
msgContext.setProperty( MessageContext.CALL, this );
msgContext.setProperty( WSDL_SERVICE, service );
msgContext.setProperty( WSDL_PORT_NAME, getPortName() );
if ( isMsg ) {
msgContext.setProperty( MessageContext.IS_MSG, "true" );
}
if (username != null) {
msgContext.setUsername(username);
}
if (password != null) {
msgContext.setPassword(password);
}
msgContext.setMaintainSession(maintainSession);
if (operation != null) {
msgContext.setOperation(operation);
operation.setStyle(getOperationStyle());
operation.setUse(getOperationUse());
}
if (useSOAPAction) {
msgContext.setUseSOAPAction(true);
}
if (SOAPActionURI != null) {
msgContext.setSOAPActionURI(SOAPActionURI);
} else {
msgContext.setSOAPActionURI(null);
}
if (timeout != null) {
msgContext.setTimeout(timeout.intValue());
}
msgContext.setHighFidelity(!useStreaming);
// Determine client target service
if (myService != null) {
// If we have a SOAPService kicking around, use that directly
msgContext.setService(myService);
} else {
if (portName != null) {
// No explicit service. If we have a target service name,
// try that.
msgContext.setTargetService(portName.getLocalPart());
} else {
// No direct config, so try the namespace of the first body.
reqMsg = msgContext.getRequestMessage();
boolean isStream = ((SOAPPart)reqMsg.getSOAPPart()).isBodyStream();
if (reqMsg != null && !isStream) {
reqEnv = reqMsg.getSOAPEnvelope();
SOAPBodyElement body = reqEnv.getFirstBody();
if (body != null) {
if ( body.getNamespaceURI() == null ) {
throw new AxisFault("Call.invoke",
Messages.getMessage("cantInvoke00", body.getName()),
null, null);
} else {
msgContext.setTargetService(body.getNamespaceURI());
}
}
}
}
}
if (log.isDebugEnabled()) {
log.debug(Messages.getMessage("targetService",
msgContext.getTargetService()));
}
Message requestMessage = msgContext.getRequestMessage();
if (requestMessage != null) {
try {
msgContext.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, requestMessage.getProperty(SOAPMessage.CHARACTER_SET_ENCODING));
} catch (SOAPException e) {
}
if(myHeaders != null) {
reqEnv = requestMessage.getSOAPEnvelope();
// If we have headers to insert, do so now.
for (int i = 0 ; myHeaders != null && i < myHeaders.size() ; i++ ) {
reqEnv.addHeader((SOAPHeaderElement)myHeaders.get(i));
}
}
}
// set up transport if there is one
if (transport != null) {
transport.setupMessageContext(msgContext, this, service.getEngine());
}
else {
msgContext.setTransportName( transportName );
}
SOAPService svc = msgContext.getService();
if (svc != null) {
svc.setPropertyParent(myProperties);
} else {
msgContext.setPropertyParent(myProperties);
}
// For debugging - print request message
if (log.isDebugEnabled()) {
StringWriter writer = new StringWriter();
try {
SerializationContext ctx = new SerializationContext(writer,
msgContext);
requestMessage.getSOAPEnvelope().output(ctx);
writer.close();
} catch (Exception e) {
throw AxisFault.makeFault(e);
} finally {
log.debug(writer.getBuffer().toString());
}
}
if(!invokeOneWay) {
invokeEngine(msgContext);
} else {
invokeEngineOneWay(msgContext);
}
if (log.isDebugEnabled()) {
log.debug("Exit: Call::invoke()");
}
|
private void | invokeEngine(org.apache.axis.MessageContext msgContext)Invoke the message on the current engine and do not wait for a response.
service.getEngine().invoke( msgContext );
if (transport != null) {
transport.processReturnedMessageContext(msgContext);
}
Message resMsg = msgContext.getResponseMessage();
if (resMsg == null) {
if (msgContext.isPropertyTrue(FAULT_ON_NO_RESPONSE, false)) {
throw new AxisFault(Messages.getMessage("nullResponse00"));
} else {
return;
}
}
/** This must happen before deserialization...
*/
resMsg.setMessageType(Message.RESPONSE);
SOAPEnvelope resEnv = resMsg.getSOAPEnvelope();
SOAPBodyElement respBody = resEnv.getFirstBody();
if (respBody instanceof SOAPFault) {
//we got a fault
if(operation == null ||
operation.getReturnClass() == null ||
operation.getReturnClass() !=
javax.xml.soap.SOAPMessage.class) {
//unless we don't care about the return value or we want
//a raw message back
//get the fault from the body and throw it
throw ((SOAPFault)respBody).getFault();
}
}
|
private void | invokeEngineOneWay(org.apache.axis.MessageContext msgContext)Implement async invocation by running the request in a new thread
//TODO: this is not a good way to do stuff, as it has no error reporting facility
//create a new class
Runnable runnable = new Runnable(){
public void run() {
msgContext.setProperty(Call.ONE_WAY, Boolean.TRUE);
try {
service.getEngine().invoke( msgContext );
} catch (AxisFault af){
//TODO: handle errors properly
log.debug(Messages.getMessage("exceptionPrinting"), af);
}
msgContext.removeProperty(Call.ONE_WAY);
}
};
//create a thread to run it
Thread thread = new Thread(runnable);
//run it
thread.start();
|
public void | invokeOneWay(java.lang.Object[] params)Invokes the operation associated with this Call object using the passed
in parameters as the arguments to the method. This will return
immediately rather than waiting for the server to complete its
processing.
NOTE: the return immediately part isn't implemented yet
try {
invokeOneWay = true;
invoke( params );
} catch( Exception exp ) {
throw new JAXRPCException( exp.toString() );
} finally {
invokeOneWay = false;
}
|
public boolean | isParameterAndReturnSpecRequired(javax.xml.namespace.QName operationName)Is the caller required to provide the parameter and return type
specification?
If true, then
addParameter and setReturnType MUST be called to provide the meta data.
If false, then
addParameter and setReturnType SHOULD NOT be called because the
Call object already has the meta data describing the
parameters and return type. If addParameter is called, the specified
parameter is added to the end of the list of parameters.
return parmAndRetReq;
|
public boolean | isPropertySupported(java.lang.String name)
return propertyNames.contains(name) || (!name.startsWith("java.")
&& !name.startsWith("javax."));
|
public void | registerTypeMapping(java.lang.Class javaType, javax.xml.namespace.QName xmlType, org.apache.axis.encoding.SerializerFactory sf, org.apache.axis.encoding.DeserializerFactory df)Register type mapping information for serialization/deserialization
Note: Not part of JAX-RPC specification.
registerTypeMapping(javaType, xmlType, sf, df, true);
|
public void | registerTypeMapping(java.lang.Class javaType, javax.xml.namespace.QName xmlType, org.apache.axis.encoding.SerializerFactory sf, org.apache.axis.encoding.DeserializerFactory df, boolean force)Register type mapping information for serialization/deserialization
Note: Not part of JAX-RPC specification.
TypeMapping tm = getTypeMapping();
if (!force && tm.isRegistered(javaType, xmlType)) {
return;
}
// Register the information
tm.register(javaType, xmlType, sf, df);
|
public void | registerTypeMapping(java.lang.Class javaType, javax.xml.namespace.QName xmlType, java.lang.Class sfClass, java.lang.Class dfClass)register this type matting
registerTypeMapping(javaType, xmlType, sfClass, dfClass, true);
|
public void | registerTypeMapping(java.lang.Class javaType, javax.xml.namespace.QName xmlType, java.lang.Class sfClass, java.lang.Class dfClass, boolean force)register a type. This only takes place if either the serializer or
deserializer factory could be created.
// Instantiate the factory using introspection.
SerializerFactory sf =
BaseSerializerFactory.createFactory(sfClass, javaType, xmlType);
DeserializerFactory df =
BaseDeserializerFactory.createFactory(dfClass,
javaType,
xmlType);
if (sf != null || df != null) {
registerTypeMapping(javaType, xmlType, sf, df, force);
}
|
public void | removeAllParameters()Clears the list of parameters.
//if (parmAndRetReq) {
operation = new OperationDesc();
operationSetManually = false;
parmAndRetReq = true;
//}
//else {
//throw new JAXRPCException(Messages.getMessage("noParmAndRetReq"));
//}
|
public void | removeProperty(java.lang.String name)Removes (if set) the named property.
if (name == null || !isPropertySupported(name)) {
throw new JAXRPCException(name == null ?
Messages.getMessage("badProp03") :
Messages.getMessage("badProp05", name));
}
myProperties.remove(name);
|
public void | setClientHandlers(org.apache.axis.Handler reqHandler, org.apache.axis.Handler respHandler)Sets the client-side request and response Handlers. This is handy
for programatically setting up client-side work without deploying
via WSDD or the EngineConfiguration mechanism.
// Create a SOAPService which will be used as the client-side service
// handler.
setSOAPService(new SOAPService(reqHandler, null, respHandler));
|
public void | setEncodingStyle(java.lang.String namespaceURI)Sets the encoding style to the URL passed in.
encodingStyleExplicitlySet = true;
msgContext.setEncodingStyle(namespaceURI);
|
public void | setMaintainSession(boolean yesno)Determine whether we'd like to track sessions or not. This
overrides the default setting from the service.
This just passes through the value into the MessageContext.
Note: Not part of JAX-RPC specification.
maintainSession = yesno;
|
public void | setOperation(org.apache.axis.description.OperationDesc operation)Hand a complete OperationDesc to the Call, and note that this was
done so that others don't try to mess with it by calling addParameter,
setReturnType, etc.
this.operation = operation;
operationSetManually = true;
|
public void | setOperation(java.lang.String opName)Prefill as much info from the WSDL as it can.
Right now it's SOAPAction, operation qname, parameter types
and return type of the Web Service.
This methods considers that port name and target endpoint address have
already been set. This is useful when you want to use the same Call
instance for several calls on the same Port
Note: Not part of JAX-RPC specification.
if ( service == null ) {
throw new JAXRPCException( Messages.getMessage("noService04") );
}
// remove all settings concerning an operation
// leave portName and targetEndPoint as they are
this.setOperationName( opName );
this.setEncodingStyle( null );
this.setReturnType( null );
this.removeAllParameters();
javax.wsdl.Service wsdlService = service.getWSDLService();
// Nothing to do is the WSDL is not already set.
if(wsdlService == null) {
return;
}
Port port = wsdlService.getPort( portName.getLocalPart() );
if ( port == null ) {
throw new JAXRPCException( Messages.getMessage("noPort00", "" +
portName) );
}
Binding binding = port.getBinding();
PortType portType = binding.getPortType();
if ( portType == null ) {
throw new JAXRPCException( Messages.getMessage("noPortType00", "" +
portName) );
}
this.setPortTypeName(portType.getQName());
List operations = portType.getOperations();
if ( operations == null ) {
throw new JAXRPCException( Messages.getMessage("noOperation01",
opName) );
}
Operation op = null ;
for ( int i = 0 ; i < operations.size() ; i++, op=null ) {
op = (Operation) operations.get( i );
if ( opName.equals( op.getName() ) ) {
break ;
}
}
if ( op == null ) {
throw new JAXRPCException( Messages.getMessage("noOperation01",
opName) );
}
// Get the SOAPAction
////////////////////////////////////////////////////////////////////
List list = port.getExtensibilityElements();
String opStyle = null;
BindingOperation bop = binding.getBindingOperation(opName,
null, null);
if ( bop == null ) {
throw new JAXRPCException( Messages.getMessage("noOperation02",
opName ));
}
list = bop.getExtensibilityElements();
for ( int i = 0 ; list != null && i < list.size() ; i++ ) {
Object obj = list.get(i);
if ( obj instanceof SOAPOperation ) {
SOAPOperation sop = (SOAPOperation) obj ;
opStyle = ((SOAPOperation) obj).getStyle();
String action = sop.getSoapActionURI();
if ( action != null ) {
setUseSOAPAction(true);
setSOAPActionURI(action);
}
else {
setUseSOAPAction(false);
setSOAPActionURI(null);
}
break ;
}
}
// Get the body's namespace URI and encoding style
////////////////////////////////////////////////////////////////////
BindingInput bIn = bop.getBindingInput();
if ( bIn != null ) {
list = bIn.getExtensibilityElements();
for ( int i = 0 ; list != null && i < list.size() ; i++ ) {
Object obj = list.get(i);
if( obj instanceof MIMEMultipartRelated){
MIMEMultipartRelated mpr=(MIMEMultipartRelated) obj;
Object part= null;
List l= mpr.getMIMEParts();
for(int j=0; l!= null && j< l.size() && part== null; j++){
MIMEPart mp = (MIMEPart)l.get(j);
List ll= mp.getExtensibilityElements();
for(int k=0; ll != null && k < ll.size() && part == null;
k++){
part= ll.get(k);
if ( !(part instanceof SOAPBody)) {
part = null;
}
}
}
if(null != part) {
obj= part;
}
}
if ( obj instanceof SOAPBody ) {
SOAPBody sBody = (SOAPBody) obj ;
list = sBody.getEncodingStyles();
if ( list != null && list.size() > 0 ) {
this.setEncodingStyle( (String) list.get(0) );
}
String ns = sBody.getNamespaceURI();
if (ns != null && !ns.equals("")) {
setOperationName( new QName( ns, opName ) );
}
break ;
}
}
}
Service service = this.getService();
SymbolTable symbolTable = service.getWSDLParser().getSymbolTable();
BindingEntry bEntry = symbolTable.getBindingEntry(binding.getQName());
Parameters parameters = bEntry.getParameters(bop.getOperation());
// loop over paramters and set up in/out params
for (int j = 0; j < parameters.list.size(); ++j) {
Parameter p = (Parameter) parameters.list.get(j);
// Get the QName representing the parameter type
QName paramType = Utils.getXSIType(p);
// checks whether p is an IN or OUT header
// and adds it as a header parameter else
// add it to the body
ParameterMode mode = modes[p.getMode()];
if (p.isInHeader() || p.isOutHeader()) {
this.addParameterAsHeader(p.getQName(), paramType,
mode, mode);
} else {
this.addParameter(p.getQName(), paramType, mode);
}
}
Map faultMap = bEntry.getFaults();
// Get the list of faults for this operation
ArrayList faults = (ArrayList) faultMap.get(bop);
// check for no faults
if (faults == null) {
return;
}
// For each fault, register its information
for (Iterator faultIt = faults.iterator(); faultIt.hasNext();) {
FaultInfo info = (FaultInfo) faultIt.next();
QName qname = info.getQName();
info.getMessage();
// if no parts in fault, skip it!
if (qname == null) {
continue;
}
QName xmlType = info.getXMLType();
Class clazz = getTypeMapping().getClassForQName(xmlType);
if (clazz != null) {
addFault(qname, clazz, xmlType, true);
} else {
//we cannot map from the info to a java class
//In Axis1.1 and before this was silently swallowed. Now we log it
log.debug(Messages.getMessage("clientNoTypemapping", xmlType.toString()));
}
}
// set output type
if (parameters.returnParam != null) {
// Get the QName for the return Type
QName returnType = Utils.getXSIType(parameters.returnParam);
QName returnQName = parameters.returnParam.getQName();
// Get the javaType
String javaType = null;
if (parameters.returnParam.getMIMEInfo() != null) {
javaType = "javax.activation.DataHandler";
}
else {
javaType = parameters.returnParam.getType().getName();
}
if (javaType == null) {
javaType = "";
}
else {
javaType = javaType + ".class";
}
this.setReturnType(returnType);
try {
Class clazz = ClassUtils.forName(javaType);
this.setReturnClass(clazz);
} catch (ClassNotFoundException swallowedException) {
//log that this lookup failed,
log.debug(Messages.getMessage("clientNoReturnClass",
javaType));
}
this.setReturnQName(returnQName);
}
else {
this.setReturnType(org.apache.axis.encoding.XMLType.AXIS_VOID);
}
boolean hasMIME = Utils.hasMIME(bEntry, bop);
Use use = bEntry.getInputBodyType(bop.getOperation());
setOperationUse(use);
if (use == Use.LITERAL) {
// Turn off encoding
setEncodingStyle(null);
// turn off XSI types
setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
}
if (hasMIME || use == Use.LITERAL) {
// If it is literal, turn off multirefs.
//
// If there are any MIME types, turn off multirefs.
// I don't know enough about the guts to know why
// attachments don't work with multirefs, but they don't.
setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
}
Style style = Style.getStyle(opStyle, bEntry.getBindingStyle());
if (style == Style.DOCUMENT && symbolTable.isWrapped()) {
style = Style.WRAPPED;
}
setOperationStyle(style);
// Operation name
if (style == Style.WRAPPED) {
// We need to make sure the operation name, which is what we
// wrap the elements in, matches the Qname of the parameter
// element.
Map partsMap = bop.getOperation().getInput().getMessage().getParts();
Part p = (Part)partsMap.values().iterator().next();
QName q = p.getElementName();
setOperationName(q);
} else {
QName elementQName =
Utils.getOperationQName(bop, bEntry, symbolTable);
if (elementQName != null) {
setOperationName(elementQName);
}
}
// Indicate that the parameters and return no longer
// need to be specified with addParameter calls.
parmAndRetReq = false;
return;
|
public void | setOperation(javax.xml.namespace.QName portName, java.lang.String opName)prefill as much info from the WSDL as it can.
Right now it's target URL, SOAPAction, Parameter types,
and return type of the Web Service.
If wsdl is not present, this function set port name and operation name
and does not modify target endpoint address.
Note: Not part of JAX-RPC specification.
setOperation(portName, new QName(opName));
|
public void | setOperation(javax.xml.namespace.QName portName, javax.xml.namespace.QName opName)prefill as much info from the WSDL as it can.
Right now it's target URL, SOAPAction, Parameter types,
and return type of the Web Service.
If wsdl is not present, this function set port name and operation name
and does not modify target endpoint address.
Note: Not part of JAX-RPC specification.
if ( service == null )
throw new JAXRPCException( Messages.getMessage("noService04") );
// Make sure we're making a fresh start.
this.setPortName( portName );
this.setOperationName( opName );
this.setReturnType( null );
this.removeAllParameters();
javax.wsdl.Service wsdlService = service.getWSDLService();
// Nothing to do is the WSDL is not already set.
if(wsdlService == null) {
return;
}
// we reinitialize target endpoint only if we have wsdl
this.setTargetEndpointAddress( (URL) null );
Port port = wsdlService.getPort( portName.getLocalPart() );
if ( port == null ) {
throw new JAXRPCException( Messages.getMessage("noPort00", "" +
portName) );
}
// Get the URL
////////////////////////////////////////////////////////////////////
List list = port.getExtensibilityElements();
for ( int i = 0 ; list != null && i < list.size() ; i++ ) {
Object obj = list.get(i);
if ( obj instanceof SOAPAddress ) {
try {
SOAPAddress addr = (SOAPAddress) obj ;
URL url = new URL(addr.getLocationURI());
this.setTargetEndpointAddress(url);
}
catch(Exception exp) {
throw new JAXRPCException(
Messages.getMessage("cantSetURI00", "" + exp) );
}
}
}
setOperation(opName.getLocalPart());
|
public void | setOperationName(javax.xml.namespace.QName opName)Sets the operation name associated with this Call object. This will
not check the WSDL (if there is WSDL) to make sure that it's a valid
operation name.
operationName = opName ;
|
public void | setOperationName(java.lang.String opName)This is a convenience method. If the user doesn't care about the QName
of the operation, the user can call this method, which converts a String
operation name to a QName.
operationName = new QName(opName);
|
public void | setOperationStyle(java.lang.String operationStyle)Set the operation style: "document", "rpc"
Style style = Style.getStyle(operationStyle, Style.DEFAULT);
setOperationStyle(style);
|
public void | setOperationStyle(org.apache.axis.constants.Style operationStyle)Set the operation style
if (operation == null) {
operation = new OperationDesc();
}
operation.setStyle(operationStyle);
// If no one has explicitly set the use, we should track
// the style. If it's non-RPC, default to LITERAL.
if (!useExplicitlySet) {
if (operationStyle != Style.RPC) {
operation.setUse(Use.LITERAL);
}
}
// If no one has explicitly set the encodingStyle, we should
// track the style. If it's RPC, default to SOAP-ENC, otherwise
// default to "".
if (!encodingStyleExplicitlySet) {
String encStyle = "";
if (operationStyle == Style.RPC) {
// RPC style defaults to encoded, otherwise default to literal
encStyle = msgContext.getSOAPConstants().getEncodingURI();
}
msgContext.setEncodingStyle(encStyle);
}
|
public void | setOperationUse(java.lang.String operationUse)Set the operation use: "literal", "encoded"
Use use = Use.getUse(operationUse, Use.DEFAULT);
setOperationUse(use);
|
public void | setOperationUse(org.apache.axis.constants.Use operationUse)Set the operation use
useExplicitlySet = true;
if (operation == null) {
operation = new OperationDesc();
}
operation.setUse(operationUse);
if (!encodingStyleExplicitlySet) {
String encStyle = "";
if (operationUse == Use.ENCODED) {
// RPC style defaults to encoded, otherwise default to literal
encStyle = msgContext.getSOAPConstants().getEncodingURI();
}
msgContext.setEncodingStyle(encStyle);
}
|
public void | setOption(java.lang.String name, java.lang.Object value)Set engine option.
Note: Not part of JAX-RPC specification.
service.getEngine().setOption(name, value);
|
public void | setPassword(java.lang.String password)Set the password.
this.password = password;
|
public void | setPortName(javax.xml.namespace.QName portName)Sets the port name of this Call object. This call will not set
any additional fields, nor will it do any checking to verify that
this port name is actually defined in the WSDL - for now anyway.
this.portName = portName;
|
public void | setPortTypeName(javax.xml.namespace.QName portType)Sets the port type name of this Call object. This call will not set
any additional fields, nor will it do any checking to verify that
this port type is actually defined in the WSDL - for now anyway.
this.portTypeName = portType;
|
public void | setProperty(java.lang.String name, java.lang.Object value)Allows you to set a named property to the passed in value.
There are a few known properties (like username, password, etc)
that are variables in Call. The rest of the properties are
stored in a Hashtable. These common properties should be
accessed via the accessors for speed/type safety, but they may
still be obtained via this method. It's up to one of the
Handlers (or the Axis engine itself) to go looking for
one of them.
There are various well defined properties defined in the
JAX-RPC specification and declared in the Call and Stub classes.
It is not possible to set any other properties beginning in java. or
javax. that are not in the specification.
if (name == null || value == null) {
throw new JAXRPCException(
Messages.getMessage(name == null ?
"badProp03" : "badProp04"));
}
else if (name.equals(USERNAME_PROPERTY)) {
verifyStringProperty(name, value);
setUsername((String) value);
}
else if (name.equals(PASSWORD_PROPERTY)) {
verifyStringProperty(name, value);
setPassword((String) value);
}
else if (name.equals(SESSION_MAINTAIN_PROPERTY)) {
verifyBooleanProperty(name, value);
setMaintainSession(((Boolean) value).booleanValue());
}
else if (name.equals(OPERATION_STYLE_PROPERTY)) {
verifyStringProperty(name, value);
setOperationStyle((String) value);
if (getOperationStyle() == Style.DOCUMENT ||
getOperationStyle() == Style.WRAPPED) {
setOperationUse(Use.LITERAL_STR);
} else if (getOperationStyle() == Style.RPC) {
setOperationUse(Use.ENCODED_STR);
}
}
else if (name.equals(SOAPACTION_USE_PROPERTY)) {
verifyBooleanProperty(name, value);
setUseSOAPAction(((Boolean) value).booleanValue());
}
else if (name.equals(SOAPACTION_URI_PROPERTY)) {
verifyStringProperty(name, value);
setSOAPActionURI((String) value);
}
else if (name.equals(ENCODINGSTYLE_URI_PROPERTY)) {
verifyStringProperty(name, value);
setEncodingStyle((String) value);
}
else if (name.equals(Stub.ENDPOINT_ADDRESS_PROPERTY)) {
verifyStringProperty(name, value);
setTargetEndpointAddress((String) value);
}
else if ( name.equals(TRANSPORT_NAME) ) {
verifyStringProperty(name, value);
transportName = (String) value ;
if (transport != null) {
transport.setTransportName((String) value);
}
}
else if ( name.equals(ATTACHMENT_ENCAPSULATION_FORMAT) ) {
verifyStringProperty(name, value);
if(!value.equals(ATTACHMENT_ENCAPSULATION_FORMAT_MIME ) &&
!value.equals(ATTACHMENT_ENCAPSULATION_FORMAT_MTOM ) &&
!value.equals(ATTACHMENT_ENCAPSULATION_FORMAT_DIME ))
throw new JAXRPCException(
Messages.getMessage("badattachmenttypeerr", new String[] {
(String) value, ATTACHMENT_ENCAPSULATION_FORMAT_MIME + " "
+ATTACHMENT_ENCAPSULATION_FORMAT_MTOM + " "
+ATTACHMENT_ENCAPSULATION_FORMAT_DIME }));
}
else if (name.equals(CONNECTION_TIMEOUT_PROPERTY)) {
verifyIntegerProperty(name,value);
setTimeout((Integer)value);
}
else if (name.equals(STREAMING_PROPERTY)) {
verifyBooleanProperty(name, value);
setStreaming(((Boolean) value).booleanValue());
}
else if (name.equals(CHARACTER_SET_ENCODING)) {
verifyStringProperty(name, value);
}
else if (name.startsWith("java.") || name.startsWith("javax.")) {
throw new JAXRPCException(
Messages.getMessage("badProp05", name));
}
myProperties.put(name, value);
|
public void | setRequestMessage(org.apache.axis.Message msg)Directly set the request message in our MessageContext.
This allows custom message creation.
Note: Not part of JAX-RPC specification.
String attachformat= (String)getProperty(
ATTACHMENT_ENCAPSULATION_FORMAT);
if(null != attachformat) {
Attachments attachments=msg.getAttachmentsImpl();
if(null != attachments) {
if( ATTACHMENT_ENCAPSULATION_FORMAT_MIME.equals(attachformat)) {
attachments.setSendType(Attachments.SEND_TYPE_MIME);
} else if ( ATTACHMENT_ENCAPSULATION_FORMAT_MTOM.equals(attachformat)) {
attachments.setSendType(Attachments.SEND_TYPE_MTOM);
} else if ( ATTACHMENT_ENCAPSULATION_FORMAT_DIME.equals(attachformat)) {
attachments.setSendType(Attachments.SEND_TYPE_DIME);
}
}
}
if(null != attachmentParts && !attachmentParts.isEmpty()){
try{
Attachments attachments= msg.getAttachmentsImpl();
if(null == attachments) {
throw new RuntimeException(
Messages.getMessage("noAttachments"));
}
attachments.setAttachmentParts(attachmentParts);
}catch(AxisFault ex){
log.info(Messages.getMessage("axisFault00"), ex);
throw new RuntimeException(ex.getMessage());
}
}
msgContext.setRequestMessage(msg);
attachmentParts.clear();
|
public void | setReturnClass(java.lang.Class cls)Sets the desired return Java Class. This is a convenience method
which will cause the Call to automatically convert return values
into a desired class if possible. For instance, we return object
arrays by default now for SOAP arrays - you could specify:
setReturnClass(Vector.class)
and you'd get a Vector back from invoke() instead of having to do
the conversion yourself.
Note: Not part of JAX-RPC specification. To be JAX-RPC compliant,
use setReturnType(QName, Class).
if (operationSetManually) {
throw new RuntimeException(
Messages.getMessage("operationAlreadySet"));
}
if (operation == null)
operation = new OperationDesc();
operation.setReturnClass(cls);
TypeMapping tm = getTypeMapping();
operation.setReturnType(tm.getTypeQName(cls));
parmAndRetReq = true;
|
public void | setReturnQName(javax.xml.namespace.QName qname)Set the QName of the return element
NOT part of JAX-RPC
if (operationSetManually) {
throw new RuntimeException(
Messages.getMessage("operationAlreadySet"));
}
if (operation == null)
operation = new OperationDesc();
operation.setReturnQName(qname);
|
public void | setReturnType(javax.xml.namespace.QName type)Sets the return type of the operation associated with this Call object.
if (operationSetManually) {
throw new RuntimeException(
Messages.getMessage("operationAlreadySet"));
}
if (operation == null)
operation = new OperationDesc();
// In order to allow any Call to be re-used, Axis
// chooses to allow setReturnType to be changed when
// parmAndRetReq==false. This does not conflict with
// JSR 101 which indicates an exception MAY be thrown.
//if (parmAndRetReq) {
operation.setReturnType(type);
TypeMapping tm = getTypeMapping();
operation.setReturnClass(tm.getClassForQName(type));
parmAndRetReq = true;
//}
//else {
//throw new JAXRPCException(Messages.getMessage("noParmAndRetReq"));
//}
|
public void | setReturnType(javax.xml.namespace.QName xmlType, java.lang.Class javaType)Sets the return type for a specific operation.
setReturnType(xmlType);
// Use specified type as the operation return
operation.setReturnClass(javaType);
|
public void | setReturnTypeAsHeader(javax.xml.namespace.QName xmlType)Set the return type as a header
setReturnType(xmlType);
operation.setReturnHeader(true);
|
public void | setReturnTypeAsHeader(javax.xml.namespace.QName xmlType, java.lang.Class javaType)Set the return type as a header
setReturnType(xmlType, javaType);
operation.setReturnHeader(true);
|
public void | setSOAPActionURI(java.lang.String SOAPActionURI)Set the soapAction URI.
useSOAPAction = true;
this.SOAPActionURI = SOAPActionURI;
|
public void | setSOAPService(org.apache.axis.handlers.soap.SOAPService service)Set the service so that it defers missing property gets to the
Call. So when client-side Handlers get at the MessageContext,
the property scoping will be MC -> SOAPService -> Call
myService = service;
if (service != null) {
// Set the service so that it defers missing property gets to the
// Call. So when client-side Handlers get at the MessageContext,
// the property scoping will be MC -> SOAPService -> Call -> Engine
// THE ORDER OF THESE TWO CALLS IS IMPORTANT, since setting the
// engine on a service will set the property parent for the service
service.setEngine(this.service.getAxisClient());
service.setPropertyParent(myProperties);
}
|
public void | setSOAPVersion(org.apache.axis.soap.SOAPConstants soapConstants)Allow the user to set the default SOAP version. For SOAP 1.2, pass
SOAPConstants.SOAP12_CONSTANTS.
msgContext.setSOAPConstants(soapConstants);
|
public void | setStreaming(boolean useStreaming)
this.useStreaming = useStreaming;
|
public void | setTargetEndpointAddress(java.lang.String address)Sets the endpoint address of the target service port. This address must
correspond to the transport specified in the binding for this Call
instance.
URL urlAddress;
try {
urlAddress = new URL(address);
}
catch (MalformedURLException mue) {
throw new JAXRPCException(mue);
}
setTargetEndpointAddress(urlAddress);
|
public void | setTargetEndpointAddress(java.net.URL address)Sets the URL of the target Web Service.
Note: Not part of JAX-RPC specification.
try {
if ( address == null ) {
setTransport(null);
return ;
}
String protocol = address.getProtocol();
// Handle the case where the protocol is the same but we
// just want to change the URL - if so just set the URL,
// creating a new Transport object will drop all session
// data - and we want that stuff to persist between invoke()s.
// Technically the session data should be in the message
// context so that it can be persistent across transports
// as well, but for now the data is in the Transport object.
////////////////////////////////////////////////////////////////
if ( this.transport != null ) {
String oldAddr = this.transport.getUrl();
if ( oldAddr != null && !oldAddr.equals("") ) {
URL tmpURL = new URL( oldAddr );
String oldProto = tmpURL.getProtocol();
if ( protocol.equals(oldProto) ) {
this.transport.setUrl( address.toString() );
return ;
}
}
}
// Do we already have a transport for this address?
Transport transport = service.getTransportForURL(address);
if (transport != null) {
setTransport(transport);
}
else {
// We don't already have a transport for this address. Create one.
transport = getTransportForProtocol(protocol);
if (transport == null)
throw new AxisFault("Call.setTargetEndpointAddress",
Messages.getMessage("noTransport01",
protocol), null, null);
transport.setUrl(address.toString());
setTransport(transport);
service.registerTransportForURL(address, transport);
}
}
catch( Exception exp ) {
log.error(Messages.getMessage("exception00"), exp);
// do what?
// throw new AxisFault("Call.setTargetEndpointAddress",
//"Malformed URL Exception: " + e.getMessage(), null, null);
}
|
public void | setTimeout(java.lang.Integer timeout)
this.timeout = timeout;
|
public void | setTransport(Transport trans)Set the Transport
Note: Not part of JAX-RPC specification.
transport = trans;
if (log.isDebugEnabled())
log.debug(Messages.getMessage("transport00", "" + transport));
|
public static void | setTransportForProtocol(java.lang.String protocol, java.lang.Class transportClass)Register a Transport that should be used for URLs of the specified
protocol.
Note: Not part of JAX-RPC specification.
if (Transport.class.isAssignableFrom(transportClass)) {
transports.put(protocol, transportClass);
}
else {
throw new InternalException(transportClass.toString());
}
|
public void | setUseSOAPAction(boolean useSOAPAction)Flag to indicate if soapAction should be used.
this.useSOAPAction = useSOAPAction;
|
public void | setUsername(java.lang.String username)Set the username.
this.username = username;
|
public boolean | useSOAPAction()Discover if soapAction is being used.
return useSOAPAction;
|
private void | verifyBooleanProperty(java.lang.String name, java.lang.Object value)Verify that the type of the object is a Boolean, and throw
an i18n-ized exception if not
if (!(value instanceof Boolean)) {
throw new JAXRPCException(
Messages.getMessage("badProp00", new String[]
{name,
"java.lang.Boolean",
value.getClass().getName()}));
}
|
private void | verifyIntegerProperty(java.lang.String name, java.lang.Object value)Verify that the type of the object is an Integer, and throw
an i18n-ized exception if not
if (!(value instanceof Integer)) {
throw new JAXRPCException(
Messages.getMessage("badProp00", new String[]
{name,
"java.lang.Integer",
value.getClass().getName()}));
}
|
private void | verifyStringProperty(java.lang.String name, java.lang.Object value)Verify that the type of the object is a String, and throw
an i18n-ized exception if not
if (!(value instanceof String)) {
throw new JAXRPCException(
Messages.getMessage("badProp00", new String[]
{name,
"java.lang.String",
value.getClass().getName()}));
}
|