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


Java SoapMessage类代码示例

本文整理汇总了Java中org.springframework.ws.soap.SoapMessage的典型用法代码示例。如果您正苦于以下问题:Java SoapMessage类的具体用法?Java SoapMessage怎么用?Java SoapMessage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SoapMessage类属于org.springframework.ws.soap包,在下文中一共展示了SoapMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testWsAddressingAction

import org.springframework.ws.soap.SoapMessage; //导入依赖的package包/类
@Test
@Ignore
public void testWsAddressingAction() throws Exception {
    Object result = template.requestBody("direct:wsAddressingAction", xmlBody);
    assertNotNull(result);

    assertNotNull(sender.getMessageContext());

    // check default actions
    Assertions.assertThat(sender.getMessageContext()).isNotNull();
    MessageAddressingProperties wsaProperties = TestUtil.getWSAProperties((SoapMessage)sender.getMessageContext().getRequest());
    Assertions.assertThat(wsaProperties).isNotNull();
    Assertions.assertThat(wsaProperties.getReplyTo()).isNull();
    Assertions.assertThat(wsaProperties.getFaultTo()).isNull();

}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:ProducerParamsPrecedenceTest.java

示例2: testWsAddressingActionPrecendence

import org.springframework.ws.soap.SoapMessage; //导入依赖的package包/类
@Test
@Ignore
public void testWsAddressingActionPrecendence() throws Exception {
    Object result = template.requestBody("direct:precedenceWsAddressingAction", xmlBody);
    assertNotNull(result);

    assertNotNull(sender.getMessageContext());

    // check default actions
    Assertions.assertThat(sender.getMessageContext()).isNotNull();
    MessageAddressingProperties wsaProperties = TestUtil.getWSAProperties((SoapMessage)sender.getMessageContext().getRequest());
    Assertions.assertThat(wsaProperties).isNotNull();
    Assertions.assertThat(wsaProperties.getReplyTo()).isNull();
    Assertions.assertThat(wsaProperties.getFaultTo()).isNull();

}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:ProducerParamsPrecedenceTest.java

示例3: testFaultToPrecedence

import org.springframework.ws.soap.SoapMessage; //导入依赖的package包/类
@Test
public void testFaultToPrecedence() throws Exception {
    template.requestBody("direct:precedenceFaultTo", xmlBody);

    assertNotNull(sender.getMessageContext());

    // check default actions
    Assertions.assertThat(sender.getMessageContext()).isNotNull();
    MessageAddressingProperties wsaProperties = TestUtil.getWSAProperties((SoapMessage)sender.getMessageContext().getRequest());
    Assertions.assertThat(wsaProperties).isNotNull();
    Assertions.assertThat(wsaProperties.getFaultTo().getAddress()).isEqualTo(new URI("http://faultPrecedence.to"));
    // /we set in sample data all precendence fields for simplier tests
    // otherwise it woudl be here annonymous
    Assertions.assertThat(wsaProperties.getReplyTo().getAddress()).isEqualTo(new URI("http://replyPrecedence.to"));

}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:ProducerParamsPrecedenceTest.java

示例4: resolveFault

import org.springframework.ws.soap.SoapMessage; //导入依赖的package包/类
@Override
public void resolveFault(WebServiceMessage message) throws IOException {

	SoapMessage message2 = (SoapMessage) message;

	SoapBody body = message2.getSoapBody();
	// No Fault object, go to fallback
	if (body.getFault() == null
			|| body.getFault().getFaultDetail() == null
			|| !body.getFault().getFaultDetail().getDetailEntries()
					.hasNext()) {
		fallBack(message2);
	}

	SoapFaultDetail sfd = body.getFault().getFaultDetail();

	tryHttpException(message2, sfd.getDetailEntries().next());

}
 
开发者ID:fpuna-cia,项目名称:karaku,代码行数:20,代码来源:KarakuFaultMessageResolver.java

示例5: resolveExceptionInternal

