public static String[] getNSServiceNameAndMessageNameArray(
     Definition wsdlDefinition,
     String serviceName,
     String portName,
     String bindingName,
     String opName) {
   Map<?, ?> services = wsdlDefinition.getServices();
   Set<?> serviceKeys = services.keySet();
   for (Iterator<?> it = serviceKeys.iterator(); it.hasNext(); ) {
     QName serviceKey = (QName) it.next();
     if (serviceName != null && serviceKey.getLocalPart().contentEquals(serviceName)) {
       Service service = (Service) services.get(serviceKey);
       Map<?, ?> ports = service.getPorts();
       Set<?> portKeys = ports.keySet();
       for (Iterator<?> it2 = portKeys.iterator(); it2.hasNext(); ) {
         String portKey = (String) it2.next();
         if (portName != null && portKey.contentEquals(portName)) {
           Port port = (Port) ports.get(portKey);
           Binding wsdlBinding = port.getBinding();
           PortType portType = wsdlBinding.getPortType();
           String ns = portType.getQName().getNamespaceURI();
           List<?> operations = portType.getOperations();
           for (Iterator<?> it3 = operations.iterator(); it3.hasNext(); ) {
             Operation operation = (Operation) it3.next();
             if (opName != null && operation.getName().contentEquals(opName)) {
               return new String[] {ns, serviceName, portName};
             }
           }
         }
       }
     }
   }
   return null;
 }
  private CorrelationKeySet computeCorrelationKeys(MyRoleMessageExchangeImpl mex) {
    CorrelationKeySet keySet = new CorrelationKeySet();

    Operation operation = mex.getOperation();
    Element msg = mex.getRequest().getMessage();
    javax.wsdl.Message msgDescription = operation.getInput().getMessage();

    Set<OScope.CorrelationSet> csets =
        _plinkDef.getNonInitiatingCorrelationSetsForOperation(operation);
    for (OScope.CorrelationSet cset : csets) {
      CorrelationKey key =
          computeCorrelationKey(
              cset, _process.getOProcess().messageTypes.get(msgDescription.getQName()), msg);
      keySet.add(key);
    }

    csets = _plinkDef.getJoinningCorrelationSetsForOperation(operation);
    for (OScope.CorrelationSet cset : csets) {
      CorrelationKey key =
          computeCorrelationKey(
              cset, _process.getOProcess().messageTypes.get(msgDescription.getQName()), msg);
      keySet.add(key);
    }

    // Let's creata a key based on the sessionId
    String mySessionId = mex.getProperty(MessageExchange.PROPERTY_SEP_MYROLE_SESSIONID);
    if (mySessionId != null) keySet.add(new CorrelationKey("-1", new String[] {mySessionId}));

    return keySet;
  }
Exemple #3
0
  private void convertPortType(PortType portType, Binding binding) throws IOException {
    String comment = "";
    if (portType.getDocumentationElement() != null) {
      comment = portType.getDocumentationElement().getNodeValue();
    }

    Style style = Style.DOCUMENT;
    for (ExtensibilityElement element :
        (List<ExtensibilityElement>) binding.getExtensibilityElements()) {
      if (element instanceof SOAPBinding) {
        if ("rpc".equals(((SOAPBinding) element).getStyle())) {
          style = Style.RPC;
        }
      } else if (element instanceof HTTPBinding) {
        style = Style.HTTP;
      }
    }
    Interface iface = new Interface(portType.getQName().getLocalPart(), comment);
    List<Operation> operations = portType.getOperations();
    for (Operation operation : operations) {
      if (operation.getOutput() == null) {
        iface.addOneWayOperation(convertOperation(operation, style));
      } else {
        iface.addRequestResponseOperation(convertOperation(operation, style));
      }
    }
    interfaces.put(iface.name(), iface);
  }
Exemple #4
0
 private Map<QName, Operation> getOperations(PortType portType) {
   Map<QName, Operation> operations = new HashMap<QName, Operation>();
   Collection<Operation> pops = CastUtils.cast(portType.getOperations());
   for (Operation op : pops) {
     operations.put(new QName(portType.getQName().getNamespaceURI(), op.getName()), op);
   }
   return operations;
 }
