/** @see SoapServiceClient#handleException */ @Override protected Throwable handleException(Throwable e) { return super.handleException(e); } }
/** * Constructor. */ public Builder() { this.remoteCallReturn = new RemoteCallReturn(); }
public Builder() { responseInfo = new ResponseInfo(); }
@Test @SuppressWarnings("unchecked") public void testCallSoapClient_exception() { RemoteCallReturn expectedRemoteCallReturn = new RemoteCallReturn.Builder().withException(MockSoapClient.EXCEPTION).build(); SoapCall<Object> soapCall = Mockito.mock(SoapCall.class); when(soapClientHandler.invokeSoapCall(soapCall)).thenReturn(expectedRemoteCallReturn); RemoteCallReturn testRemoteCallReturn = soapServiceClient.callSoapClient(soapCall); assertSame(MockSoapClient.EXCEPTION, testRemoteCallReturn.getException()); }
public void logRequestDetails(RemoteCallReturn remoteCallReturn) { if (remoteCallReturn == null) { return; } boolean isSuccess = remoteCallReturn.getException() == null; if (!isDetailsLoggable(isSuccess)) { return; } String prettyRequest = null; if (remoteCallReturn.getRequestInfo() != null) { prettyRequest = prettyPrinter.prettyPrint(remoteCallReturn.getRequestInfo().getPayload()); } String prettyResponse = null; if (remoteCallReturn.getResponseInfo() != null) { prettyResponse = prettyPrinter.prettyPrint(remoteCallReturn.getResponseInfo().getPayload()); } if (isSuccess) { detailLogger.debug(DETAILS_REQUEST_TEMPLATE, remoteCallType, prettyRequest); detailLogger.debug(DETAILS_RESPONSE_TEMPLATE, remoteCallType, prettyResponse); } else { detailLogger.info(DETAILS_REQUEST_TEMPLATE, remoteCallType, prettyRequest); detailLogger.info(DETAILS_RESPONSE_TEMPLATE, remoteCallType, prettyResponse); } }
@Inject public JaxWsSoapContextHandler( RequestInfoXPathSet requestInfoXPathSet, ResponseInfoXPathSet responseInfoXPathSet) { this.requestInfoXPathSet = requestInfoXPathSet; this.responseInfoXPathSet = responseInfoXPathSet; this.lastRequestInfo = new RequestInfo.Builder(); this.lastResponseInfo = new ResponseInfo.Builder(); }
@Override protected void setHeaders() throws ServiceException, AuthenticationException { getSoapClientHandler().clearHeaders(getSoapClient()); headerHandler.setHeaders(getSoapClient(), adsSession, adsServiceDescriptor); } }
/** * Creates an {@link AdsServiceClient} given an {@link AdsServiceDescriptor} * descriptor and an {@link AdsSession}. * * @param adsServiceDescriptor descriptor with information on ads service * @param adsSession the session associated with the desired * client * @return the created {@link AdsServiceClient} * @throws ServiceException if the ads service client could not be created */ @Override public C createAdsServiceClient(D adsServiceDescriptor, S adsSession) throws ServiceException { Object soapClient = createSoapClient(adsServiceDescriptor); C adsServiceClient = createServiceClient(soapClient, adsServiceDescriptor, adsSession); try { adsServiceClient.setEndpointAddress(adsServiceDescriptor.getEndpointAddress(adsSession .getEndpoint())); } catch (MalformedURLException e) { throw new ServiceException("Unexpected exception", e); } return adsServiceClient; }
/** * Unwraps a SOAP remote call return such that if there was an exception, it is * thrown and if it was a successful call, the return value of the SOAP call * is returned. * * @param remoteCallReturn the {@link RemoteCallReturn} to unwrap * @return the {@link RemoteCallReturn#getReturnValue()} if the call was * successful * @throws Throwable the exception captured in the * {@link RemoteCallReturn#getException()} if present */ protected Object unwrapRemoteCallReturn(RemoteCallReturn remoteCallReturn) throws Throwable { if (remoteCallReturn.getException() != null) { throw handleException(remoteCallReturn.getException()); } else { return remoteCallReturn.getReturnValue(); } } }
@Test public void testSetHeaders() throws Exception { adsServiceClient.setHeaders(); verify(soapClientHandler).clearHeaders(soapClient); verify(headerHandler).setHeaders(soapClient, adsSession, adsServiceDescriptor); } }
public Builder() { requestInfo = new RequestInfo(); }
public void logRequestDetails(RemoteCallReturn remoteCallReturn) { if (remoteCallReturn == null) { return; } boolean isSuccess = remoteCallReturn.getException() == null; if (!isDetailsLoggable(isSuccess)) { return; } String prettyRequest = null; if (remoteCallReturn.getRequestInfo() != null) { prettyRequest = prettyPrinter.prettyPrint(remoteCallReturn.getRequestInfo().getPayload()); } String prettyResponse = null; if (remoteCallReturn.getResponseInfo() != null) { prettyResponse = prettyPrinter.prettyPrint(remoteCallReturn.getResponseInfo().getPayload()); } if (isSuccess) { detailLogger.debug(DETAILS_REQUEST_TEMPLATE, remoteCallType, prettyRequest); detailLogger.debug(DETAILS_RESPONSE_TEMPLATE, remoteCallType, prettyResponse); } else { detailLogger.info(DETAILS_REQUEST_TEMPLATE, remoteCallType, prettyRequest); detailLogger.info(DETAILS_RESPONSE_TEMPLATE, remoteCallType, prettyResponse); } }
@Inject public JaxWsSoapContextHandler( RequestInfoXPathSet requestInfoXPathSet, ResponseInfoXPathSet responseInfoXPathSet) { this.requestInfoXPathSet = requestInfoXPathSet; this.responseInfoXPathSet = responseInfoXPathSet; this.lastRequestInfo = new RequestInfo.Builder(); this.lastResponseInfo = new ResponseInfo.Builder(); }
@Override protected void setHeaders() throws ServiceException, AuthenticationException { getSoapClientHandler().clearHeaders(getSoapClient()); headerHandler.setHeaders(getSoapClient(), adsSession, adsServiceDescriptor); } }
/** * Creates an {@link AdsServiceClient} given an {@link AdsServiceDescriptor} * descriptor and an {@link AdsSession}. * * @param adsServiceDescriptor descriptor with information on ads service * @param adsSession the session associated with the desired * client * @return the created {@link AdsServiceClient} * @throws ServiceException if the ads service client could not be created */ @Override public C createAdsServiceClient(D adsServiceDescriptor, S adsSession) throws ServiceException { Object soapClient = createSoapClient(adsServiceDescriptor); C adsServiceClient = createServiceClient(soapClient, adsServiceDescriptor, adsSession); try { adsServiceClient.setEndpointAddress(adsServiceDescriptor.getEndpointAddress(adsSession .getEndpoint())); } catch (MalformedURLException e) { throw new ServiceException("Unexpected exception", e); } return adsServiceClient; }
/** * Unwraps a SOAP remote call return such that if there was an exception, it is * thrown and if it was a successful call, the return value of the SOAP call * is returned. * * @param remoteCallReturn the {@link RemoteCallReturn} to unwrap * @return the {@link RemoteCallReturn#getReturnValue()} if the call was * successful * @throws Throwable the exception captured in the * {@link RemoteCallReturn#getException()} if present */ protected Object unwrapRemoteCallReturn(RemoteCallReturn remoteCallReturn) throws Throwable { if (remoteCallReturn.getException() != null) { throw handleException(remoteCallReturn.getException()); } else { return remoteCallReturn.getReturnValue(); } } }
/** @see SoapServiceClient#handleException */ @Override protected Throwable handleException(Throwable e) { return super.handleException(e); } }
/** * Constructor. */ public Builder() { this.remoteCallReturn = new RemoteCallReturn(); }
public Builder() { responseInfo = new ResponseInfo(); }
public Builder() { requestInfo = new RequestInfo(); }