Example usage for org.springframework.oxm.support MarshallingSource MarshallingSource

List of usage examples for org.springframework.oxm.support MarshallingSource MarshallingSource

Introduction

In this page you can find the example usage for org.springframework.oxm.support MarshallingSource MarshallingSource.

Prototype

public MarshallingSource(Marshaller marshaller, Object content) 

Source Link

Document

Create a new MarshallingSource with the given marshaller and content.

Usage

From source file:py.una.pol.karaku.test.util.TestWSCaller.java

@Override
public <T> void call(final Object request, final Info info, final WSCallBack<T> callBack) {

    if (callBack == null) {
        throw new IllegalArgumentException("CallBack no puede ser nulo");
    }/*from  w  ww. ja  va  2  s  .c  om*/

    // TODO agregar callback#onfailure
    client.sendRequest(withPayload(new MarshallingSource(marshaller, request)))
            .andExpect(new ResponseMatcher() {

                @Override
                public void match(WebServiceMessage request, WebServiceMessage response)
                        throws IOException, AssertionError {

                    WebServiceMessage dos = response;
                    Source source = dos.getPayloadSource();
                    @SuppressWarnings("unchecked")
                    T result = (T) unmarshaller.unmarshal(source);
                    callBack.onSucess(result);
                }
            });

}

From source file:py.una.pol.karaku.test.base.BaseTestWebService.java

/**
 * Marshaliza un objeto y lo agrega a un {@link Source}
 * //from www  .  j a v  a 2 s  .c om
 * <p>
 * <b>La clase del objeto debe ser una de las retornadas por
 * {@link WebServiceTestConfiguration#getClassesToBound()}</b>
 * </p>
 * 
 * @param o
 *            Objeto a serializar
 * @return {@link Source}
 */
public Source getPayload(Object o) {

    return new MarshallingSource(marshaller, o);
}