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); } }
/** * parse a MIME message, calling the builder methods that correspond to the message's header * fields and body parts. */ OutboundMessageIF parse(MIMEMessage msg) { this.msg = msg; builder = MessageBuilder.getInstance(getDestination()); MessagePart hdr = nextHeader(); while (hdr != null) { if (hdr.getName().equalsIgnoreCase("to")) builder.to((String) hdr.getValue()); else if (hdr.getName().equalsIgnoreCase("from")) builder.from((String) hdr.getValue()); // ... hdr = nextHeader(); } // while hdr MessagePart bdy = nextBodyPart(); while (bdy != null) { if (bdy.getName().equals("text/plain")) builder.plainText((String) bdy.getValue()); // ... else if (bdy.getName().equals("image/jpeg")) builder.jpegImage((Image) bdy.getValue()); // ... bdy = nextHeader(); } // while bdy return builder.getOutboundMsg(); } // parse(MIMEMessage)