Package org.apache.wsif.util.jms

Examples of org.apache.wsif.util.jms.WSIFJMSDestination


        "<?xml version='1.0' encoding='UTF-8'?>\n<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/1999/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/1999/XMLSchema\">\n<SOAP-ENV:Body>\n<ns1:addEntryResponse xmlns:ns1=\"http://wsifservice.addressbook/\" SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\n</ns1:addEntryResponse>\n\n</SOAP-ENV:Body>\n</SOAP-ENV:Envelope>";

    public SOAPJMSConnection(JMSAddress ja, String portName) throws WSIFException {
        Trc.entry(this, ja, portName);
        destination =
            new WSIFJMSDestination(
                WSIFJMSFinder.newFinder(ja,portName),
                ja.getJmsProvDestName(),
                WSIFProperties.getSyncTimeout());
        Trc.exit(ja);
    }
View Full Code Here


      getOperation();

      // send the jms message   
      String correlId = sendJmsMessage(input);

      WSIFJMSDestination jmsDest = fieldJmsPort.getJmsDestination();
      javax.jms.Message response = jmsDest.receive(correlId, syncTimeout);
      operationSucceeded = receiveJmsMessage(response, output, fault);

    } catch (Exception ex) {
      Trc.exception(ex);
View Full Code Here

   * send jms message
   */
  private String sendJmsMessage(WSIFMessage input) throws WSIFException {

    String correlId = null;
    WSIFJMSDestination jmsDest = fieldJmsPort.getJmsDestination();

    setPropertyValues();

    /**
     * set the parts onto the message
     */
    // The input message parts can either be a jms property
    // or an input part. Input parts not defined in the
    // WSDL will be ignored. Input parts will only be used
    // if there is not a jms:input atribute, or the part
    // name is in the jms:input list. Parts defined in the
    // WSDL but not in the input message defualt to null.
    String partName;
    ArrayList wsdlInputParts = getWSDLInputPartNames();
    HashMap propertyParts = getPropertyParts();
    WSIFMessage message = createInputMessage();
    for (Iterator i = input.getPartNames(); i.hasNext();) {
      partName = (String) i.next();
      if (propertyParts.containsKey(partName)) {
        String name = (String) propertyParts.get(partName);
        Object value = input.getObjectPart(partName);
        if (!timeoutProperty(name, value)) {
          jmsDest.setProperty(name, value);
        }
      } else if (wsdlInputParts.contains(partName)) {
        wsdlInputParts.remove(partName);
        if (fieldInput == null) {
          message.setObjectPart(
            partName,
            input.getObjectPart(partName));
        } else if (fieldInput.getParts().contains(partName)) {
          message.setObjectPart(
            partName,
            input.getObjectPart(partName));
        }
      }
    }

    // default missing parts to null
    for (Iterator i = wsdlInputParts.iterator(); i.hasNext();) {
      message.setObjectPart((String) i.next(), null);
    }

    // properties from the context
    setDestinationContext();

    Service serviceModel = null;
    Definition def = fieldJmsPort.getDefinition();
    Map services = WSIFUtils.getAllItems(def, "Service");
    Port port = fieldJmsPort.getPortModel();
    for (Iterator i = services.values().iterator(); i.hasNext();) {
      Service s = (Service) i.next();
      if (s.getPorts().values().contains(port)) {
        serviceModel = s;
        break;
      }
    }
    if (serviceModel == null) {
      throw new WSIFException("cannot find service for port: " + port);
    }

    formatter = (JMSFormatter) fieldJmsPort.getFormatter();

    WSIFRequest request = new WSIFRequest(serviceModel.getQName());
    request.setIncomingMessage(message);
    request.setOperationName(fieldOperation.getName());
    request.setPortName(fieldJmsPort.getPortModel().getName());
    request.setInputName(fieldBindingOperation.getBindingInput().getName());

    javax.jms.Message jmsMessage =
      jmsDest.createMessage(getJMSMessageType());

    formatter.formatRequest(request, jmsMessage);

    // **NS No support for listener - add that in
    // The basis is off the handler - if handler is defined, we start up the listener
    if (isAsyncOperation() && handler != null)
      jmsDest.setAsyncMode(true);
    correlId = jmsDest.send(jmsMessage, null, !inputOnlyOp);

    return correlId;

  }
View Full Code Here

    return propertyParts;
  }

  private void setPropertyValues() throws WSIFException {
    String value;
    WSIFJMSDestination jmsDest = fieldJmsPort.getJmsDestination();
    // First set the default properties identifying the JMS message
    try {
      value = fieldOperation.getName();
      if (value != null && value.length() > 0) {
        jmsDest.setProperty(
          WSIFConstants.JMS_PROP_OPERATION_NAME,
          value);
      }
    } catch (WSIFException ex) {
      Trc.ignoredException(ex);
    }

    try {
      BindingInput bi = fieldBindingOperation.getBindingInput();
      value = (bi == null) ? null : bi.getName();
      if (value != null && value.length() > 0) {
        jmsDest.setProperty(WSIFConstants.JMS_PROP_INPUT_NAME, value);
      }
    } catch (WSIFException ex) {
      Trc.ignoredException(ex);
    }

    try {
      BindingOutput bo = fieldBindingOperation.getBindingOutput();
      value = (bo == null) ? null : bo.getName();
      if (value != null && value.length() > 0) {
        jmsDest.setProperty(WSIFConstants.JMS_PROP_OUTPUT_NAME, value);
      }
    } catch (WSIFException ex) {
      Trc.ignoredException(ex);
    }
View Full Code Here

   * sets the output message properties from the received JMS message.
   */
  private void setOutProperties(WSIFMessage output) throws WSIFException {

    if (output != null && fieldOutputProperties != null) {
      WSIFJMSDestination jmsDest = fieldJmsPort.getJmsDestination();
      for (Iterator i = fieldOutputProperties.keySet().iterator();
        i.hasNext();
        ) {
        String partName = (String) i.next();
        String propertyName =
          (String) fieldOutputProperties.get(partName);
        try {
          Object propertyValue = jmsDest.getProperty(propertyName);
          output.setObjectPart(partName, propertyValue);
        } catch (WSIFException ex) {
          Trc.ignoredException(ex);
        }
      }
View Full Code Here

    WSIFMessage fault,
    BindingFault bindingFault) throws WSIFException{

    Trc.entry(this, fault, bindingFault);

       WSIFJMSDestination jmsDest = fieldJmsPort.getJmsDestination();
    Iterator it = bindingFault.getExtensibilityElements().iterator();
    while (it.hasNext()) {
      Object ele = it.next();
      if (ele instanceof JMSFaultIndicator) {
        JMSFaultIndicator indic = (JMSFaultIndicator) ele;
        List fProps = indic.getJMSFaultProperties();
        Iterator itFProp = fProps.iterator();
        while (itFProp.hasNext()) {
          Object next = itFProp.next();
          if (next instanceof JMSFaultProperty) {
            JMSFaultProperty fProp = (JMSFaultProperty) next;
            String partName = fProp.getPart();
            String propName = fProp.getName();

            if (partName != null && partName.length() > 0)
              try {
                Object propValue =
                  jmsDest.getProperty(propName);
                fault.setObjectPart(partName, propValue);
              } catch (WSIFException ex) {
                Trc.ignoredException(ex);
              }
          }
        }
      } else if (ele instanceof JMSProperty) {
        JMSProperty prop = (JMSProperty) ele;
        String partName = prop.getPart();
        String propName = prop.getName();

        try {
          Object propValue = jmsDest.getProperty(propName);
          fault.setObjectPart(partName, propValue);
        } catch (WSIFException ex) {
          Trc.ignoredException(ex);
        }
      }
View Full Code Here

   * set the specified jms property values
   */
  private void setJMSPropertyValues(List propertyValues)
    throws WSIFException {
    if (propertyValues != null) {
      WSIFJMSDestination jmsDest = fieldJmsPort.getJmsDestination();
      for (Iterator i = propertyValues.iterator(); i.hasNext();) {
        JMSPropertyValue pv = (JMSPropertyValue) i.next();
        if (pv != null) {
          Object o = getObjectValue(pv.getType(), pv.getValue());
          if (!timeoutProperty(pv.getName(), o)) {
            jmsDest.setProperty(pv.getName(), o);
          }
        }
      }
    }
  }
View Full Code Here

      JMSPropertyValue value = (JMSPropertyValue) attr.get(attName);

      if (value != null) {
        Object o = getObjectValue(value.getType(), value.getValue());
        if (!timeoutProperty(attName, o)) {
                    WSIFJMSDestination jmsDest = fieldJmsPort.getJmsDestination();
          jmsDest.setProperty(attName, o);
        }
      }
    }
  }
View Full Code Here

      } catch (WSIFException ex) {
        Trc.ignoredException(ex);
      }
    }
    if (jmsProps.size() > 0) {
      WSIFJMSDestination jmsDest = fieldJmsPort.getJmsDestination();
      jmsDest.setProperties(jmsProps);
    }
  }
View Full Code Here

      if (isMessaging(inMsg)) {
        operationStyle = WSIFAXISConstants.AXIS_STYLE_MESSAGE;
      }

    Transport axistransport = getTransport();
    WSIFJMSDestination dest = null;
    if (axistransport != null) {
      call.setTransport(axistransport);
      if (axistransport instanceof WSIFJmsTransport) {
        WSIFJmsTransport jmst = (WSIFJmsTransport) axistransport;
        dest = jmst.getDestination();
        dest.setAsyncMode(isAsyncOperation());
        jmst.setSyncTimeout(null); // reset timeouts to defaults
        jmst.setAsyncTimeout(null);
      }
    }

    if (dest != null
      && inJmsPropVals != null
      && !inJmsPropVals.isEmpty()) {
      checkForTimeoutProperties(inJmsPropVals, dest);
      dest.setProperties(inJmsPropVals);
    }

    //TODO: jms:property parts

    setDestinationContext(dest);
View Full Code Here

TOP

Related Classes of org.apache.wsif.util.jms.WSIFJMSDestination

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.