use of com.google.api.ads.common.lib.client.RemoteCallReturn in project googleads-java-lib by googleads.
the class SoapServiceClientTest method testCallSoapClient.
@Test
@SuppressWarnings("unchecked")
public void testCallSoapClient() throws Throwable {
RemoteCallReturn expectedRemoteCallReturn = new RemoteCallReturn.Builder().build();
SoapCall<Object> soapCall = Mockito.mock(SoapCall.class);
when(soapClientHandler.invokeSoapCall(soapCall)).thenReturn(expectedRemoteCallReturn);
RemoteCallReturn remoteCallReturn = soapServiceClient.callSoapClient(soapCall);
assertSame(expectedRemoteCallReturn, remoteCallReturn);
}
use of com.google.api.ads.common.lib.client.RemoteCallReturn in project googleads-java-lib by googleads.
the class AxisHandler method invokeSoapCall.
/**
* Invoke a SOAP call.
*
* @param soapCall the call to make to a SOAP web service
* @return information about the SOAP response
*/
@Override
public RemoteCallReturn invokeSoapCall(SoapCall<Stub> soapCall) {
Stub stub = soapCall.getSoapClient();
RemoteCallReturn.Builder builder = new RemoteCallReturn.Builder();
synchronized (stub) {
Object result = null;
try {
result = invoke(soapCall);
} catch (InvocationTargetException e) {
builder.withException(e.getTargetException());
} catch (Exception e) {
builder.withException(e);
} finally {
MessageContext messageContext = stub._getCall().getMessageContext();
RequestInfo.Builder requestInfoBuilder = new RequestInfo.Builder().withMethodName(stub._getCall().getOperationName().getLocalPart()).withServiceName(stub._getService().getServiceName().getLocalPart()).withUrl(stub._getCall().getTargetEndpointAddress());
requestInfoXPathSet.parseMessage(requestInfoBuilder, messageContext.getRequestMessage());
builder.withRequestInfo(requestInfoBuilder.build());
ResponseInfo.Builder responseInfoBuilder = new ResponseInfo.Builder();
responseInfoXPathSet.parseMessage(responseInfoBuilder, messageContext.getResponseMessage());
builder.withResponseInfo(responseInfoBuilder.build());
}
return builder.withReturnValue(result).build();
}
}
Aggregations