Exemple #5
0
  private boolean checkR2201Input(final Operation operation, final BindingOperation bop) {
    List<Part> partsList = wsdlHelper.getInMessageParts(operation);
    int inmessagePartsCount = partsList.size();
    SoapBody soapBody = SOAPBindingUtil.getBindingInputSOAPBody(bop);
    if (soapBody != null) {
      List<?> parts = soapBody.getParts();
      int boundPartSize = parts == null ? inmessagePartsCount : parts.size();
      SoapHeader soapHeader = SOAPBindingUtil.getBindingInputSOAPHeader(bop);
      boundPartSize =
          soapHeader != null
                  && soapHeader.getMessage().equals(operation.getInput().getMessage().getQName())
              ? boundPartSize - 1
              : boundPartSize;

      if (parts != null) {
        Iterator<?> partsIte = parts.iterator();
        while (partsIte.hasNext()) {
          String partName = (String) partsIte.next();
          boolean isDefined = false;
          for (Part part : partsList) {
            if (partName.equalsIgnoreCase(part.getName())) {
              isDefined = true;
              break;
            }
          }
          if (!isDefined) {
            addErrorMessage(
                getErrorPrefix("WSI-BP-1.0 R2201")
                    + "Operation '"
                    + operation.getName()
                    + "' soapBody parts : "
                    + partName
                    + " not found in the message, wrong WSDL");
            return false;
          }
        }
      } else {
        if (partsList.size() > 1) {
          addErrorMessage(
              getErrorPrefix("WSI-BP-1.0 R2210")
                  + "Operation '"
                  + operation.getName()
                  + "' more than one part bound to body");
          return false;
        }
      }

      if (boundPartSize > 1) {
        addErrorMessage(
            getErrorPrefix("WSI-BP-1.0 R2201")
                + "Operation '"
                + operation.getName()
                + "' more than one part bound to body");
        return false;
      }
    }
    return true;
  }
 private void setMexRole(MyRoleMessageExchangeImpl mex) {
   Operation operation = getMyRoleOperation(mex.getOperationName());
   mex.getDAO().setPartnerLinkModelId(_plinkDef.getId());
   mex.setPortOp(_plinkDef.myRolePortType, operation);
   mex.setPattern(
       operation.getOutput() == null
           ? MessageExchange.MessageExchangePattern.REQUEST_ONLY
           : MessageExchange.MessageExchangePattern.REQUEST_RESPONSE);
 }
 @SuppressWarnings("unchecked")
 public boolean isOneWayOnly() {
   PortType portType = _plinkDef.myRolePortType;
   if (portType == null) {
     return false;
   }
   for (Operation operation : (List<Operation>) portType.getOperations()) {
     if (operation.getOutput() != null) {
       return false;
     }
   }
   return true;
 }
  public void invokeNewInstance(MyRoleMessageExchangeImpl mex, RoutingInfo routing) {
    Operation operation = getMyRoleOperation(mex.getOperationName());

    if (__log.isDebugEnabled()) {
      __log.debug(
          "INPUTMSG: "
              + routing.correlator.getCorrelatorId()
              + ": routing failed, CREATING NEW INSTANCE");
    }
    ProcessDAO processDAO = _process.getProcessDAO();

    if (_process._pconf.getState() == ProcessState.RETIRED) {
      throw new InvalidProcessException(
          "Process is retired.", InvalidProcessException.RETIRED_CAUSE_CODE);
    }

    if (!_process.processInterceptors(mex, InterceptorInvoker.__onNewInstanceInvoked)) {
      __log.debug("Not creating a new instance for mex " + mex + "; interceptor prevented!");
      throw new InvalidProcessException(
          "Cannot instantiate process '" + _process.getPID() + "' any more.",
          InvalidProcessException.TOO_MANY_INSTANCES_CAUSE_CODE);
    }

    ProcessInstanceDAO newInstance = processDAO.createInstance(routing.correlator);

    BpelRuntimeContextImpl instance =
        _process.createRuntimeContext(newInstance, new PROCESS(_process.getOProcess()), mex);

    // send process instance event
    NewProcessInstanceEvent evt =
        new NewProcessInstanceEvent(
            new QName(_process.getOProcess().targetNamespace, _process.getOProcess().getName()),
            _process.getProcessDAO().getProcessId(),
            newInstance.getInstanceId());
    evt.setPortType(mex.getPortType().getQName());
    evt.setOperation(operation.getName());
    evt.setMexId(mex.getMessageExchangeId());
    _process._debugger.onEvent(evt);
    _process.saveEvent(evt, newInstance);
    mex.setCorrelationStatus(MyRoleMessageExchange.CorrelationStatus.CREATE_INSTANCE);
    mex.getDAO().setInstance(newInstance);
    if (mex.getDAO().getCreateTime() == null)
      mex.getDAO().setCreateTime(instance.getCurrentEventDateTime());

    _process._engine.acquireInstanceLock(newInstance.getInstanceId());
    instance.execute();
  }
  public void invokeInstance(MyRoleMessageExchangeImpl mex, RoutingInfo routing) {
    Operation operation = getMyRoleOperation(mex.getOperationName());
    if (__log.isDebugEnabled()) {
      __log.debug(
          "INPUTMSG: "
              + routing.correlator.getCorrelatorId()
              + ": ROUTING to existing instance "
              + routing.messageRoute.getTargetInstance().getInstanceId());
    }

    ProcessInstanceDAO instanceDao = routing.messageRoute.getTargetInstance();
    BpelProcess process2 =
        _process._engine._activeProcesses.get(instanceDao.getProcess().getProcessId());

    // Reload process instance for DAO.
    BpelRuntimeContextImpl instance = process2.createRuntimeContext(instanceDao, null, null);
    instance.inputMsgMatch(routing.messageRoute.getGroupId(), routing.messageRoute.getIndex(), mex);

    // Kill the route so some new message does not get routed to
    // same process instance.
    routing.correlator.removeRoutes(routing.messageRoute.getGroupId(), instanceDao);

    // send process instance event
    CorrelationMatchEvent evt =
        new CorrelationMatchEvent(
            new QName(process2.getOProcess().targetNamespace, process2.getOProcess().getName()),
            process2.getProcessDAO().getProcessId(),
            instanceDao.getInstanceId(),
            routing.matchedKeySet);
    evt.setPortType(mex.getPortType().getQName());
    evt.setOperation(operation.getName());
    evt.setMexId(mex.getMessageExchangeId());

    process2._debugger.onEvent(evt);
    // store event
    process2.saveEvent(evt, instanceDao);

    mex.setCorrelationStatus(MyRoleMessageExchange.CorrelationStatus.MATCHED);
    mex.getDAO().setInstance(routing.messageRoute.getTargetInstance());
    if (mex.getDAO().getCreateTime() == null)
      mex.getDAO().setCreateTime(instance.getCurrentEventDateTime());

    instance.execute();
  }
  public Operation getOperation(Definition wsdlDef) {
    //		if(wsdlDef==null) wsdlDef = getService().getDefinition();

    PortType pt = getPortType(wsdlDef);
    List operations = pt.getOperations();
    for (Iterator iter = operations.iterator(); iter.hasNext(); ) {
      Operation op = (Operation) iter.next();
      // review: actually testing operation types also needed
      //		or webservice activity should have 'message' field
      //      so that the overloaded operations those have same signature name
      //		can be designated
      if (op.getName().equals(getOperationName())) {
        if (op.getInput().getMessage().getParts().size() == getParameters().length) {
          return op;
        }
      }
    }

    return null;
  }
Exemple #11
0
  // TODO: Should also check SoapHeader/SoapHeaderFault
  public boolean checkR2205() {
    Collection<Binding> bindings = CastUtils.cast(def.getBindings().values());
    for (Binding binding : bindings) {

      if (!SOAPBindingUtil.isSOAPBinding(binding)) {
        System.err.println(
            "WSIBP Validator found <" + binding.getQName() + "> is NOT a SOAP binding");
        continue;
      }
      if (binding.getPortType() == null) {
        // will error later
        continue;
      }

      for (Iterator<?> ite2 = binding.getPortType().getOperations().iterator(); ite2.hasNext(); ) {
        Operation operation = (Operation) ite2.next();
        Collection<Fault> faults = CastUtils.cast(operation.getFaults().values());
        if (CollectionUtils.isEmpty(faults)) {
          continue;
        }

        for (Fault fault : faults) {
          Message message = fault.getMessage();
          Collection<Part> parts = CastUtils.cast(message.getParts().values());
          for (Part part : parts) {
            if (part.getElementName() == null) {
              addErrorMessage(
                  getErrorPrefix("WSI-BP-1.0 R2205")
                      + "In Message "
                      + message.getQName()
                      + ", part "
                      + part.getName()
                      + " must specify a 'element' attribute");
              return false;
            }
          }
        }
      }
    }
    return true;
  }