import org.springframework.ws.soap.SoapMessage; //导入依赖的package包/类
@Override
protected final boolean resolveExceptionInternal(MessageContext messageContext, Object endpoint, Exception ex) {
    Assert.isInstanceOf(SoapMessage.class, messageContext.getResponse(),
            "SimpleSoapExceptionResolver requires a SoapMessage");

    if (throttlingAsServerError && ex instanceof ThrottlingExceededException) {
        // no SOAP fault => server error
        return false;
    } else {
        SoapMessage response = (SoapMessage) messageContext.getResponse();
        String faultString = StringUtils.hasLength(ex.getMessage()) ? ex.getMessage() : ex.toString();
        SoapBody body = response.getSoapBody();
        SoapFault fault = body.addServerOrReceiverFault(faultString, getLocale());
        customizeFault(messageContext, endpoint, ex, fault);

        return true;
    }
}
 
开发者ID:integram,项目名称:cleverbus,代码行数:19,代码来源:ErrorCodeAwareSoapExceptionResolver.java

示例6: handleInvalidXmlException

import org.springframework.ws.soap.SoapMessage; //导入依赖的package包/类
@Override
protected void handleInvalidXmlException(HttpServletRequest req, HttpServletResponse res, Object handler,
                                         InvalidXmlException ex) throws Exception {

    WebServiceConnection connection = new MyHttpServletConnection(req, res);

    TransportContext previousTransportContext = TransportContextHolder.getTransportContext();
    TransportContextHolder.setTransportContext(new DefaultTransportContext(connection));

    try {
        MessageContext messageContext = new DefaultMessageContext(getMessageFactory().createWebServiceMessage(),
                getMessageFactory());

        SoapBody soapBody = ((SoapMessage) messageContext.getResponse()).getSoapBody();
        soapBody.addServerOrReceiverFault(getFaultString(ex), Locale.ENGLISH);
        connection.send(messageContext.getResponse());
    } finally {
        TransportUtils.closeConnection(connection);
        TransportContextHolder.setTransportContext(previousTransportContext);
    }
}
 
开发者ID:integram,项目名称:cleverbus,代码行数:22,代码来源:ErrorAwareWebServiceMessageReceiverHandlerAdapter.java

示例7: getHrefsToInclude

import org.springframework.ws.soap.SoapMessage; //导入依赖的package包/类
private List<String> getHrefsToInclude(final SoapMessage message) {
    Iterator<SoapHeaderElement> soapHeaderElementIterator = message.getSoapHeader().examineHeaderElements(Constants.MESSAGING_QNAME);
    if (!soapHeaderElementIterator.hasNext()) {
        throw new SecurityException("Missing ebMS Messaging header");
    }
    SoapHeaderElement incomingSoapHeaderElement = soapHeaderElementIterator.next();
    Messaging messaging = (Messaging) jaxb2Marshaller.unmarshal(incomingSoapHeaderElement.getSource());
    if (messaging.getUserMessages().size() == 0) {
        return new ArrayList<String>();
    }
    UserMessage userMessage = messaging.getUserMessages().get(0);
    List<String> hrefs = new ArrayList<String>();
    for (PartInfo part : userMessage.getPayloadInfo().getPartInfos()) {
        String href = part.getHref();
        if (href == null) {
            String attributeValue = message.getSoapBody().getAttributeValue(Constants.ID_ATTRIBUTE_QNAME);
            if (StringUtils.isBlank(attributeValue)) {
                throw new SecurityException("Missing reference for partInfo soapBody");
            }
            href = "#" + attributeValue;
        }
        hrefs.add(href);
    }
    return hrefs;
}
 
开发者ID:digipost,项目名称:sdp-shared,代码行数:26,代码来源:EbmsReferenceExtractor.java

示例8: getMessaging

import org.springframework.ws.soap.SoapMessage; //导入依赖的package包/类
/**
 * Enten returnerer denne et Messaging objekt, eller så kaster den en RuntimeException
 */
public static Messaging getMessaging(final Jaxb2Marshaller jaxb2Marshaller, final WebServiceMessage message) {

    SoapHeader soapHeader = ((SoapMessage) message).getSoapHeader();
    if (soapHeader == null) {
        throw new RuntimeException("The ebMS header is missing (no SOAP header found in SOAP request)");
    }

    Iterator<SoapHeaderElement> soapHeaderElementIterator = soapHeader.examineHeaderElements(MESSAGING_QNAME);
    if (!soapHeaderElementIterator.hasNext()) {
        throw new RuntimeException("The ebMS header is missing in SOAP header");
    }

    SoapHeaderElement incomingSoapHeaderElement = soapHeaderElementIterator.next();
    try {
        return (Messaging) jaxb2Marshaller.unmarshal(incomingSoapHeaderElement.getSource());
    } catch (Exception e) {
        throw new RuntimeException("The ebMs header failed to unmarshall");
    }

}
 
