WSDL Parsing

214 views
Skip to first unread message

Budi Harjo

unread,
Mar 23, 2015, 9:04:58 AM3/23/15
to soa-...@googlegroups.com
How to get element name, element type and add annotation in WSDL Parsing?

Please help me, friends


Budi Harjo

Thomas Bayer

unread,
Mar 23, 2015, 10:02:48 AM3/23/15
to soa-...@googlegroups.com
See my other mail or:

http://www.membrane-soa.org/soa-model-doc/1.4/java-api/

Just look first at:

http://www.membrane-soa.org/soa-model-doc/1.4/java-api/parse-wsdl-java-api.htm

then at:

http://www.membrane-soa.org/soa-model-doc/1.4/java-api/parse-schema-java-api.htm

then just apply both to your WSDL. That's it.

Cheers,
Thomas

Am 23.03.15 um 14:04 schrieb Budi Harjo:
How to get element name, element type and add annotation in WSDL Parsing?

Please help me, friends


Budi Harjo
--
You received this message because you are subscribed to the Google Groups "Membrane SOA Model" group.
To unsubscribe from this group and stop receiving emails from it, send an email to soa-model+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/soa-model/2f90cec8-98d1-4fc3-a3a9-dbef9535f3c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Purnesh Tiwari

unread,
Jun 2, 2016, 3:54:13 AM6/2/16
to Membrane SOA Model


First get xml content as a string then parse the same content to get element and type.

System.out.println("Messages: ");
        for (Message msg : defs.getMessages()) {
            System.out.println("  Message Name: " + msg.getName());
            System.out.println("  Message Parts: ");
            for (Part part : msg.getParts()) {

               
                String xmlContent = part.getElement().getEmbeddedType().getAsString();
                System.out.println("xsd String : "+td);


String xmlContent ="<xsd:complexType xmlns:xsd='http://www.w3.org/2001/XMLSchema'> <xsd:sequence minOccurs='1' maxOccurs='1'> <xsd:element name='username' type='xsd:string' minOccurs='0' /> <xsd:element name='password' type='xsd:string' minOccurs='0' /> </xsd:sequence> </xsd:complexType>";

       
        DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
        InputSource src = new InputSource();
        src.setCharacterStream(new StringReader(embeddedCont));
        Document doc = builder.parse(src);
       
        NodeList list = doc.getElementsByTagName("xsd:element");
        ArrayList<Object> element  =  new ArrayList<Object>();
        //loop to print data
        for(int i = 0 ; i < list.getLength(); i++)
        {
            HashMap<String, String> attr = new HashMap<String, String>();
           
            Element first = (Element)list.item(i) ;
                if( first.hasAttributes())
                {
                    String name = first.getAttribute("name");
                    String type = first.getAttribute("type");
                    attr.put("name", name);
                    attr.put("type", type);
                    element.add(attr);
                   
                }
        }

Thanks
Purnesh
Reply all
Reply to author
Forward
0 new messages