Exemple #12
0
 public boolean checkBinding() {
   for (PortType portType : wsdlHelper.getPortTypes(def)) {
     Iterator<?> ite = portType.getOperations().iterator();
     while (ite.hasNext()) {
       Operation operation = (Operation) ite.next();
       if (isOverloading(operation.getName())) {
         continue;
       }
       BindingOperation bop = wsdlHelper.getBindingOperation(def, operation.getName());
       if (bop == null) {
         addErrorMessage(
             getErrorPrefix("WSI-BP-1.0 R2718")
                 + "A wsdl:binding in a DESCRIPTION MUST have the same set of "
                 + "wsdl:operations as the wsdl:portType to which it refers. "
                 + operation.getName()
                 + " not found in wsdl:binding.");
         return false;
       }
       Binding binding = wsdlHelper.getBinding(bop, def);
       String bindingStyle = binding != null ? SOAPBindingUtil.getBindingStyle(binding) : "";
       String style =
           StringUtils.isEmpty(SOAPBindingUtil.getSOAPOperationStyle(bop))
               ? bindingStyle
               : SOAPBindingUtil.getSOAPOperationStyle(bop);
       if ("DOCUMENT".equalsIgnoreCase(style) || StringUtils.isEmpty(style)) {
         boolean passed =
             checkR2201Input(operation, bop)
                 && checkR2201Output(operation, bop)
                 && checkR2716(bop);
         if (!passed) {
           return false;
         }
       } else {
         if (!checkR2717AndR2726(bop)) {
           return false;
         }
       }
     }
   }
   return true;
 }
  public void testOperation() {
    // prepare persistent objects
    // operation
    Operation operation = new OperationImpl();
    operation.setName("o");
    // port type
    PortType portType = new PortTypeImpl();
    portType.setQName(new QName("pt"));
    portType.addOperation(operation);
    // process
    process.getImports().addPortType(portType);
    // replier
    replier.setOperation(operation);

    // save objects and load them back
    process = saveAndReload(process);
    replier = getReplier(process);

    // verify the retrieved objects
    assertEquals("o", replier.getOperation().getName());
  }
  public void createSoapRequest(MessageContext msgCtx, Element message, Operation op)
      throws AxisFault {
    if (op == null) {
      throw new NullPointerException("Null operation");
    }
    // The message can be null if the input message has no part
    if (op.getInput().getMessage().getParts().size() > 0 && message == null) {
      throw new NullPointerException("Null message.");
    }
    if (msgCtx == null) {
      throw new NullPointerException("Null msgCtx");
    }

    BindingOperation bop = binding.getBindingOperation(op.getName(), null, null);

    if (bop == null) {
      throw new OdeFault("BindingOperation not found.");
    }

    BindingInput bi = bop.getBindingInput();
    if (bi == null) {
      throw new OdeFault("BindingInput not found.");
    }

    SOAPEnvelope soapEnv = msgCtx.getEnvelope();
    if (soapEnv == null) {
      soapEnv = soapFactory.getDefaultEnvelope();
      msgCtx.setEnvelope(soapEnv);
    }

    //        createSoapHeaders(soapEnv, getSOAPHeaders(bi), op.getInput().getMessage(), message);

    SOAPBody soapBody = getSOAPBody(bi);
    if (soapBody != null) {
      org.apache.axiom.soap.SOAPBody sb =
          soapEnv.getBody() == null ? soapFactory.createSOAPBody(soapEnv) : soapEnv.getBody();
      createSoapBody(sb, soapBody, op.getInput().getMessage(), message, op.getName());
    }
  }
Exemple #15
0
  public Mapper findMapper(NormalizedMessage nmsMsg, Operation op) {
    ArrayList<Mapper> maybe = new ArrayList<Mapper>();

    for (Mapper m : _mappers) {
      Mapper.Recognized result = m.isRecognized(nmsMsg, op);
      switch (result) {
        case TRUE:
          return m;
        case FALSE:
          continue;
        case UNSURE:
          maybe.add(m);
          break;
      }
    }

    if (maybe.size() == 0) return null;
    if (maybe.size() == 1) return maybe.get(0);

    __log.warn("Multiple mappers may match input message for operation " + op.getName());
    // Get the first match.
    return maybe.get(0);
  }
Exemple #16
0
  private void collectValidationPointsForPortTypes() {
    for (QName ptName : portTypeRefNames) {
      PortType portType = getPortType(ptName);
      if (portType == null) {
        vResults.addError(new Message("NO_PORTTYPE", LOG, ptName));
        continue;
      }

      XNode vPortTypeNode = getXNode(portType);
      for (Operation operation : getOperations(portType).values()) {
        XNode vOperationNode = getOperationXNode(vPortTypeNode, operation.getName());
        if (operation.getInput() == null) {
          vResults.addError(
              new Message("WRONG_MEP", LOG, operation.getName(), portType.getQName()));
          continue;
        }
        javax.wsdl.Message inMsg = operation.getInput().getMessage();
        if (inMsg == null) {
          addWarning(
              "Operation "
                  + operation.getName()
                  + " in PortType: "
                  + portType.getQName()
                  + " has no input message");
        } else {
          XNode vInMsgNode = getXNode(inMsg);
          vInMsgNode.setFailurePoint(getInputXNode(vOperationNode, operation.getInput().getName()));
          vNodes.add(vInMsgNode);
          messageRefNames.add(inMsg.getQName());
        }

        if (operation.getOutput() != null) {
          javax.wsdl.Message outMsg = operation.getOutput().getMessage();

          if (outMsg == null) {
            addWarning(
                "Operation "
                    + operation.getName()
                    + " in PortType: "
                    + portType.getQName()
                    + " has no output message");
          } else {
            XNode vOutMsgNode = getXNode(outMsg);
            vOutMsgNode.setFailurePoint(
                getOutputXNode(vOperationNode, operation.getOutput().getName()));
            vNodes.add(vOutMsgNode);
            messageRefNames.add(outMsg.getQName());
          }
        }
        for (Iterator<?> iter = operation.getFaults().values().iterator(); iter.hasNext(); ) {
          Fault fault = (Fault) iter.next();
          javax.wsdl.Message faultMsg = fault.getMessage();
          XNode vFaultMsgNode = getXNode(faultMsg);
          vFaultMsgNode.setFailurePoint(getFaultXNode(vOperationNode, fault.getName()));
          vNodes.add(vFaultMsgNode);
          messageRefNames.add(faultMsg.getQName());
        }
      }
    }
  }