开发者ID:digipost,项目名称:sdp-shared,代码行数:24,代码来源:MessagingMarshalling.java

示例9: apply

import org.springframework.ws.soap.SoapMessage; //导入依赖的package包/类
@Override
public void apply(EbmsContext ebmsContext, SoapHeaderElement ebmsMessaging, SoapMessage soapMessage) {
    List<MessagePartNRInformation> nrInfos = new ArrayList<MessagePartNRInformation>();
    for (Reference ref : references) {
        nrInfos.add(new MessagePartNRInformation().withReference(ref));
    }

    Receipt receipt = new Receipt()
            .withAnies(new NonRepudiationInformation()
                    .withMessagePartNRInformations(nrInfos));
    SignalMessage signalMessage = new SignalMessage()
            .withMessageInfo(new MessageInfo(
                    ZonedDateTime.now(),
                    UUID.randomUUID().toString(),
                    messageId))
            .withReceipt(receipt);
    Marshalling.marshal(jaxb2Marshaller, ebmsMessaging, Constants.SIGNAL_MESSAGE_QNAME, signalMessage);
}
 
开发者ID:digipost,项目名称:sdp-shared,代码行数:19,代码来源:AddReferencesStep.java

示例10: apply

import org.springframework.ws.soap.SoapMessage; //导入依赖的package包/类
@Override
public void apply(final EbmsContext ebmsContext, final SoapHeaderElement ebmsMessaging, final SoapMessage soapMessage) {
    PartyInfo partyInfo = new PartyInfo(
            new From().withRole(databehandler.rolle.urn)
                    .withPartyIds(new PartyId(databehandler.orgnr.getOrganisasjonsnummerMedLandkode(), PMode.PARTY_ID_TYPE)),
            new To().withRole(mottaker.rolle.urn)
                    .withPartyIds(new PartyId(mottaker.orgnr.getOrganisasjonsnummerMedLandkode(), PMode.PARTY_ID_TYPE))
    );
    UserMessage userMessage = new UserMessage()
            .withMpc(mpc.toString())
            .withMessageInfo(createMessageInfo())
            .withCollaborationInfo(createCollaborationInfo())
            .withPartyInfo(partyInfo);
    addPartInfo(soapMessage, userMessage);
    Marshalling.marshal(marshaller, ebmsMessaging, Constants.USER_MESSAGE_QNAME, userMessage);
}
 
开发者ID:digipost,项目名称:sdp-shared,代码行数:17,代码来源:AddUserMessageStep.java

示例11: handleValidationException

import org.springframework.ws.soap.SoapMessage; //导入依赖的package包/类
@Override //Overridden in order to be able to set the level of logging
protected boolean handleValidationException(WsSecurityValidationException ex, MessageContext messageContext) {
    logFault.log(ex);

    if (this.exceptionResolver != null) {
        this.exceptionResolver.resolveException(messageContext, (Object) null, ex);
    } else {
        if (logger.isDebugEnabled()) {
            logger.debug("No exception resolver present, creating basic soap fault");
        }

        SoapBody response = ((SoapMessage) messageContext.getResponse()).getSoapBody();
        response.addClientOrSenderFault(ex.getMessage(), Locale.ENGLISH);
    }

    return false;
}
 
开发者ID:digipost,项目名称:sdp-shared,代码行数:18,代码来源:Wss4jInterceptor.java

示例12: doWithMessage

import org.springframework.ws.soap.SoapMessage; //导入依赖的package包/类
@Override
public void doWithMessage(final WebServiceMessage message) throws IOException, TransformerException {
    SoapMessage soapMessage = (SoapMessage) message;
    SimpleStandardBusinessDocument simple = new SimpleStandardBusinessDocument(appKvittering.sbd);
    if (appKvittering.sbdStream != null) {
        TransformerUtil.transform(new StreamSource(appKvittering.sbdStream), soapMessage.getEnvelope().getBody().getPayloadResult(), true);
    } else if (simple.getMelding().getSignature() == null) {
        Document signedDoc = signer.sign(appKvittering.sbd);
        Marshalling.marshal(signedDoc, soapMessage.getEnvelope().getBody().getPayloadResult());
    } else {
        Marshalling.marshal(marshaller, soapMessage.getEnvelope().getBody(), appKvittering.sbd);
    }

    Mpc mpc = new Mpc(appKvittering.prioritet, appKvittering.mpcId);
    ebmsContext.addRequestStep(new AddUserMessageStep(mpc, appKvittering.messageId, appKvittering.action, null, appKvittering.sbd, databehandler, tekniskMottaker
            , marshaller));
}
 
