private void build(Port port) {
    if (wsdlModeler.isProvider(port)) return;
    Binding binding = port.resolveBinding(wsdlDocument);

    SOAPBinding soapBinding = (SOAPBinding) getExtensionOfType(binding, SOAPBinding.class);
    // lets try and see if its SOAP 1.2. dont worry about extension flag, its
    // handled much earlier
    if (soapBinding == null) {
      soapBinding = (SOAPBinding) getExtensionOfType(binding, SOAP12Binding.class);
    }
    if (soapBinding == null) return;
    PortType portType = binding.resolvePortType(wsdlDocument);

    QName bindingName = WSDLModelerBase.getQNameOf(binding);

    // we dont want to process the port bound to the binding processed earlier
    if (bindingNameToPortMap.containsKey(bindingName)) return;

    bindingNameToPortMap.put(bindingName, port);

    for (Iterator itr = binding.operations(); itr.hasNext(); ) {
      BindingOperation bindingOperation = (BindingOperation) itr.next();

      // get only the bounded operations
      Set boundedOps = portType.getOperationsNamed(bindingOperation.getName());
      if (boundedOps.size() != 1) continue;
      Operation operation = (Operation) boundedOps.iterator().next();

      // No pseudo schema required for doc/lit
      if (wsdlModeler.isAsync(portType, operation)) {
        buildAsync(portType, operation, bindingOperation);
      }
    }
  }
  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);
    }
  }
 /**
  * @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);
   }
 }