Exemple #17
0
  public List<RoutingInfo> findRoute(MyRoleMessageExchangeImpl mex) {
    List<RoutingInfo> routingInfos = new ArrayList<RoutingInfo>();

    if (__log.isTraceEnabled()) {
      __log.trace(
          ObjectPrinter.stringifyMethodEnter(
              this + ":inputMsgRcvd", new Object[] {"messageExchange", mex}));
    }

    Operation operation = getMyRoleOperation(mex.getOperationName());
    if (operation == null) {
      __log.error(
          __msgs.msgUnknownOperation(mex.getOperationName(), _plinkDef.myRolePortType.getQName()));
      mex.setFailure(MessageExchange.FailureType.UNKNOWN_OPERATION, mex.getOperationName(), null);
      return null;
    }
    setMexRole(mex);

    // now, the tricks begin: when a message arrives we have to see if there
    // is anyone waiting for it. Get the correlator, a persisted communication-reduction
    // data structure supporting correlation correlationKey matching!
    String correlatorId = BpelProcess.genCorrelatorId(_plinkDef, operation.getName());

    CorrelatorDAO correlator = _process.getProcessDAO().getCorrelator(correlatorId);

    CorrelationKeySet keySet;

    // We need to compute the correlation keys (based on the operation
    // we can  infer which correlation keys to compute - this is merely a set
    // consisting of each correlationKey used in each correlation sets
    // that is ever referenced in an <receive>/<onMessage> on this
    // partnerlink/operation.
    try {
      keySet = computeCorrelationKeys(mex);
    } catch (InvalidMessageException ime) {
      // We'd like to do a graceful exit here, no sense in rolling back due to a
      // a message format problem.
      __log.debug("Unable to evaluate correlation keys, invalid message format. ", ime);
      mex.setFailure(MessageExchange.FailureType.FORMAT_ERROR, ime.getMessage(), null);
      return null;
    }

    String mySessionId = mex.getProperty(MessageExchange.PROPERTY_SEP_MYROLE_SESSIONID);
    String partnerSessionId = mex.getProperty(MessageExchange.PROPERTY_SEP_PARTNERROLE_SESSIONID);
    if (__log.isDebugEnabled()) {
      __log.debug(
          "INPUTMSG: "
              + correlatorId
              + ": MSG RCVD keys="
              + keySet
              + " mySessionId="
              + mySessionId
              + " partnerSessionId="
              + partnerSessionId);
    }

    // Try to find a route for one of our keys.
    List<MessageRouteDAO> messageRoutes = correlator.findRoute(keySet);
    if (messageRoutes != null && messageRoutes.size() > 0) {
      for (MessageRouteDAO messageRoute : messageRoutes) {
        if (__log.isDebugEnabled()) {
          __log.debug(
              "INPUTMSG: "
                  + correlatorId
                  + ": ckeySet "
                  + messageRoute.getCorrelationKeySet()
                  + " route is to "
                  + messageRoute);
        }
        routingInfos.add(
            new RoutingInfo(messageRoute, messageRoute.getCorrelationKeySet(), correlator, keySet));
      }
    }

    if (routingInfos.size() == 0) {
      routingInfos.add(new RoutingInfo(null, null, correlator, keySet));
    }

    return routingInfos;
  }
Exemple #18
0
  public boolean checkR2203And2204() {

    Collection<Binding> bindings = CastUtils.cast(def.getBindings().values());
    for (Binding binding : bindings) {

      String style = SOAPBindingUtil.getCanonicalBindingStyle(binding);

      if (binding.getPortType() == null) {
        return true;
      }

      //

      for (Iterator<?> ite2 = binding.getPortType().getOperations().iterator(); ite2.hasNext(); ) {
        Operation operation = (Operation) ite2.next();
        BindingOperation bop = wsdlHelper.getBindingOperation(def, operation.getName());
        if (operation.getInput() != null && operation.getInput().getMessage() != null) {
          Message inMess = operation.getInput().getMessage();

          for (Iterator<?> ite3 = inMess.getParts().values().iterator(); ite3.hasNext(); ) {
            Part p = (Part) ite3.next();
            if (SOAPBinding.Style.RPC.name().equalsIgnoreCase(style)
                && p.getTypeName() == null
                && !isHeaderPart(bop, p)) {
              addErrorMessage(
                  "An rpc-literal binding in a DESCRIPTION MUST refer, "
                      + "in its soapbind:body element(s), only to "
                      + "wsdl:part element(s) that have been defined "
                      + "using the type attribute.");
              return false;
            }

            if (SOAPBinding.Style.DOCUMENT.name().equalsIgnoreCase(style)
                && p.getElementName() == null) {
              addErrorMessage(
                  "A document-literal binding in a DESCRIPTION MUST refer, "
                      + "in each of its soapbind:body element(s),"
                      + "only to wsdl:part element(s)"
                      + " that have been defined using the element attribute.");
              return false;
            }
          }
        }
        if (operation.getOutput() != null && operation.getOutput().getMessage() != null) {
          Message outMess = operation.getOutput().getMessage();
          for (Iterator<?> ite3 = outMess.getParts().values().iterator(); ite3.hasNext(); ) {
            Part p = (Part) ite3.next();
            if (style.equalsIgnoreCase(SOAPBinding.Style.RPC.name())
                && p.getTypeName() == null
                && !isHeaderPart(bop, p)) {
              addErrorMessage(
                  "An rpc-literal binding in a DESCRIPTION MUST refer, "
                      + "in its soapbind:body element(s), only to "
                      + "wsdl:part element(s) that have been defined "
                      + "using the type attribute.");
              return false;
            }

            if (style.equalsIgnoreCase(SOAPBinding.Style.DOCUMENT.name())
                && p.getElementName() == null) {
              addErrorMessage(
                  "A document-literal binding in a DESCRIPTION MUST refer, "
                      + "in each of its soapbind:body element(s),"
                      + "only to wsdl:part element(s)"
                      + " that have been defined using the element attribute.");
              return false;
            }
          }
        }
      }
    }
    return true;
  }
  public ReplyAction readReplyAction(Element replyElem, CompositeActivity parent) {
    ReplyAction replyAction = new ReplyAction();

    // partner link
    String partnerLinkName = replyElem.getAttribute(BpelConstants.ATTR_PARTNER_LINK);
    PartnerLinkDefinition partnerLink = parent.findPartnerLink(partnerLinkName);
    if (partnerLink == null) {
      bpelReader.getProblemHandler().add(new ParseProblem("partner link not found", replyElem));
      return replyAction;
    }
    replyAction.setPartnerLink(partnerLink);

    // port type
    Role myRole = partnerLink.getMyRole();
    // BPEL-181 detect absence of my role
    if (myRole == null) {
      bpelReader
          .getProblemHandler()
          .add(new ParseProblem("partner link does not indicate my role", replyElem));
      return replyAction;
    }
    PortType portType = bpelReader.getMessageActivityPortType(replyElem, partnerLink.getMyRole());

    // operation
    Operation operation = bpelReader.getMessageActivityOperation(replyElem, portType);
    if (operation.getStyle() != OperationType.REQUEST_RESPONSE) {
      bpelReader
          .getProblemHandler()
          .add(new ParseProblem("not a request/response operation", replyElem));
      return replyAction;
    }
    replyAction.setOperation(operation);

    // message exchange
    // BPEL-74: map the empty message exchange to null for compatibility with Oracle
    replyAction.setMessageExchange(
        XmlUtil.getAttribute(replyElem, BpelConstants.ATTR_MESSAGE_EXCHANGE));

    // fault name
    Message replyMessage;
    Attr faultNameAttr = replyElem.getAttributeNode(BpelConstants.ATTR_FAULT_NAME);
    if (faultNameAttr != null) {
      QName faultName = XmlUtil.getQNameValue(faultNameAttr);
      replyAction.setFaultName(faultName);

      Fault fault = operation.getFault(faultName.getLocalPart());
      if (fault == null) {
        bpelReader.getProblemHandler().add(new ParseProblem("fault not found", replyElem));
        return replyAction;
      }
      replyMessage = fault.getMessage();
    } else replyMessage = operation.getOutput().getMessage();

    // variable
    VariableDefinition variable =
        bpelReader.getMessageActivityVariable(
            replyElem, BpelConstants.ATTR_VARIABLE, parent, replyMessage);
    replyAction.setVariable(variable);

    // correlations
    Element correlationsElement =
        XmlUtil.getElement(replyElem, BpelConstants.NS_BPEL, BpelConstants.ELEM_CORRELATIONS);
    if (correlationsElement != null)
      replyAction.setCorrelations(
          bpelReader.readCorrelations(correlationsElement, parent, variable));

    return replyAction;
  }
 public String getCorrelatorId() {
   return partnerLink.getId() + "." + operation.getName();
 }
  protected void addPortTypeTransformers(
      PortType portType,
      boolean provider,
      StringBuffer transformers,
      javax.wsdl.Definition wsdl,
      ResourceLocator locator,
      String srcFolder) {
    String attr1 = (provider ? "from" : "to");
    String attr2 = (provider ? "to" : "from");

    for (Object opobj : portType.getOperations()) {
      if (opobj instanceof javax.wsdl.Operation) {
        javax.wsdl.Operation op = (javax.wsdl.Operation) opobj;

        String qname = "";
        String javaType = "";
        String javaPackage = "";

        javax.wsdl.Part p =
            (javax.wsdl.Part) op.getInput().getMessage().getParts().values().iterator().next();
        qname = p.getElementName().toString();

        javaType = getJavaType(wsdl, p.getElementName(), locator);

        if (javaType != null) {
          int ind = javaType.lastIndexOf('.');
          if (ind != -1) {
            javaPackage = javaType.substring(0, ind);
          }
        }

        transformers.append("\t\t<xform:transform.jaxb\r\n");
        transformers.append("\t\t\t" + attr1 + "=\"" + qname + "\"\r\n");
        transformers.append("\t\t\t" + attr2 + "=\"java:" + javaType + "\"\r\n");
        transformers.append("\t\t\tcontextPath=\"" + javaPackage + "\"/>\r\n");

        if (op.getOutput() != null) {
          p = (javax.wsdl.Part) op.getOutput().getMessage().getParts().values().iterator().next();
          qname = p.getElementName().toString();

          javaType = getJavaType(wsdl, p.getElementName(), locator);

          if (javaType != null) {
            int ind = javaType.lastIndexOf('.');
            if (ind != -1) {
              javaPackage = javaType.substring(0, ind);
            }
          }

          transformers.append("\t\t<xform:transform.jaxb\r\n");
          transformers.append("\t\t\t" + attr2 + "=\"" + qname + "\"\r\n");
          transformers.append("\t\t\t" + attr1 + "=\"java:" + javaType + "\"\r\n");
          transformers.append("\t\t\tcontextPath=\"" + javaPackage + "\"/>\r\n");
        }

        for (Object faultObj : op.getFaults().values()) {
          if (faultObj instanceof javax.wsdl.Fault) {
            javax.wsdl.Fault fault = (javax.wsdl.Fault) faultObj;

            p = (javax.wsdl.Part) fault.getMessage().getParts().values().iterator().next();
            qname = p.getElementName().toString();

            String javaFaultType = getJavaType(wsdl, p.getElementName(), locator);

            String pack =
                JavaGeneratorUtil.getJavaPackage(fault.getMessage().getQName().getNamespaceURI());

            javaType =
                pack
                    + "."
                    + JavaGeneratorUtil.getJavaClassName(
                        fault.getMessage().getQName().getLocalPart());

            String transformerClassName = getFaultTransformerClassName(javaType, provider);

            String faultTransClass = pack + "." + transformerClassName;

            transformers.append("\t\t<xform:transform.java class=\"" + faultTransClass + "\"\r\n");
            transformers.append("\t\t\t" + attr2 + "=\"" + qname + "\"\r\n");
            transformers.append("\t\t\t" + attr1 + "=\"java:" + javaType + "\"/>\r\n");

            // Create transformer class
            String folder = pack.replace('.', java.io.File.separatorChar);

            String javaFile = folder + java.io.File.separator + transformerClassName;

            java.io.File jFile =
                new java.io.File(srcFolder + java.io.File.separator + javaFile + ".java");

            jFile.getParentFile().mkdirs();

            try {
              java.io.FileOutputStream fos = new java.io.FileOutputStream(jFile);

              generateFaultTransformer(qname, javaType, javaFaultType, provider, fos);

              fos.close();
            } catch (Exception e) {
              logger.log(Level.SEVERE, "Failed to create fault transformer", e);
            }
          }
        }
      }
    }
  }