开发者ID:digipost,项目名称:sdp-shared,代码行数:18,代码来源:KvitteringSender.java

示例13: extractData

import org.springframework.ws.soap.SoapMessage; //导入依赖的package包/类
@Override
public EbmsApplikasjonsKvittering extractData(final WebServiceMessage message) throws IOException, TransformerException {
    SoapBody soapBody = ((SoapMessage) message).getSoapBody();

    if (ebmsContext.warning != null && NO_MESSAGE_AVAILABLE_FROM_MPC_ERROR_CODE.equals(ebmsContext.warning.getErrorCode())) {
        return null;
    }

    StandardBusinessDocument sbd = Marshalling.unmarshal(jaxb2Marshaller, soapBody, StandardBusinessDocument.class);
    PartyInfo partyInfo = ebmsContext.userMessage.getPartyInfo();
    EbmsAktoer avsender = EbmsAktoer.from(partyInfo.getFrom());
    EbmsAktoer mottaker = EbmsAktoer.from(partyInfo.getTo());

    return EbmsApplikasjonsKvittering.create(avsender, mottaker, sbd)
            .withMessageId(ebmsContext.userMessage.getMessageInfo().getMessageId())
            .withRefToMessageId(ebmsContext.userMessage.getMessageInfo().getRefToMessageId())
            .withReferences(ebmsContext.incomingReferences.values())
            .build();
}
 
开发者ID:digipost,项目名称:sdp-shared,代码行数:20,代码来源:ApplikasjonsKvitteringReceiver.java

示例14: apply

import org.springframework.ws.soap.SoapMessage; //导入依赖的package包/类
@Override
public void apply(final EbmsContext ebmsContext, final SoapHeaderElement ebmsMessaging, final SoapMessage soapMessage) {
    Messaging messaging = (Messaging) jaxb2Marshaller.unmarshal(ebmsMessaging.getSource());
    NonRepudiationInformation nonrep = (NonRepudiationInformation) messaging.getSignalMessages().get(0).getReceipt().getAnies().get(0);
    for (Reference reference : references) {
        boolean found = false;
        for (MessagePartNRInformation npr : nonrep.getMessagePartNRInformations()) {
            Reference ref = npr.getReference();
            if (ref.getURI().equals(reference.getURI())) {
                found = true;
                validate(reference, ref);
                break;
            }
        }
        if (!found) {
            throw new RuntimeException("Missing NonRepudiationInformation for " + reference.getId());
        }
    }
}
 
开发者ID:digipost,项目名称:sdp-shared,代码行数:20,代码来源:ReferenceValidatorStep.java

示例15: handleRequest

import org.springframework.ws.soap.SoapMessage; //导入依赖的package包/类
@Override
public boolean handleRequest(MessageContext messageContext)
		throws WebServiceClientException {
	WebServiceMessage request = messageContext.getRequest();
	if(request instanceof SoapMessage) {
		SoapMessage soapMessage = (SoapMessage) request;
		SoapEnvelope envelope = soapMessage.getEnvelope();
		SoapHeader header = envelope.getHeader();
		RequestServerVersion rsv = new RequestServerVersion();

		try {
			Marshaller m = jaxbContext.createMarshaller();
			m.marshal(rsv, header.getResult());
		} catch (JAXBException e) {
			log.error("JAXBException raised while attempting to add RequestServerVersion to soap header " + rsv, e);
			throw new ExchangeWebServicesRuntimeException("JAXBException raised while attempting to add RequestServerVersion to soap header " + rsv, e);
		}
	}
	return true;
}
 
开发者ID:Bedework,项目名称:exchange-ws-client,代码行数:21,代码来源:RequestServerVersionClientInterceptor.java


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