protected void resetPartTypeClass(MessageInfo msgInfo) {
   if (msgInfo != null) {
     int size = msgInfo.getMessageParts().size();
     for (int x = 0; x < size; x++) {
       msgInfo.getMessageParts().get(x).setTypeClass(Source.class);
     }
   }
 }
示例#2
0
 private void justCheckForJAXBAnnotations(ServiceInfo serviceInfo) {
   for (MessageInfo mi : serviceInfo.getMessages().values()) {
     for (MessagePartInfo mpi : mi.getMessageParts()) {
       checkForJAXBAnnotations(
           mpi, serviceInfo.getXmlSchemaCollection(), serviceInfo.getTargetNamespace());
     }
   }
 }
示例#3
0
  private void visitOperation(OperationInfo o) {
    MessageInfo in = o.getInput();
    if (in != null) {
      begin(in);

      for (MessagePartInfo part : in.getMessageParts()) {
        begin(part);
        end(part);
      }

      end(in);
    }

    MessageInfo out = o.getOutput();
    if (out != null) {
      begin(out);

      for (MessagePartInfo part : out.getMessageParts()) {
        begin(part);
        end(part);
      }

      end(out);
    }

    for (FaultInfo f : o.getFaults()) {
      begin(f);

      for (MessagePartInfo part : f.getMessageParts()) {
        begin(part);
        end(part);
      }

      end(f);
    }

    if (o.isUnwrappedCapable()) {
      OperationInfo uop = o.getUnwrappedOperation();
      begin(uop);
      visitOperation(o.getUnwrappedOperation());
      end(uop);
    }
  }
