List of usage examples for javax.xml.ws.handler MessageContext INBOUND_MESSAGE_ATTACHMENTS
String INBOUND_MESSAGE_ATTACHMENTS
To view the source code for javax.xml.ws.handler MessageContext INBOUND_MESSAGE_ATTACHMENTS.
Click Source Link
From source file:be.e_contract.dssp.client.AttachmentsLogicalHandler.java
@Override public boolean handleMessage(LogicalMessageContext context) { Boolean outbound = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); if (!outbound) { this.inboundAttachments = (Map<String, DataHandler>) context .get(MessageContext.INBOUND_MESSAGE_ATTACHMENTS); LOG.debug("inbound attachments: " + this.inboundAttachments.keySet()); }/* w ww . j a v a 2 s . c om*/ return true; }
From source file:be.e_contract.dssp.client.LoggingSOAPHandler.java
private void logMessage(SOAPMessageContext context) { Boolean outboundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); LOG.debug("outbound message: " + outboundProperty); SOAPMessage soapMessage = context.getMessage(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); try {// w w w . j a va 2s . co m soapMessage.writeTo(outputStream); } catch (Exception e) { LOG.error("SOAP error: " + e.getMessage()); } String message = outputStream.toString(); LOG.debug("SOAP message: " + message); if (false == outboundProperty) { Map<String, DataHandler> inboundMessageAttachments = (Map<String, DataHandler>) context .get(MessageContext.INBOUND_MESSAGE_ATTACHMENTS); Set<String> attachmentContentIds = inboundMessageAttachments.keySet(); LOG.debug("attachment content ids: " + attachmentContentIds); } }
From source file:be.e_contract.mycarenet.common.LoggingHandler.java
private void logMessage(SOAPMessageContext context) { Boolean outboundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); LOG.debug("outbound message: " + outboundProperty); SOAPMessage soapMessage = context.getMessage(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); try {/* w w w. ja v a 2 s . co m*/ soapMessage.writeTo(outputStream); } catch (Exception e) { LOG.error("SOAP error: " + e.getMessage()); } String message = outputStream.toString(); LOG.debug("SOAP message: " + message); if (false == outboundProperty) { @SuppressWarnings("unchecked") Map<String, DataHandler> inboundMessageAttachments = (Map<String, DataHandler>) context .get(MessageContext.INBOUND_MESSAGE_ATTACHMENTS); Set<String> attachmentContentIds = inboundMessageAttachments.keySet(); LOG.debug("attachment content ids: " + attachmentContentIds); } }
From source file:test.unit.be.e_contract.dssp.client.DigitalSignatureServiceTestPort.java
@Override public SignResponse sign(SignRequest signRequest) { MessageContext messageContext = this.webServiceContext.getMessageContext(); Map<String, DataHandler> attachments = (Map<String, DataHandler>) messageContext .get(MessageContext.INBOUND_MESSAGE_ATTACHMENTS); LOG.debug("attachments: " + attachments.keySet()); if (attachments.size() != 0) { receivedAttachment = true;/* ww w. j a v a 2s.c o m*/ } SignResponse signResponse = this.objectFactory.createSignResponse(); Result result = this.objectFactory.createResult(); signResponse.setResult(result); result.setResultMajor(DigitalSignatureServiceConstants.PENDING_RESULT_MAJOR); AnyType optionalOutputs = this.objectFactory.createAnyType(); signResponse.setOptionalOutputs(optionalOutputs); optionalOutputs.getAny().add(this.asyncObjectFactory.createResponseID("response identifier")); RequestSecurityTokenResponseCollectionType requestSecurityTokenResponseCollection = this.wstObjectFactory .createRequestSecurityTokenResponseCollectionType(); optionalOutputs.getAny().add(this.wstObjectFactory .createRequestSecurityTokenResponseCollection(requestSecurityTokenResponseCollection)); RequestSecurityTokenResponseType requestSecurityTokenResponse = this.wstObjectFactory .createRequestSecurityTokenResponseType(); requestSecurityTokenResponseCollection.getRequestSecurityTokenResponse().add(requestSecurityTokenResponse); RequestedSecurityTokenType requestedSecurityToken = this.wstObjectFactory .createRequestedSecurityTokenType(); requestSecurityTokenResponse.getAny() .add(this.wstObjectFactory.createRequestedSecurityToken(requestedSecurityToken)); SecurityContextTokenType securityContextToken = this.wsscObjectFactory.createSecurityContextTokenType(); requestedSecurityToken.setAny(this.wsscObjectFactory.createSecurityContextToken(securityContextToken)); securityContextToken.setId("token-reference"); securityContextToken.getAny().add(this.wsscObjectFactory.createIdentifier("token-identifier")); EntropyType entropy = this.wstObjectFactory.createEntropyType(); requestSecurityTokenResponse.getAny().add(this.wstObjectFactory.createEntropy(entropy)); BinarySecretType binarySecret = this.wstObjectFactory.createBinarySecretType(); entropy.getAny().add(this.wstObjectFactory.createBinarySecret(binarySecret)); byte[] nonce = new byte[256 / 8]; SecureRandom secureRandom = new SecureRandom(); secureRandom.nextBytes(nonce); binarySecret.setValue(nonce); return signResponse; }