Reputation: 653
I need parser for WSDL to get the messages, portTypes, operations, bindings, services,... I hope some parser already exists. So, any guidlines?
Upvotes: 7
Views: 18842
Reputation: 6849
you can use membrane-soa for parsing wsdl files. add dependency from http://mvnrepository.com/artifact/com.predic8/soa-model-core .
you can find documantation at http://membrane-soa.org/soa-model/ .
Upvotes: 0
Reputation: 3020
use http://sourceforge.net/projects/wsdl4j/
public Definition readWSDLFile(String location) throws WSDLException {
WSDLReader reader = getWsdlFactoryInstance().newWSDLReader();
reader.setFeature("javax.wsdl.importDocuments", true);
return reader.readWSDL(location);
}
Upvotes: -1
Reputation: 1313
Hope this link will be useful for you to choose a WSDL parser, Parse WSDL Effectively
(look at the archive of this Link: Web Archive
).
I have tried using Apache Woden
, WSDL4J
and Membrane SOA
. Apache Woden or Membrane SOA would do fine.
Upvotes: 3
Reputation: 131
Have a look at wsimport
tool documentation at http://docs.oracle.com/javase/6/docs/technotes/tools/share/wsimport.html. It is a standard JDK tool that generates JAXB-based Java artifacts for interactions with web service.
Upvotes: 0
Reputation: 736
f wsdl = '''
<definitions name="AgencyManagementService"
xmlns:ns1="http://www.example.org/NS1"
xmlns:ns2="http://www.example.org/NS2">
<ns1:message name="SomeRequest">
<ns1:part name="parameters" element="SomeReq" />
</ns1:message>
<ns2:message name="SomeRequest">
<ns2:part name="parameters" element="SomeReq" />
</ns2:message>
</definitions>
'''
def xml = new XmlSlurper().parseText(wsdl).declareNamespace(ns1: 'http://www.example.org/NS1', ns2: 'http://www.example.org/NS2')
println xml.'ns1:message'.'ns1:part'.size()
println xml.'ns2:message'.'ns2:part'.size()
Hope this helps. Groovy class can be called from any other Java class. Move all XML labor to Groovy :)
Upvotes: 0
Reputation: 75376
Several Web Service stacks are available.
Have a look at the Metro stack. Open Source and available directly in Java 6.
Upvotes: 0