本文整理汇总了Java中org.springframework.oxm.jaxb.Jaxb2Marshaller.setContextPath方法的典型用法代码示例。如果您正苦于以下问题:Java Jaxb2Marshaller.setContextPath方法的具体用法?Java Jaxb2Marshaller.setContextPath怎么用?Java Jaxb2Marshaller.setContextPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.oxm.jaxb.Jaxb2Marshaller
的用法示例。
在下文中一共展示了Jaxb2Marshaller.setContextPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: lukeMooselikeharvestsExportJaxbMarshaller
import org.springframework.oxm.jaxb.Jaxb2Marshaller; //导入方法依赖的package包/类
@Bean(name = "lukeMooselikeharvestsExportMarshaller")
public Jaxb2Marshaller lukeMooselikeharvestsExportJaxbMarshaller() {
final Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
marshaller.setMarshallerProperties(getMarshallerDefaultProperties());
marshaller.setContextPath("fi.riista.integration.luke_export.mooselikeharvests");
marshaller.setSchema(new ClassPathResource("/xsd/luke/export-mooselikeharvests-v1.xsd"));
return activateLoggingValidation(marshaller);
}
示例2: init
import org.springframework.oxm.jaxb.Jaxb2Marshaller; //导入方法依赖的package包/类
@PostConstruct
private void init() {
interceptors.add(loggingInterceptor);
interceptors.add(faultInterceptor);
setInterceptors(interceptors.toArray(new ClientInterceptor[0]));
marshaller = new Jaxb2Marshaller();
marshaller.setContextPath(OTAPingRQ.class.getPackage().getName());
setMarshaller(marshaller);
setUnmarshaller(marshaller);
}
示例3: addInterceptors
import org.springframework.oxm.jaxb.Jaxb2Marshaller; //导入方法依赖的package包/类
@PostConstruct
private void addInterceptors() {
interceptors.add(loggingInterceptor);
interceptors.add(faultInterceptor);
this.setInterceptors(interceptors.toArray(new ClientInterceptor[0]));
setDefaultUri(configuration.getSoapProperty("environment"));
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
marshaller.setContextPath("com.sabre.api.sacs.contract.transaction");
setMarshaller(marshaller);
setUnmarshaller(marshaller);
}
示例4: init
import org.springframework.oxm.jaxb.Jaxb2Marshaller; //导入方法依赖的package包/类
@PostConstruct
private void init() {
marshaller = new Jaxb2Marshaller();
StringBuffer buffer = new StringBuffer()
.append(MESSAGE_HEADER_PACKAGE)
.append(":")
.append(SECURITY_PACKAGE);
String contextPath = buffer.toString();
marshaller.setContextPath(contextPath);
}
示例5: securityMarshaller
import org.springframework.oxm.jaxb.Jaxb2Marshaller; //导入方法依赖的package包/类
@Bean
public Jaxb2Marshaller securityMarshaller() {
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
StringBuffer contextPath = new StringBuffer()
.append(MessageHeader.class.getPackage().getName())
.append(":")
.append(SessionCreateRQ.class.getPackage().getName());
marshaller.setContextPath(contextPath.toString());
return marshaller;
}
示例6: testCall
import org.springframework.oxm.jaxb.Jaxb2Marshaller; //导入方法依赖的package包/类
@Test
public void testCall() throws IOException, InterruptedException {
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
marshaller.setContextPath("com.sabre.api.sacs.contract.travelitinerary");
Result marshalledRequest = new StringResult();
marshaller.marshal(getRequestBody("ABCD"), marshalledRequest);
Source requestPayload = new StringSource(marshalledRequest.toString());
Source responsePayload = new StringSource(getResponseBody());
mockServer.expect(payload(requestPayload)).andRespond(withSoapEnvelope(responsePayload));
tir.setRequest(getRequestBody("ABCD"));
tir.setLastInFlow(true);
TravelItineraryReadRS response = tir.executeRequest(context);
Assert.assertEquals(configuration.getSoapProperty("TravelItineraryReadRQVersion"), response.getVersion());
mockServer.verify();
}
示例7: XmlSoccerServiceImpl
import org.springframework.oxm.jaxb.Jaxb2Marshaller; //导入方法依赖的package包/类
public XmlSoccerServiceImpl() {
modelMapper = new ModelMapper();
marshaller = new Jaxb2Marshaller();
marshaller.setContextPath("com.github.pabloo99.xmlsoccer.webservice");
setMarshaller(marshaller);
setUnmarshaller(marshaller);
}
示例8: marshalToXml
import org.springframework.oxm.jaxb.Jaxb2Marshaller; //导入方法依赖的package包/类
/**
* Marshals object graph into XML.
*
* @param obj the object graph
* @param sourceClass the input class
* @return XML as string
* @see XmlConverter
*/
public static String marshalToXml(Object obj, Class sourceClass) {
Jaxb2Marshaller jaxb2 = new Jaxb2Marshaller();
jaxb2.setContextPath(sourceClass.getPackage().getName());
StringWriter writer = new StringWriter();
StreamResult result = new StreamResult(writer);
jaxb2.marshal(obj, result);
return writer.toString();
}
示例9: customizeFault
import org.springframework.oxm.jaxb.Jaxb2Marshaller; //导入方法依赖的package包/类
@Override
protected void customizeFault(Object endpoint, Exception exception, SoapFault fault)
{
// create the corresponding jaxb element of an EndpointException
if (exception instanceof EndpointException)
{
// get the result inside the fault detail to marshal to
Result result = fault.addFaultDetail().getResult();
//create a new WS entity EndpointException and setting its code and message to be equal to those of actual thrown Exception
CMEndpointExceptionBean endpointException = new CMEndpointExceptionBean();
endpointException.setCode(((EndpointException) exception).getCode());
endpointException.setMessage(exception.getMessage());
JAXBElement<CMEndpointExceptionBean> soapFaultDetails = new ObjectFactory().createEndpointException(endpointException);
// marshal the EndpointException WS entity to the details tag of a SOAP Fault message
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
marshaller.setContextPath(jaxb2MarshallerContextPath);
try {
//When setting the marshaller in applicationContext.xml, Spring calls by default afterPropertiesSet() after setting the
//marshaller properties; from Java, I have to do it before marshalling an object
marshaller.afterPropertiesSet();
} catch (Exception e) {
logger.error("Error while setting up Jaxb2Marshaller!");
}
marshaller.marshal(soapFaultDetails, result);
} else {
super.customizeFault(endpoint, exception, fault);
}
}
示例10: customizeFault
import org.springframework.oxm.jaxb.Jaxb2Marshaller; //导入方法依赖的package包/类
@Override
protected void customizeFault(Object endpoint, Exception exception, SoapFault fault)
{
// create the corresponding jaxb element of an EndpointException
if (exception instanceof EndpointException)
{
// get the result inside the fault detail to marshal to
Result result = fault.addFaultDetail().getResult();
//create a new WS entity EndpointException and setting its code and message to be equal to those of actual thrown Exception
TSEndpointExceptionBean reportsEndpointExceptionBean = new TSEndpointExceptionBean();
reportsEndpointExceptionBean.setCode(((EndpointException) exception).getCode());
reportsEndpointExceptionBean.setMessage(exception.getMessage());
JAXBElement<TSEndpointExceptionBean> soapFaultDetails = new ObjectFactory().createEndpointException(reportsEndpointExceptionBean);
// marshal the EndpointException WS entity to the details tag of a SOAP Fault message
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
marshaller.setContextPath(jaxb2MarshallerContextPath);
try {
//When setting the marshaller in applicationContext.xml, Spring calls by default afterPropertiesSet() after setting the
//marshaller properties; from Java, I have to do it before marshalling an object
marshaller.afterPropertiesSet();
} catch (Exception e) {
logger.error("Error while setting up Jaxb2Marshaller!");
}
marshaller.marshal(soapFaultDetails, result);
} else {
super.customizeFault(endpoint, exception, fault);
}
}
示例11: customizeFault
import org.springframework.oxm.jaxb.Jaxb2Marshaller; //导入方法依赖的package包/类
@Override
protected void customizeFault(Object endpoint, Exception exception, SoapFault fault)
{
// create the corresponding jaxb element of an EndpointException
if (exception instanceof EndpointException)
{
// get the result inside the fault detail to marshal to
Result result = fault.addFaultDetail().getResult();
//create a new WS entity EndpointException and setting its code and message to be equal to those of actual thrown Exception
OMEndpointExceptionBean endpointException = new OMEndpointExceptionBean();
endpointException.setCode(((EndpointException) exception).getCode());
endpointException.setMessage(exception.getMessage());
JAXBElement<OMEndpointExceptionBean> soapFaultDetails = new ObjectFactory().createEndpointException(endpointException);
// marshal the EndpointException WS entity to the details tag of a SOAP Fault message
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
marshaller.setContextPath(jaxb2MarshallerContextPath);
try {
//When setting the marshaller in applicationContext.xml, Spring calls by default afterPropertiesSet() after setting the
//marshaller properties; from Java, I have to do it before marshalling an object
marshaller.afterPropertiesSet();
} catch (Exception e) {
logger.error("Error while setting up Jaxb2Marshaller!");
}
marshaller.marshal(soapFaultDetails, result);
} else {
super.customizeFault(endpoint, exception, fault);
}
}
示例12: customizeFault
import org.springframework.oxm.jaxb.Jaxb2Marshaller; //导入方法依赖的package包/类
@Override
protected void customizeFault(Object endpoint, Exception exception, SoapFault fault)
{
// create the corresponding jaxb element of an EndpointException
if (exception instanceof EndpointException)
{
// get the result inside the fault detail to marshal to
Result result = fault.addFaultDetail().getResult();
//create a new WS entity EndpointException and setting its code and message to be equal to those of actual thrown Exception
AuditEndpointExceptionBean reportsEndpointExceptionBean = new AuditEndpointExceptionBean();
reportsEndpointExceptionBean.setCode(((EndpointException) exception).getCode());
reportsEndpointExceptionBean.setMessage(exception.getMessage());
JAXBElement<AuditEndpointExceptionBean> soapFaultDetails = new ObjectFactory().createEndpointException(reportsEndpointExceptionBean);
// marshal the EndpointException WS entity to the details tag of a SOAP Fault message
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
marshaller.setContextPath(jaxb2MarshallerContextPath);
try {
//When setting the marshaller in applicationContext.xml, Spring calls by default afterPropertiesSet() after setting the
//marshaller properties; from Java, I have to do it before marshalling an object
marshaller.afterPropertiesSet();
} catch (Exception e) {
logger.error("Error while setting up Jaxb2Marshaller!");
}
marshaller.marshal(soapFaultDetails, result);
} else {
super.customizeFault(endpoint, exception, fault);
}
}
示例13: getUnmarshaller
import org.springframework.oxm.jaxb.Jaxb2Marshaller; //导入方法依赖的package包/类
Jaxb2Marshaller getUnmarshaller() throws JAXBException {
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
marshaller.setContextPath(getContextPath());
return marshaller;
}
示例14: getMarshaller
import org.springframework.oxm.jaxb.Jaxb2Marshaller; //导入方法依赖的package包/类
public Jaxb2Marshaller getMarshaller() {
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
marshaller.setContextPath(ObjectFactory.class.getPackage().getName());
return marshaller;
}
示例15: unmarshalFromXml
import org.springframework.oxm.jaxb.Jaxb2Marshaller; //导入方法依赖的package包/类
/**
* Unmarshals XML into object graph.
*
* @param xml the input string
* @param targetClass the target class
* @return object graph
* @see XmlConverter
*/
@SuppressWarnings("unchecked")
public static <T> T unmarshalFromXml(String xml, Class<T> targetClass) {
Jaxb2Marshaller jaxb2 = new Jaxb2Marshaller();
jaxb2.setContextPath(targetClass.getPackage().getName());
return (T) jaxb2.unmarshal(new StreamSource(new StringReader(xml)));
}