Exemple #22
0
  /**
   * Build the WSDL model.
   *
   * @param abstractService collected Service information
   * @param prebuild XSD generator for type section
   * @return WSDL definition
   */
  public Definition buildDefinition(AbstractService abstractService, XsdSchemaGenerator xsdgen)
      throws WSDLException, java.lang.Exception {
    String serviceName = helper.reformatOWLSSupportedByString(abstractService.getID());
    String serviceDescription = abstractService.getDescription();
    Map<String, Vector<AbstractServiceParameter>> mapInputs =
        new HashMap<String, Vector<AbstractServiceParameter>>();
    Map<String, Vector<AbstractServiceParameter>> mapOutputs =
        new HashMap<String, Vector<AbstractServiceParameter>>();
    Map<String, AtomicProcess> mapProcesses = new HashMap<String, AtomicProcess>();

    System.out.println("[BUILD] Servicename: " + serviceName);
    System.out.println("[BUILD] description: " + serviceDescription);

    if (!this.validateServiceParameterTypes(abstractService)) {
      throw new Exception("Error in parameter list. Datatype not found.");
    }

    Vector<AtomicProcess> processes = abstractService.getProcesses();
    Iterator<AtomicProcess> itA = processes.iterator();
    while (itA.hasNext()) {
      AtomicProcess ap = itA.next();
      Vector<AbstractServiceParameter> inputParameter = ap.getInputParameter();
      Vector<AbstractServiceParameter> outputParameter = ap.getOutputParameter();
      String operationName = ap.getName();
      //			for (int i = 0; i < ap.getOutputParameter().size(); i++) {
      //				String operationName = "get"
      //						+ ((AbstractServiceParameter) ap
      //								.getOutputParameter().get(i)).getID();
      System.out.println("[BUILD] Operation  : " + operationName);
      //			}
      mapInputs.put(operationName, inputParameter);
      mapOutputs.put(operationName, outputParameter);
      mapProcesses.put(operationName, ap);
    }

    WSDLFactory wsdlFactory = WSDLFactory.newInstance();
    ExtensionRegistry extensionRegistry = wsdlFactory.newPopulatedExtensionRegistry();
    Definition def = wsdlFactory.newDefinition();

    SchemaSerializer schemaSer = new SchemaSerializer();
    extensionRegistry.setDefaultSerializer(schemaSer);

    //
    // NAMESPACE
    //
    // e.g. "http://dmas.dfki.de/axis/services/"

    int index = abstractService.getBase().lastIndexOf(".");

    String targetNS = abstractService.getBase().substring(0, index);

    if (OWLS2WSDLSettings.getInstance().getProperty("CHANGE_TNS").equals("yes")) {
      String tns_basepath = OWLS2WSDLSettings.getInstance().getProperty("TNS_BASEPATH");
      targetNS = tns_basepath + serviceName;
      def.setQName(new QName(tns_basepath, serviceName)); // +"Service"));
    } else {
      def.setQName(
          new QName(abstractService.getBasePath(), serviceName)); // abstractService.getID()));
    }

    System.out.println("abstractService.getBase    : " + abstractService.getBase());
    System.out.println("abstractService.getBasePath: " + abstractService.getBasePath());

    // def.setDocumentBaseURI("http://document/base");
    def.setTargetNamespace(targetNS);
    def.addNamespace("tns", targetNS);
    def.addNamespace("intf", targetNS);
    def.addNamespace("impl", targetNS + "-impl");
    def.addNamespace("", targetNS);

    def.addNamespace("xsd", "http://www.w3.org/2001/XMLSchema");
    def.addNamespace("wsdl", "http://schemas.xmlsoap.org/wsdl/");
    def.addNamespace("wsdlsoap", "http://schemas.xmlsoap.org/wsdl/soap/");
    def.addNamespace("SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/");
    def.addNamespace("apachesoap", "http://xml.apache.org/xml-soap");

    System.out.println("INFO: " + def.getQName().toString());
    System.out.println("tns : " + def.getNamespace("tns" + serviceName));

    // WA: xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    // WA: xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"

    //
    // IMPORTS AND TYPES
    //
    /*
     * Import importsec = def.createImport(); importsec.setDefinition(def);
     * importsec.setLocationURI("locationURI");
     * importsec.setNamespaceURI("nsURI"); def.addImport(importsec);
     */

    // LESEN DES SCHEMAS AUS DATEISYSTEM
    // ===========================================
    // DOMParser domp = new DOMParser();
    // try {
    // //domp.parse("file:/D:/development/xsd/generated.xsd");
    // domp.parse("file:/D:/tmp/StEmilion.xsd");
    // }
    // catch(Exception e) { e.printStackTrace(); }
    //
    // Document doc = domp.getDocument();
    // Element element = doc.getDocumentElement();
    // =============================================================================

    Element element = null;

    try {
      // construct schema model for all parameter
      Iterator<Entry<String, Vector<AbstractServiceParameter>>> itAp =
          mapInputs.entrySet().iterator();
      while (itAp.hasNext()) {
        for (Iterator<AbstractServiceParameter> it = itAp.next().getValue().iterator();
            it.hasNext(); ) {
          AbstractServiceParameter param = it.next();
          System.out.println("[BUILD] IN         :" + param.getUri());
          if (!this.isPrimitiveType(param.getUri())) {
            xsdgen.appendToSchema(
                AbstractDatatypeKB.getInstance().getAbstractDatatypeKBData().get(param.getUri()));
            System.out.println("[BUILD] added to type section.");
          }
        }
      }

      itAp = mapOutputs.entrySet().iterator();
      while (itAp.hasNext()) {
        for (Iterator<AbstractServiceParameter> it = itAp.next().getValue().iterator();
            it.hasNext(); ) {
          AbstractServiceParameter param = it.next();
          System.out.println("[BUILD] OUT        :" + param.getUri());
          if (!this.isPrimitiveType(param.getUri())) {
            xsdgen.appendToSchema(
                AbstractDatatypeKB.getInstance().getAbstractDatatypeKBData().get(param.getUri()));
            System.out.println("[BUILD] added to type section.");
          }
        }
      }

      xsdgen.deleteObsoleteTypesFromSchema();

      // org.jdom.Document jdoc =
      // XMLUtils.convertSchemaToElement(AbstractDatatypeKB.getInstance().getXmlSchemaElement("http://www.w3.org/TR/2003/PR-owl-guide-20031209/wine#StEmilion",
      // false, -1)).getDocument();
      org.jdom.Document jdoc = XMLUtils.convertSchemaToElement(xsdgen.getSchema()).getDocument();

      DOMOutputter w3cOutputter = new DOMOutputter();
      Document doc = w3cOutputter.output(jdoc);
      element = doc.getDocumentElement();

      NamedNodeMap attList = element.getAttributes();
      for (int i = 0; i < attList.getLength(); i++) {
        Node n = element.getAttributes().item(i);
        if (n.getTextContent().equals("http://www.w3.org/2001/XMLSchema")) {
          element.removeAttributeNode((Attr) n);
        }
      }

      element.setAttribute("targetNamespace", targetNS);
      element.setAttribute("xmlns", targetNS);
    } catch (org.jdom.JDOMException jdome) {
      jdome.printStackTrace();
    } catch (org.xml.sax.SAXException saxe) {
      saxe.printStackTrace();
    } catch (java.io.IOException ioe) {
      ioe.printStackTrace();
    } catch (java.lang.Exception e) {
      e.printStackTrace();
    }

    UnknownExtensibilityElement extensibilityElement = new UnknownExtensibilityElement();
    extensibilityElement.setElement(element);
    extensibilityElement.setElementType(new QName(element.getNamespaceURI()));
    extensibilityElement.setRequired(Boolean.TRUE);
    // System.out.println("EXENSIBILITYELEMENT: "+extensibilityElement);

    Types types = def.getTypes();
    types = def.createTypes();
    types.addExtensibilityElement(extensibilityElement);
    def.setTypes(types);

    // Schema schema = new SchemaImpl();
    // DOMParser domp = new DOMParser();
    // try {
    // domp.parse("file:/D:/development/xsd/generated.xsd");
    // Document doc = domp.getDocument();
    // NodeList nodes = doc.getElementsByTagName("xsd:schema");
    // for(int i=0; i<nodes.getLength();i++) {
    // schema.setElement(doc.getDocumentElement());
    // schema.setElementType(new QName(nodes.item(i).getNamespaceURI()));
    // schema.setDocumentBaseURI(nodes.item(i).getNamespaceURI());
    // types.addExtensibilityElement(schema);
    // def.setTypes(types);
    // }
    // System.out.println("DOC1:"+doc.toString());
    // System.out.println("NODES:"+nodes.getLength());
    // }
    // catch(Exception e) {
    // e.printStackTrace();
    // }
    // //UnknownExtensibilityElement extensibilityElement = new
    // UnknownExtensibilityElement();

    // // org.jdom.Element jdelem = XMLUtils.convertSchemaToElement(schema);
    // // System.out.println("JDOM ELEMENT: "+jdelem.toString());

    // http://mail-archives.apache.org/mod_mbox/ws-axis-dev/200406.mbox/%[email protected]%3e
    //
    // Schema schema = (Schema)
    // extensionRegistry.createExtension(javax.wsdl.Types, new
    // QName("http://www.w3.org/2001/XMLSchema", "schema"));
    // DocumentBuilderFactory factory =
    // DocumentBuilderFactory.newInstance();
    // DocumentBuilder builder = factory.newDocumentBuilder();
    // Document schemaDeclaration = builder.newDocument();
    // //... (populate schemaDeclaration with elements and types)
    // schema.setDeclaration(schemaDeclaration);
    // types.addExtensibilityElement(schema);

    // (get-) Operation name
    //		String operationName = "get";
    //		for (int i = 0; i < outputParameter.size(); i++) {
    //			AbstractServiceParameter param = (AbstractServiceParameter) outputParameter
    //					.get(i);
    //			operationName += param.getID();
    //		}

    //
    // MESSAGES, PARTS
    // =================================================================
    // description fehlt noch

    Service service = def.createService();
    // service.setDocumentationElement()
    service.setQName(new QName(targetNS, serviceName + "Service"));
    SOAPBinding soapBinding =
        (SOAPBinding)
            extensionRegistry.createExtension(
                Binding.class, new QName("http://schemas.xmlsoap.org/wsdl/soap/", "binding"));
    soapBinding.setTransportURI("http://schemas.xmlsoap.org/soap/http");
    soapBinding.setStyle("rpc");

    SOAPBody body =
        (SOAPBody)
            extensionRegistry.createExtension(
                BindingInput.class, new QName("http://schemas.xmlsoap.org/wsdl/soap/", "body"));
    body.setUse("literal");
    ArrayList<String> listOfStyles = new ArrayList<String>();
    listOfStyles.add("http://schemas.xmlsoap.org/soap/encoding/");
    body.setEncodingStyles(listOfStyles);
    body.setNamespaceURI(targetNS);

    Binding binding = def.createBinding();

    // == add PortType and Binding to WSDL defintion

    PortType portType = def.createPortType();
    portType.setQName(new QName(targetNS, serviceName + "PortType"));

    // == Binding section

    binding.setQName(new QName(targetNS, serviceName + "Binding"));
    binding.addExtensibilityElement(soapBinding);

    BindingInput binding_input = def.createBindingInput();
    // binding_input.setName("BINDING IN");
    binding_input.addExtensibilityElement(body);
    BindingOutput binding_out = def.createBindingOutput();
    // binding_out.setName("BINDING OUT");
    binding_out.addExtensibilityElement(body);
    Iterator<Entry<String, Vector<AbstractServiceParameter>>> itOps =
        mapInputs.entrySet().iterator();
    while (itOps.hasNext()) {
      Entry<String, Vector<AbstractServiceParameter>> op = itOps.next();
      String operationName = op.getKey();
      AtomicProcess ap = mapProcesses.get(operationName);
      Vector<AbstractServiceParameter> inputParameter = mapInputs.get(operationName);
      Vector<AbstractServiceParameter> outputParameter = mapOutputs.get(operationName);

      Message request = def.createMessage();
      request.setQName(new QName(targetNS, operationName + "Request"));

      boolean duplicateInputs = false;
      boolean duplicateOutputs = false;
      if (ap.hasDuplicateInputParameter()) {
        duplicateInputs = true;
      }
      if (ap.hasDuplicateOutputParameter()) {
        duplicateOutputs = true;
      }

      for (int ipi = 0; ipi < inputParameter.size(); ipi++) {
        AbstractServiceParameter param = (AbstractServiceParameter) inputParameter.get(ipi);
        Part part = def.createPart();
        if (duplicateInputs) {
          part.setName(param.getID() + String.valueOf(param.getPos()));
        } else {
          part.setName(param.getID());
        }
        System.out.println("SET TYPE OF PART: " + param.toString());
        if (param.isPrimitiveXsdType()) {
          part.setTypeName(new QName("http://www.w3.org/2001/XMLSchema", param.getTypeLocal()));
        } else {
          part.setTypeName(new QName(targetNS, param.getTypeRemote()));
        }
        request.addPart(part);
      }
      request.setUndefined(false);
      def.addMessage(request);

      Message response = def.createMessage();
      response.setQName(new QName(targetNS, operationName + "Response"));
      for (int opi = 0; opi < outputParameter.size(); opi++) {
        AbstractServiceParameter param = (AbstractServiceParameter) outputParameter.get(opi);
        Part part = def.createPart();
        if (duplicateOutputs) {
          part.setName(param.getID() + String.valueOf(param.getPos()));
        } else {
          part.setName(param.getID());
        }
        System.out.println("SET TYPE OF PART: " + param.toString());
        if (param.isPrimitiveXsdType()) {
          part.setTypeName(new QName("http://www.w3.org/2001/XMLSchema", param.getTypeLocal()));
        } else {
          part.setTypeName(new QName(targetNS, param.getTypeRemote()));
        }
        response.addPart(part);
      }
      response.setUndefined(false);
      def.addMessage(response);

      //
      // PORTTYPE, OPERATION
      //
      Input input = def.createInput();
      input.setMessage(request);
      Output output = def.createOutput();
      output.setMessage(response);

      // == build the wsdl operation + bindings for each owls output parameter

      Operation operation = def.createOperation();
      //			operation.setName(operationName);
      operation.setName(ap.getOperationName());
      operation.setInput(input);
      operation.setOutput(output);
      operation.setUndefined(false);

      portType.addOperation(operation);
      portType.setUndefined(false);

      SOAPOperation soapOperation =
          (SOAPOperation)
              extensionRegistry.createExtension(
                  BindingOperation.class,
                  new QName("http://schemas.xmlsoap.org/wsdl/soap/", "operation"));
      soapOperation.setSoapActionURI("");
      // soapOperation.setStyle("document");

      BindingOperation binding_op = def.createBindingOperation();
      //			binding_op.setName(operationName);
      binding_op.setName(ap.getOperationName());
      binding_op.addExtensibilityElement(soapOperation);
      binding_op.setOperation(operation);
      binding_op.setBindingInput(binding_input);
      binding_op.setBindingOutput(binding_out);
      binding.addBindingOperation(binding_op);

      binding.setPortType(portType);

      binding.setUndefined(false);
      def.addBinding(binding);
    }

    def.addPortType(portType);

    //
    // SERVICE
    //
    SOAPAddress soapAddress =
        (SOAPAddress)
            extensionRegistry.createExtension(
                Port.class, new QName("http://schemas.xmlsoap.org/wsdl/soap/", "address"));
    soapAddress.setLocationURI(targetNS);
    Port port = def.createPort();
    port.setName(serviceName + "Port");
    port.setBinding(binding);
    port.addExtensibilityElement(soapAddress);

    service.addPort(port);
    def.addService(service);

    return def;
  }