示例#4
0
  public static boolean isSameMessageInfo(MessageInfo mi1, MessageInfo mi2) {
    if ((mi1 == null && mi2 != null) || (mi1 != null && mi2 == null)) {
      return false;
    }

    if (mi1 != null && mi2 != null) {
      List<MessagePartInfo> mpil1 = mi1.getMessageParts();
      List<MessagePartInfo> mpil2 = mi2.getMessageParts();
      if (mpil1.size() != mpil2.size()) {
        return false;
      }
      int idx = 0;
      for (MessagePartInfo mpi1 : mpil1) {
        MessagePartInfo mpi2 = mpil2.get(idx);
        if (!mpi1.getTypeClass().equals(mpi2.getTypeClass())) {
          return false;
        }
        ++idx;
      }
    }
    return true;
  }
  private void setupHeaders(
      BindingOperationInfo op,
      BindingMessageInfo bMsg,
      BindingMessageInfo unwrappedBMsg,
      MessageInfo msg,
      SoapBindingConfiguration config) {
    List<MessagePartInfo> parts = new ArrayList<MessagePartInfo>();
    for (MessagePartInfo part : msg.getMessageParts()) {
      if (config.isHeader(op, part)) {
        SoapHeaderInfo headerInfo = new SoapHeaderInfo();
        headerInfo.setPart(part);
        headerInfo.setUse(config.getUse());

        bMsg.addExtensor(headerInfo);
      } else {
        parts.add(part);
      }
    }
    unwrappedBMsg.setMessageParts(parts);
  }
  private void initializeMessage(
      SoapBindingInfo bi, BindingOperationInfo boi, BindingMessageInfo bmsg) {
    MessageInfo msg = bmsg.getMessageInfo();

    List<MessagePartInfo> messageParts = new ArrayList<MessagePartInfo>();
    messageParts.addAll(msg.getMessageParts());

    List<SoapHeader> headers =
        SOAPBindingUtil.getSoapHeaders(bmsg.getExtensors(ExtensibilityElement.class));
    if (headers != null) {
      for (SoapHeader header : headers) {
        SoapHeaderInfo headerInfo = new SoapHeaderInfo();
        headerInfo.setUse(header.getUse());
        if (StringUtils.isEmpty(header.getPart())) {
          throw new RuntimeException(
              "Problem with WSDL: soap:header element in operation "
                  + boi.getName().getLocalPart()
                  + " does not specify a part.");
        }
        MessagePartInfo part =
            msg.getMessagePart(new QName(msg.getName().getNamespaceURI(), header.getPart()));
        if (part != null
            && header.getMessage() != null
            && !part.getMessageInfo().getName().equals(header.getMessage())) {
          part = null;
          // out of band, let's find it
          for (MessagePartInfo mpi : msg.getOutOfBandParts()) {
            if (mpi.getName().getLocalPart().equals(header.getPart())
                && mpi.getMessageInfo().getName().equals(header.getMessage())) {
              part = mpi;
            }
          }
        }
        if (part != null) {
          headerInfo.setPart(part);
          messageParts.remove(part);
          bmsg.addExtensor(headerInfo);
        }
      }

      // Exclude the header parts from the message part list.
      bmsg.setMessageParts(messageParts);
    }

    SoapBodyInfo bodyInfo = new SoapBodyInfo();
    SoapBody soapBody = SOAPBindingUtil.getSoapBody(bmsg.getExtensors(ExtensibilityElement.class));

    List<?> parts = null;
    if (soapBody == null) {
      MIMEMultipartRelated mmr = bmsg.getExtensor(MIMEMultipartRelated.class);
      if (mmr != null) {
        parts = mmr.getMIMEParts();
      }
    } else {
      bmsg.addExtensor(soapBody);
      bodyInfo.setUse(soapBody.getUse());
      parts = soapBody.getParts();
    }

    // Initialize the body parts.
    List<MessagePartInfo> attParts = null;
    if (parts != null) {
      List<MessagePartInfo> bodyParts = new ArrayList<MessagePartInfo>();
      for (Iterator<?> itr = parts.iterator(); itr.hasNext(); ) {
        Object part = itr.next();
        if (part instanceof MIMEPart) {
          MIMEPart mpart = (MIMEPart) part;
          attParts = handleMimePart(mpart, attParts, msg, bmsg, bodyParts, messageParts);
        } else {
          addSoapBodyPart(msg, bodyParts, (String) part);
        }
      }
      bodyInfo.setParts(bodyParts);
      bodyInfo.setAttachments(attParts);
    } else {
      bodyInfo.setParts(messageParts);
    }

    bmsg.addExtensor(bodyInfo);
  }
  private void addOutOfBandParts(
      final BindingOperationInfo bop,
      final javax.wsdl.Message msg,
      final SchemaCollection schemas,
      boolean isInput,
      final String partName) {
    MessageInfo minfo = null;
    MessageInfo.Type type;

    int nextId = 0;
    minfo = bop.getOperationInfo().getInput();
    if (minfo != null) {
      for (MessagePartInfo part : minfo.getMessageParts()) {
        if (part.getIndex() >= nextId) {
          nextId = part.getIndex() + 1;
        }
      }
    }
    minfo = bop.getOperationInfo().getOutput();
    if (minfo != null) {
      for (MessagePartInfo part : minfo.getMessageParts()) {
        if (part.getIndex() >= nextId) {
          nextId = part.getIndex() + 1;
        }
      }
    }

    if (isInput) {
      type = MessageInfo.Type.INPUT;
      minfo = bop.getOperationInfo().getInput();
    } else {
      type = MessageInfo.Type.OUTPUT;
      minfo = bop.getOperationInfo().getOutput();
    }

    if (minfo == null) {
      minfo = new MessageInfo(null, type, msg.getQName());
    }
    buildMessage(minfo, msg, schemas, nextId, partName);

    // for wrapped style
    OperationInfo unwrapped = bop.getOperationInfo().getUnwrappedOperation();
    if (unwrapped == null) {
      return;
    }

    nextId = 0;
    minfo = unwrapped.getInput();
    if (minfo != null) {
      for (MessagePartInfo part : minfo.getMessageParts()) {
        if (part.getIndex() >= nextId) {
          nextId = part.getIndex() + 1;
        }
      }
    }
    minfo = unwrapped.getOutput();
    if (minfo != null) {
      for (MessagePartInfo part : minfo.getMessageParts()) {
        if (part.getIndex() >= nextId) {
          nextId = part.getIndex() + 1;
        }
      }
    }

    if (isInput) {
      minfo = unwrapped.getInput();
      type = MessageInfo.Type.INPUT;
    } else {
      minfo = unwrapped.getOutput();
      type = MessageInfo.Type.OUTPUT;
    }

    if (minfo == null) {
      minfo = new MessageInfo(unwrapped, type, msg.getQName());
    }
    buildMessage(minfo, msg, schemas, nextId, partName);
  }