|
|
|
|
@ -29,11 +29,7 @@ public abstract class SntrisWSBindingStub extends Stub {
|
|
|
|
|
protected abstract Descriptor descriptor();
|
|
|
|
|
|
|
|
|
|
protected void init(Service service, Class<?>... klasses) {
|
|
|
|
|
if (service == null) {
|
|
|
|
|
super.service = new Service();
|
|
|
|
|
} else {
|
|
|
|
|
super.service = service;
|
|
|
|
|
}
|
|
|
|
|
super.service = service != null ? service : new Service();
|
|
|
|
|
((Service)super.service).setTypeMappingVersion("1.2");
|
|
|
|
|
|
|
|
|
|
Descriptor desc = descriptor();
|
|
|
|
|
@ -47,30 +43,26 @@ public abstract class SntrisWSBindingStub extends Stub {
|
|
|
|
|
|
|
|
|
|
protected Call createCall() throws RemoteException {
|
|
|
|
|
try {
|
|
|
|
|
Call _call = super._createCall();
|
|
|
|
|
if (super.maintainSessionSet) {
|
|
|
|
|
_call.setMaintainSession(super.maintainSession);
|
|
|
|
|
}
|
|
|
|
|
if (super.cachedUsername != null) {
|
|
|
|
|
_call.setUsername(super.cachedUsername);
|
|
|
|
|
}
|
|
|
|
|
if (super.cachedPassword != null) {
|
|
|
|
|
_call.setPassword(super.cachedPassword);
|
|
|
|
|
}
|
|
|
|
|
if (super.cachedEndpoint != null) {
|
|
|
|
|
_call.setTargetEndpointAddress(super.cachedEndpoint);
|
|
|
|
|
}
|
|
|
|
|
if (super.cachedTimeout != null) {
|
|
|
|
|
_call.setTimeout(super.cachedTimeout);
|
|
|
|
|
}
|
|
|
|
|
if (super.cachedPortName != null) {
|
|
|
|
|
_call.setPortName(super.cachedPortName);
|
|
|
|
|
}
|
|
|
|
|
Enumeration keys = super.cachedProperties.keys();
|
|
|
|
|
Call call = _createCall();
|
|
|
|
|
if (maintainSessionSet)
|
|
|
|
|
call.setMaintainSession(maintainSession);
|
|
|
|
|
if (cachedUsername != null)
|
|
|
|
|
call.setUsername(cachedUsername);
|
|
|
|
|
if (cachedPassword != null)
|
|
|
|
|
call.setPassword(cachedPassword);
|
|
|
|
|
if (cachedEndpoint != null)
|
|
|
|
|
call.setTargetEndpointAddress(cachedEndpoint);
|
|
|
|
|
if (cachedTimeout != null)
|
|
|
|
|
call.setTimeout(cachedTimeout);
|
|
|
|
|
if (cachedPortName != null)
|
|
|
|
|
call.setPortName(cachedPortName);
|
|
|
|
|
|
|
|
|
|
Enumeration<?> keys = cachedProperties.keys();
|
|
|
|
|
while (keys.hasMoreElements()) {
|
|
|
|
|
String key = (String) keys.nextElement();
|
|
|
|
|
_call.setProperty(key, super.cachedProperties.get(key));
|
|
|
|
|
String key = (String)keys.nextElement();
|
|
|
|
|
call.setProperty(key, cachedProperties.get(key));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// All the type mapping information is registered
|
|
|
|
|
// when the first call is made.
|
|
|
|
|
// The type mapping information is actually registered in
|
|
|
|
|
@ -79,56 +71,56 @@ public abstract class SntrisWSBindingStub extends Stub {
|
|
|
|
|
synchronized (this) {
|
|
|
|
|
if (firstCall()) {
|
|
|
|
|
// must set encoding style before registering serializers
|
|
|
|
|
_call.setEncodingStyle(null);
|
|
|
|
|
call.setEncodingStyle(null);
|
|
|
|
|
for (int i = 0; i < cachedSerFactories.size(); ++i) {
|
|
|
|
|
Class<?> cls = cachedSerClasses.get(i);
|
|
|
|
|
QName qName = cachedSerQNames.get(i);
|
|
|
|
|
Object x = cachedSerFactories.get(i);
|
|
|
|
|
if (x instanceof Class<?> sf) {
|
|
|
|
|
Class<?> df = (Class<?>)cachedDeserFactories.get(i);
|
|
|
|
|
_call.registerTypeMapping(cls, qName, sf, df, false);
|
|
|
|
|
call.registerTypeMapping(cls, qName, sf, df, false);
|
|
|
|
|
}
|
|
|
|
|
else if (x instanceof SerializerFactory sf) {
|
|
|
|
|
DeserializerFactory df = (DeserializerFactory)cachedDeserFactories.get(i);
|
|
|
|
|
_call.registerTypeMapping(cls, qName, sf, df, false);
|
|
|
|
|
call.registerTypeMapping(cls, qName, sf, df, false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return _call;
|
|
|
|
|
return call;
|
|
|
|
|
} catch (Throwable _t) {
|
|
|
|
|
throw new AxisFault("Failure trying to get the Call object", _t);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected <T> T execute(OperationDesc oper, String soapActionURI, Object... params) throws RemoteException {
|
|
|
|
|
if (super.cachedEndpoint == null)
|
|
|
|
|
if (cachedEndpoint == null)
|
|
|
|
|
throw new NoEndPointException();
|
|
|
|
|
|
|
|
|
|
Call _call = createCall();
|
|
|
|
|
_call.setOperation(oper);
|
|
|
|
|
_call.setUseSOAPAction(true);
|
|
|
|
|
_call.setSOAPActionURI(soapActionURI);
|
|
|
|
|
_call.setEncodingStyle(null);
|
|
|
|
|
_call.setProperty(Call.SEND_TYPE_ATTR, Boolean.FALSE);
|
|
|
|
|
_call.setProperty(AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
|
|
|
|
|
_call.setSOAPVersion(SOAPConstants.SOAP11_CONSTANTS);
|
|
|
|
|
_call.setOperationName(descriptor().qname(oper.getName()));
|
|
|
|
|
|
|
|
|
|
setRequestHeaders(_call);
|
|
|
|
|
setAttachments(_call);
|
|
|
|
|
|
|
|
|
|
Object _resp = _call.invoke(params);
|
|
|
|
|
if (_resp instanceof RemoteException re)
|
|
|
|
|
Call call = createCall();
|
|
|
|
|
call.setOperation(oper);
|
|
|
|
|
call.setUseSOAPAction(true);
|
|
|
|
|
call.setSOAPActionURI(soapActionURI);
|
|
|
|
|
call.setEncodingStyle(null);
|
|
|
|
|
call.setProperty(Call.SEND_TYPE_ATTR, Boolean.FALSE);
|
|
|
|
|
call.setProperty(AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
|
|
|
|
|
call.setSOAPVersion(SOAPConstants.SOAP11_CONSTANTS);
|
|
|
|
|
call.setOperationName(descriptor().qname(oper.getName()));
|
|
|
|
|
|
|
|
|
|
setRequestHeaders(call);
|
|
|
|
|
setAttachments(call);
|
|
|
|
|
|
|
|
|
|
Object resp = call.invoke(params);
|
|
|
|
|
if (resp instanceof RemoteException re)
|
|
|
|
|
throw re;
|
|
|
|
|
|
|
|
|
|
extractAttachments(_call);
|
|
|
|
|
extractAttachments(call);
|
|
|
|
|
Class<T> returnType = oper.getReturnClass();
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
return returnType.cast(_resp);
|
|
|
|
|
return returnType.cast(resp);
|
|
|
|
|
} catch (Exception _exception) {
|
|
|
|
|
return returnType.cast(JavaUtils.convert(_resp, returnType));
|
|
|
|
|
return returnType.cast(JavaUtils.convert(resp, returnType));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|