Пример #1
0
 /**
  * @param portType
  * @param operation
  * @param bindingOperation
  */
 private void buildAsync(
     PortType portType, Operation operation, BindingOperation bindingOperation) {
   String operationName = getCustomizedOperationName(operation); // operation.getName();
   if (operationName == null) return;
   Message outputMessage = null;
   if (operation.getOutput() != null)
     outputMessage = operation.getOutput().resolveMessage(wsdlDocument);
   if (outputMessage != null) {
     List<MessagePart> allParts = new ArrayList<MessagePart>(outputMessage.getParts());
     if (options != null && options.additionalHeaders) {
       List<MessagePart> addtionalHeaderParts =
           wsdlModeler.getAdditionHeaderParts(bindingOperation, outputMessage, false);
       allParts.addAll(addtionalHeaderParts);
     }
     if (allParts.size() > 1) build(getOperationName(operationName), allParts);
   }
 }
Пример #2
0
  private void build(QName elementName, List<MessagePart> allParts) {

    print(
        "<xs:schema xmlns:xs=''http://www.w3.org/2001/XMLSchema''"
            + "           xmlns:jaxb=''http://java.sun.com/xml/ns/jaxb''"
            + "           xmlns:xjc=''http://java.sun.com/xml/ns/jaxb/xjc''"
            + "           jaxb:extensionBindingPrefixes=''xjc''"
            + "           jaxb:version=''1.0''"
            + "           targetNamespace=''{0}''>",
        elementName.getNamespaceURI());

    writeImports(elementName, allParts);

    if (!asyncRespBeanBinding) {
      print(
          "<xs:annotation><xs:appinfo>"
              + "  <jaxb:schemaBindings>"
              + "    <jaxb:package name=''{0}'' />"
              + "  </jaxb:schemaBindings>"
              + "</xs:appinfo></xs:annotation>",
          wsdlModeler.getJavaPackage());
      asyncRespBeanBinding = true;
    }

    print("<xs:element name=''{0}''>", elementName.getLocalPart());
    print("<xs:complexType>");
    print("<xs:sequence>");

    for (MessagePart p : allParts) {
      // rpclit wsdl:part must reference schema type not element, also it must exclude headers and
      // mime parts
      if (p.getDescriptorKind() == SchemaKinds.XSD_ELEMENT) {
        print(
            "<xs:element ref=''types:{0}'' xmlns:types=''{1}''/>",
            p.getDescriptor().getLocalPart(), p.getDescriptor().getNamespaceURI());
      } else {
        print(
            "<xs:element name=''{0}'' type=''{1}'' xmlns=''{2}'' />",
            p.getName(), p.getDescriptor().getLocalPart(), p.getDescriptor().getNamespaceURI());
      }
    }

    print("</xs:sequence>");
    print("</xs:complexType>");
    print("</xs:element>");
    print("</xs:schema>");

    // reset the StringWriter, so that next operation element could be written
    if (buf.toString().length() > 0) {
      // System.out.println("Response bean Schema for operation========> "+ elementName+"\n\n"+buf);
      InputSource is = new InputSource(new StringReader(buf.toString()));
      schemas.add(is);
      buf.getBuffer().setLength(0);
    }
  }