Package com.sun.xml.ws.api.message

Examples of com.sun.xml.ws.api.message.Message


          RESPONSEPARAMETERS.equals(property.getKey()))
        continue;
      responseJSONMap.put(property.getKey(), property.getValue());
    }
   
    final Message         message       = packet.getMessage();
   
    /*
     * Set fault status
     */
    if(JSONCodec.STATUS_PROPERTY_NAME != null)
      responseJSONMap.put(JSONCodec.STATUS_PROPERTY_NAME, !(message == null || message.isFault()));
   
    /*
     * Step 4: Check is there message If there is message process it.
     */
    if (message != null) {
      if(message instanceof TrackedMessage){
        responseJSONMap.put(JSONCodec.TRACE, ((TrackedMessage)message).getTrace());
      }
      /*
       * Step 4.1: If message is fault message, set status to false and send fault information.
       */
      if (message.isFault()) {
        // Access SOAP fault.
        try {
          SOAPFault faultObj = message.readAsSOAPMessage().getSOAPBody().getFault();
          HashMap<String,Object> detail = new HashMap<String, Object>();
          try {
            fillChildElementInfo(faultObj.getDetail().getChildNodes(),4,detail);
          } catch(Throwable th){/*Dont mind about custom message set fail*/}
          responseJSONMap.put(FAULT,new JSONFault(faultObj.getFaultCodeAsQName().getLocalPart().toUpperCase(),
              faultObj.getFaultString(),faultObj.getFaultActor(),detail));
         
        } catch (SOAPException e) {
          LOG.log(Level.WARNING, "Failed to read soap fault message", e);
          responseJSONMap.put(FAULT, new JSONFault("Server.json",
              "Failed to read soap fault message","Codec",null));
        }
      }else{
        final String   payload    = message.getPayloadLocalPart();
        /*
         * Step 4.2: message is not fault. valid json response
         */
        try {
          new MessageBodyBuilder(this.codec).handleMessage(this.packet,payload);
View Full Code Here


      // Add trace log if X-Debug or TRACE request.
      packet.invocationProperties.put(TRACE, traceLog);
      traceLog.info("Request Content-type: " + sContentType);
    }
    //
    Message     message     = null;
    com.sun.xml.ws.encoding.ContentType   contentType    = new com.sun.xml.ws.encoding.ContentType(sContentType);
    if(contentType.getBaseType().equalsIgnoreCase(JSONContentType.JSON_MIME_TYPE)){
      JSONDecoder decoder = new JSONDecoder(this,in,packet);
      if(traceLog != null)traceLog.info("calling json to ws message converter: "+ new Date());
      try{
View Full Code Here

        }
      }else{
        return new JSONMessage(null, operation, operationParameters,jsonPopulator);
      }
    }else{
      Message message = packet.getMessage();
      if(message == null){
        throw new RuntimeException("Null response message");
      }
      List<ParameterImpl> responseParameters   = (List<ParameterImpl>) invocationProperties.remove(JSONEncoder.RESPONSEPARAMETERS);
      Map<String,Object>   responseParametersMap = new HashMap<String, Object>();
      if(CAN_HANDLE_RESPONE && message instanceof JAXBMessage){
        if(style == Style.RPC ){
          Object jaxbObject = jaxbObjectAccessor.get(message);
          if(jaxbObject instanceof com.sun.xml.bind.api.CompositeStructure){
            com.sun.xml.bind.api.CompositeStructure responseWraper = (com.sun.xml.bind.api.CompositeStructure)jaxbObject;
            if(responseWraper != null){
              for(int index = 0; index < responseWraper.bridges.length; index++){
                responseParametersMap.put(responseWraper.bridges[index].getTypeReference().tagName.getLocalPart(),
                  responseWraper.values[index]);
              }
            }
          }else{
            responseParametersMap.put(message.getPayloadLocalPart(), jaxbObject);
          }
        }else{
          // Docunemnt
          Object object = jaxbObjectAccessor.get(message);
          for(Field field : object.getClass().getFields()){
            responseParametersMap.put(field.getName(), field.get(object));
          }
        }
      } else if(responseParameters != null && responseParameters.size() == 1){
        // object deserialized. might perform bad.
        ParameterImpl     parameter   = responseParameters.get(0);
        Iterator<Node>     paramBody   = message.readAsSOAPMessage().getSOAPBody().getChildElements(parameter.getName());
        if(paramBody.hasNext()){
          Element responseElm = (Element)paramBody.next();
          if(parameter.isWrapperStyle()){
            List<ParameterImpl> children = ((WrapperParameter)parameter).getWrapperChildren();
            for(ParameterImpl param : children){
View Full Code Here

        String username = null;
        String password = null;

        try {
            // read the header
            Message msg = context.getMessage();
            HeaderList hl = msg.getHeaders();
            Header securityHeader = hl.get(WSSE_SECURITY, true);

            JAXBElement<SecurityHeaderType> sht = securityHeader.readAsJAXB(WSSE_CONTEXT.createUnmarshaller());

            for (Object uno : sht.getValue().getAny()) {
View Full Code Here

       
        SOAPMessage soapMsg = null;
        try {
            //before converting to SOAPMessage, make a copy.  We don't want to consume
            //the original message
            Message mutable = packet.getMessage().copy();
            soapMsg = mutable.readAsSOAPMessage();
                      
        } catch (Exception e) {
            e.printStackTrace();
        }
      
View Full Code Here

       
  // send the request
  Packet response = next.process(info.getRequestPacket());
 
  // check for response
  Message m = response.getMessage();

  if (m != null) {

      if (cAC != null) {
   
View Full Code Here

                String rvalue = null;
                if (messageInfo instanceof PacketMessageInfo) {
                    PacketMessageInfo pmi = (PacketMessageInfo) messageInfo;
                    Packet p = (Packet) pmi.getRequestPacket();
                    if (p != null) {
                        Message m = p.getMessage();
                        if (m != null) {
                            WSDLPort port =
                                (WSDLPort) messageInfo.getMap().get("WSDL_MODEL");
                            if (port != null) {
                                WSDLBoundOperation w = m.getOperation(port);
                                if (w != null) {
                                    QName n = w.getName();
                                    if (n != null) {
                                        rvalue = n.getLocalPart();
                                    }
View Full Code Here

        preReceive();
        return null;
    }
   
    public void send(Packet packet, EndpointMetaData emd) throws Exception {
        Message message = packet.getMessage();
        String operationName = me.getOperation().getLocalPart();
        WrappedMessage wrappedMessage = new WrappedMessage();
        wrappedMessage.setAbstractMessage(message);
       
        if(message.isFault()) {
            // This should never happen.
            wrappedMessage.wrapFault(operationName, emd);
        } else {
            wrappedMessage.setWSDLBindingStyle(emd.getBindingStyle(operationName));
            wrappedMessage.setWSDLMessageType(emd.getInputMessage(operationName).getQName());
            wrappedMessage.setWSDLMessageName(emd.getOperationInputName(operationName));
            wrappedMessage.setWSDLOrderedParts(emd.getInputMessage(operationName).getOrderedParts(null));
            wrappedMessage.setWSDLPartBindings(emd.getInputPartBindings(operationName));
            wrappedMessage.wrap();
        }
        msg = me.createMessage();
        msg.setContent(wrappedMessage.readPayloadAsSource());
        /**
         * Process the attachments.
         */
        for(Attachment attachment : (Iterable<Attachment>)message.getAttachments()) {
            logger.log(Level.FINE, "Adding attachment to Normalized Message, attachmentID = "
                    + attachment.getContentId());
            msg.addAttachment(attachment.getContentId(), attachment.asDataHandler());
        }
        setMessageProperties(packet.invocationProperties);
View Full Code Here

        }
        send();
    }
   
    public void send(Packet packet, EndpointMetaData emd) throws Exception {
        Message message = packet.getMessage();
        String operationName = me.getOperation().getLocalPart();
        WrappedMessage wrappedMessage = new WrappedMessage();
        wrappedMessage.setAbstractMessage(message);
       
        if(message.isFault()) {
            wrappedMessage.wrapFault(operationName, emd);
            this.msg = me.createFault();
        } else {
            wrappedMessage.setWSDLBindingStyle(emd.getBindingStyle(operationName));
            wrappedMessage.setWSDLMessageType(emd.getOutputMessage(operationName).getQName());
View Full Code Here

   if (classLoadingException != null) {
       throw new RuntimeException(classLoadingException);
   }
   SOAPMessage s = null;
   if (p instanceof Packet) {
       Message m = ((Packet) p).getMessage()
       if (m != null) {
     try {
         s = m.readAsSOAPMessage();
     }catch (Exception e) {
         throw new RuntimeException(e);
     }
       }
   }
View Full Code Here

TOP

Related Classes of com.sun.xml.ws.api.message.Message

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.