Exemple #23
0
  private joliex.wsdl.impl.Operation convertOperation(Operation operation, Style style)
      throws IOException {
    String comment = "";
    if (operation.getDocumentationElement() != null) {
      operation.getDocumentationElement().getNodeValue();
    }
    String responseTypeName = null;

    String requestTypeName =
        convertOperationMessage(operation.getInput().getMessage(), operation.getName(), style);
    if (operation.getOutput() != null) {
      responseTypeName =
          convertOperationMessage(operation.getOutput().getMessage(), operation.getName(), style);
    }

    Map<String, Part> parts;
    List<Pair<String, String>> faultList = new ArrayList<Pair<String, String>>();
    Map<String, Fault> faults = operation.getFaults();
    for (Entry<String, Fault> entry : faults.entrySet()) {
      String faultName = entry.getKey();
      String faultTypeName = null;
      parts = entry.getValue().getMessage().getParts();
      if (parts.size() > 1) {
        String typeName = faultName = faultTypeName;
        TypeInlineDefinition faultType =
            new TypeInlineDefinition(
                URIParsingContext.DEFAULT,
                typeName,
                NativeType.VOID,
                jolie.lang.Constants.RANGE_ONE_TO_ONE);
        for (Entry<String, Part> partEntry : parts.entrySet()) {
          Part part = partEntry.getValue();
          if (part.getElementName() == null) {
            if (part.getTypeName() == null) {
              throw new IOException(
                  "Could not parse message part "
                      + entry.getKey()
                      + " for operation "
                      + operation.getName()
                      + ".");
            }
            TypeDefinitionLink link =
                new TypeDefinitionLink(
                    URIParsingContext.DEFAULT,
                    part.getName(),
                    jolie.lang.Constants.RANGE_ONE_TO_ONE,
                    XsdUtils.xsdToNativeType(part.getTypeName().getLocalPart()).id());
            faultType.putSubType(link);
          } else {
            TypeDefinitionLink link =
                new TypeDefinitionLink(
                    URIParsingContext.DEFAULT,
                    part.getName(),
                    jolie.lang.Constants.RANGE_ONE_TO_ONE,
                    part.getElementName().getLocalPart());
            faultType.putSubType(link);
          }
        }
        typeDefinitions.add(faultType);
      } else {
        for (Entry<String, Part> e : parts.entrySet()) {
          Part part = e.getValue();
          if (part.getElementName() == null) {
            if (part.getTypeName() == null) {
              throw new IOException(
                  "Could not parse message part "
                      + e.getKey()
                      + " for operation "
                      + operation.getName()
                      + ", fault "
                      + entry.getKey()
                      + ".");
            }
            faultTypeName = XsdUtils.xsdToNativeType(part.getTypeName().getLocalPart()).id();
          } else {
            faultTypeName = part.getElementName().getLocalPart();
            NativeType nativeType = XsdUtils.xsdToNativeType(faultTypeName);
            if (nativeType != null) {
              faultTypeName = nativeType.id();
            }
          }
        }
      }
      faultList.add(new Pair<String, String>(faultName, faultTypeName));
    }

    return new joliex.wsdl.impl.Operation(
        operation.getName(), requestTypeName, responseTypeName, faultList, comment);
  }
 /*      */ public static QName getOperationQName(
     BindingOperation bindingOper, BindingEntry bEntry, SymbolTable symbolTable)
       /*      */ {
   /*  813 */ Operation operation = bindingOper.getOperation();
   /*  814 */ String operationName = operation.getName();
   /*      */
   /*  821 */ if ((bEntry.getBindingStyle() == Style.DOCUMENT) && (symbolTable.isWrapped()))
   /*      */ {
     /*  823 */ Input input = operation.getInput();
     /*      */
     /*  825 */ if (input != null) {
       /*  826 */ Map parts = input.getMessage().getParts();
       /*      */
       /*  828 */ if ((parts != null) && (!parts.isEmpty())) {
         /*  829 */ Iterator i = parts.values().iterator();
         /*  830 */ Part p = (Part) i.next();
         /*      */
         /*  832 */ return p.getElementName();
         /*      */ }
       /*      */ }
     /*      */ }
   /*      */
   /*  837 */ String ns = null;
   /*      */
   /*  842 */ BindingInput bindInput = bindingOper.getBindingInput();
   /*      */
   /*  844 */ if (bindInput != null) {
     /*  845 */ Iterator it = bindInput.getExtensibilityElements().iterator();
     /*      */
     /*  847 */ while (it.hasNext()) {
       /*  848 */ ExtensibilityElement elem = (ExtensibilityElement) it.next();
       /*      */
       /*  850 */ if ((elem instanceof SOAPBody)) {
         /*  851 */ SOAPBody body = (SOAPBody) elem;
         /*      */
         /*  853 */ ns = body.getNamespaceURI();
         /*  854 */ if ((bEntry.getInputBodyType(operation) != Use.ENCODED)
             || ((ns != null) && (ns.length() != 0))) break;
         /*  855 */ log.warn(
             Messages.getMessage(
                 "badNamespaceForOperation00", bEntry.getName(), operation.getName()));
         break;
         /*      */ }
       /*      */
       /*  861 */ if ((elem instanceof MIMEMultipartRelated)) {
         /*  862 */ Object part = null;
         /*  863 */ MIMEMultipartRelated mpr = (MIMEMultipartRelated) elem;
         /*      */
         /*  865 */ List l = mpr.getMIMEParts();
         /*      */
         /*  868 */ int j = 0;
         /*  869 */ while ((l != null) && (j < l.size()) && (part == null))
         /*      */ {
           /*  871 */ MIMEPart mp = (MIMEPart) l.get(j);
           /*      */
           /*  873 */ List ll = mp.getExtensibilityElements();
           /*      */
           /*  876 */ int k = 0;
           /*  877 */ for (; (ll != null) && (k < ll.size()) && (part == null); k++) {
             /*  878 */ part = ll.get(k);
             /*      */
             /*  880 */ if ((part instanceof SOAPBody)) {
               /*  881 */ SOAPBody body = (SOAPBody) part;
               /*      */
               /*  883 */ ns = body.getNamespaceURI();
               /*  884 */ if ((bEntry.getInputBodyType(operation) != Use.ENCODED)
                   || ((ns != null) && (ns.length() != 0))) break;
               /*  885 */ log.warn(
                   Messages.getMessage(
                       "badNamespaceForOperation00", bEntry.getName(), operation.getName()));
               break;
               /*      */ }
             /*      */
             /*  892 */ part = null;
             /*      */ }
           /*  870 */ j++;
           /*      */ }
         /*      */
         /*      */ }
       /*  896 */ else if ((elem instanceof UnknownExtensibilityElement))
       /*      */ {
         /*  899 */ UnknownExtensibilityElement unkElement = (UnknownExtensibilityElement) elem;
         /*      */
         /*  901 */ QName name = unkElement.getElementType();
         /*      */
         /*  904 */ if ((name.getNamespaceURI().equals("http://schemas.xmlsoap.org/wsdl/soap12/"))
             && (name.getLocalPart().equals("body")))
         /*      */ {
           /*  906 */ ns = unkElement.getElement().getAttribute("namespace");
           /*      */ }
         /*      */
         /*      */ }
       /*      */
       /*      */ }
     /*      */
     /*      */ }
   /*      */
   /*  916 */ if (ns == null) {
     /*  917 */ ns = "";
     /*      */ }
   /*      */
   /*  920 */ return new QName(ns, operationName);
   /*      */ }