当前位置: 首页>>代码示例>>Java>>正文


Java Jaxb2Marshaller.setContextPath方法代码示例

本文整理汇总了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);
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:11,代码来源:JaxbConfig.java

示例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);
}
 
开发者ID:SabreDevStudio,项目名称:SACS-Java,代码行数:11,代码来源:OTAPingWrapper.java

示例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);

}
 
开发者ID:SabreDevStudio,项目名称:SACS-Java,代码行数:14,代码来源:IgnoreTransactionWrapper.java

示例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);
}
 
开发者ID:SabreDevStudio,项目名称:SACS-Java,代码行数:11,代码来源:PingHeaderCallback.java

示例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;
}
 
开发者ID:SabreDevStudio,项目名称:SACS-Java,代码行数:11,代码来源:SoapApplicationConfiguration.java

示例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();
}
 
开发者ID:SabreDevStudio,项目名称:SACS-Java,代码行数:16,代码来源:TravelItineraryReadTest.java

示例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);
}
 
开发者ID:pabloo99,项目名称:xmlsoccer,代码行数:8,代码来源:XmlSoccerServiceImpl.java

示例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();
}
 
开发者ID:integram,项目名称:cleverbus,代码行数:20,代码来源:Tools.java

示例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);
	}
}
 
开发者ID:CodeSphere,项目名称:termitaria,代码行数:31,代码来源:EndpointExceptionResolver.java

示例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);
	}
}
 
开发者ID:CodeSphere,项目名称:termitaria,代码行数:31,代码来源:EndpointExceptionResolver.java

示例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);
	}
}
 
开发者ID:CodeSphere,项目名称:termitaria,代码行数:31,代码来源:EndpointExceptionResolver.java

示例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);
	}
}
 
开发者ID:CodeSphere,项目名称:termitaria,代码行数:31,代码来源:EndpointExceptionResolver.java

示例13: getUnmarshaller

import org.springframework.oxm.jaxb.Jaxb2Marshaller; //导入方法依赖的package包/类
Jaxb2Marshaller getUnmarshaller() throws JAXBException {
    Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
    marshaller.setContextPath(getContextPath());

    return marshaller;
}
 
开发者ID:SabreDevStudio,项目名称:SACS-Java,代码行数:7,代码来源:AbstractSessionInterceptor.java

示例14: getMarshaller

import org.springframework.oxm.jaxb.Jaxb2Marshaller; //导入方法依赖的package包/类
public Jaxb2Marshaller getMarshaller() {
    Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
    marshaller.setContextPath(ObjectFactory.class.getPackage().getName());
    return marshaller;
}
 
开发者ID:christophd,项目名称:citrus-simulator,代码行数:6,代码来源:PayloadHelper.java

示例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)));
}
 
开发者ID:integram,项目名称:cleverbus,代码行数:16,代码来源:Tools.java


注:本文中的org.springframework.oxm.jaxb.Jaxb2Marshaller.setContextPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。