You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Demetris G <de...@ece.neu.edu> on 2008/02/17 08:09:33 UTC

WSDL parser

Hi all,

    I am trying to use the wsdlParser from the Axis API to parse the methods
out of an incoming WSDL file - does anyone who has used this before have
any info on how to use this tool? OR any other way I could get the 
operations
of the remote service out of the WSDL file? I would appreciate it.

Thanks


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: WSDL parser

Posted by Demetris G <de...@ece.neu.edu>.
Hi Sukma -

once again thanks for the quick response - much appreciated -
I tried #1 but not #3. I am migrating to SOAP 1.2 so I will also
look into the second option you list. I will let the list know how that
one goes as well.

Regards

Sukma Agung Verdianto wrote:
> Hi Demitris,
>
> Sorry for this late response,
> I'm not sure if there is a 'ready to use' parser to extract 
> information out of SOAP message. But I guess Axis2 have it.
>
> Extracting information from soap message is quite complex.
> There are several ways to get those information (eg: operations, to, 
> replyto):
> 1. If you use older SOAP version (1.1) and HTTP transport - operation 
> name is defined as HTTP attribute (Could not remember the name, 
> "Action" or "Operation")
> 2. In SOAP (1.2) and HTTP transport there is also an extra HTTP 
> attribute (not sure where, you can check by capturing using tcpmon)
> 3. This is more difficult, if your soap use WS_Addressing standard, 
> you may read the SOAP header and look for wsa:Action element value.
>
> Example of SOAP with WS-Addressing header. (see <wsa:Action element)
>        <wsa:To xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" soapenv:mustUnderstand="1" wsu:Id="Id-13283276">http://localhost:8888/axis2/services/CalculatorService?wsdl</wsa:To>
>          <wsa:ReplyTo xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" soapenv:mustUnderstand="1" wsu:Id="Id-14395294">
>             <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
>          </wsa:ReplyTo>
>          <wsa:MessageID xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" soapenv:mustUnderstand="1" wsu:Id="Id-14264518">urn:uuid:0E4DF98317F35D31DE1179281210189</wsa:MessageID>
>          <wsa:Action xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" soapenv:mustUnderstand="1" wsu:Id="Id-14123379">urn:Divide</wsa:Action>
>       </soapenv:Header>
>
> I hope this will help. :)
>
> Regards,
> Sukma
>
> On Feb 19, 2008 11:46 AM, Demetris G <demetris@ece.neu.edu 
> <ma...@ece.neu.edu>> wrote:
>
>
>     Hey Sukma,
>
>        the code below worked fine - I can get the operations out of the
>     WSDL. Is there
>     a similar parser for identifying and extracting the methods out of
>     outgoing (from the
>     stubs) SOAP messages? I capture the SOAP message and I can parse
>     it manually
>     but is there a standard way (like the code below) for identifying the
>     methods the
>     SOAP message is destined to?
>
>     Thanks much once again
>
>     Sukma Agung Verdianto wrote:
>     > Hi Demetris,
>     >
>     > You can try to use wsdl4j
>     (http://sourceforge.net/projects/wsdl4j) to
>     > get the operations of specified wsdl file. (AFAIK, Axis2 uses
>     this in
>     > their wsdl2java code)
>     >
>     > public static void main(String[] args) throws Exception {
>     >
>     > WSDLFactory fac = WSDLFactoryImpl.newInstance();
>     >
>     > WSDLReader reader = fac.newWSDLReader();
>     >
>     > Definition def =
>     > reader.readWSDL("http://api.google.com/GoogleSearch.wsdl");
>     >
>     > Map services = def.getServices();
>     >
>     > for(Object serviceKey : services.keySet()) {
>     >
>     > QName serviceQName = (QName) serviceKey;
>     >
>     > Service service = (Service) services.get(serviceQName);
>     >
>     > System.out.println("Namespace: " +
>     > service.getQName().getNamespaceURI() + ", Service Name: " +
>     > service.getQName().getLocalPart());
>     >
>     > Map ports = service.getPorts();
>     >
>     > for(Object portKey : ports.keySet()) {
>     >
>     > String portName = (String) portKey;
>     >
>     > Port port = (Port) ports.get(portName);
>     >
>     > System.out.println("  Namespace: " +
>     > port.getBinding().getQName().getNamespaceURI() + ", Binding
>     Name: " +
>     > port.getBinding().getQName().getLocalPart());
>     >
>     > List operations = port.getBinding().getBindingOperations();
>     >
>     > for(Object operation : operations) {
>     >
>     > BindingOperation op = (BindingOperation) operation;
>     >
>     > System.out.print("    Operation Name: " + op.getName());
>     >
>     > List ll = op.getExtensibilityElements();
>     >
>     > for(Object soap : ll) {
>     >
>     > if(SOAPOperation.class.isInstance(soap)) {
>     >
>     > System.out.print(" (" + ((SOAPOperation)soap).getSoapActionURI()
>     + ")");
>     >
>     > }
>     >
>     > }
>     >
>     > System.out.println();
>     >
>     > }
>     >
>     > }
>     >
>     > }
>     >
>     > }
>     >
>     >
>     > Above code read remote wsdl, and extract its information.
>     >
>     > Regards,
>     > Sukma
>     >
>     > On Feb 17, 2008 2:09 PM, Demetris G <demetris@ece.neu.edu
>     <ma...@ece.neu.edu>
>     > <mailto:demetris@ece.neu.edu <ma...@ece.neu.edu>>> wrote:
>     >
>     >
>     >     Hi all,
>     >
>     >        I am trying to use the wsdlParser from the Axis API to parse
>     >     the methods
>     >     out of an incoming WSDL file - does anyone who has used this
>     >     before have
>     >     any info on how to use this tool? OR any other way I could
>     get the
>     >     operations
>     >     of the remote service out of the WSDL file? I would
>     appreciate it.
>     >
>     >     Thanks
>     >
>     >
>     >    
>     ---------------------------------------------------------------------
>     >     To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:axis-user-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     For additional commands, e-mail:
>     axis-user-help@ws.apache.org <ma...@ws.apache.org>
>     >     <mailto:axis-user-help@ws.apache.org
>     <ma...@ws.apache.org>>
>     >
>     >
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     For additional commands, e-mail: axis-user-help@ws.apache.org
>     <ma...@ws.apache.org>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: WSDL parser

Posted by Sukma Agung Verdianto <sa...@gmail.com>.
Hi Demitris,
Sorry for this late response,
I'm not sure if there is a 'ready to use' parser to extract information out
of SOAP message. But I guess Axis2 have it.

Extracting information from soap message is quite complex.
There are several ways to get those information (eg: operations, to,
replyto):
1. If you use older SOAP version (1.1) and HTTP transport - operation name
is defined as HTTP attribute (Could not remember the name, "Action" or
"Operation")
2. In SOAP (1.2) and HTTP transport there is also an extra HTTP attribute
(not sure where, you can check by capturing using tcpmon)
3. This is more difficult, if your soap use WS_Addressing standard, you may
read the SOAP header and look for wsa:Action element value.

Example of SOAP with WS-Addressing header. (see <wsa:Action element)

       <wsa:To xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
soapenv:mustUnderstand="1"
wsu:Id="Id-13283276">http://localhost:8888/axis2/services/CalculatorService?wsdl</wsa:To>
         <wsa:ReplyTo
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
soapenv:mustUnderstand="1" wsu:Id="Id-14395294">
            <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
         </wsa:ReplyTo>
         <wsa:MessageID
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
soapenv:mustUnderstand="1"
wsu:Id="Id-14264518">urn:uuid:0E4DF98317F35D31DE1179281210189</wsa:MessageID>
        <wsa:Action
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
soapenv:mustUnderstand="1"
wsu:Id="Id-14123379">urn:Divide</wsa:Action>      </soapenv:Header>


I hope this will help. :)

Regards,
Sukma

On Feb 19, 2008 11:46 AM, Demetris G <de...@ece.neu.edu> wrote:

>
> Hey Sukma,
>
>    the code below worked fine - I can get the operations out of the
> WSDL. Is there
> a similar parser for identifying and extracting the methods out of
> outgoing (from the
> stubs) SOAP messages? I capture the SOAP message and I can parse it
> manually
> but is there a standard way (like the code below) for identifying the
> methods the
> SOAP message is destined to?
>
> Thanks much once again
>
> Sukma Agung Verdianto wrote:
> > Hi Demetris,
> >
> > You can try to use wsdl4j (http://sourceforge.net/projects/wsdl4j) to
> > get the operations of specified wsdl file. (AFAIK, Axis2 uses this in
> > their wsdl2java code)
> >
> > public static void main(String[] args) throws Exception {
> >
> > WSDLFactory fac = WSDLFactoryImpl.newInstance();
> >
> > WSDLReader reader = fac.newWSDLReader();
> >
> > Definition def =
> > reader.readWSDL("http://api.google.com/GoogleSearch.wsdl");
> >
> > Map services = def.getServices();
> >
> > for(Object serviceKey : services.keySet()) {
> >
> > QName serviceQName = (QName) serviceKey;
> >
> > Service service = (Service) services.get(serviceQName);
> >
> > System.out.println("Namespace: " +
> > service.getQName().getNamespaceURI() + ", Service Name: " +
> > service.getQName().getLocalPart());
> >
> > Map ports = service.getPorts();
> >
> > for(Object portKey : ports.keySet()) {
> >
> > String portName = (String) portKey;
> >
> > Port port = (Port) ports.get(portName);
> >
> > System.out.println("  Namespace: " +
> > port.getBinding().getQName().getNamespaceURI() + ", Binding Name: " +
> > port.getBinding().getQName().getLocalPart());
> >
> > List operations = port.getBinding().getBindingOperations();
> >
> > for(Object operation : operations) {
> >
> > BindingOperation op = (BindingOperation) operation;
> >
> > System.out.print("    Operation Name: " + op.getName());
> >
> > List ll = op.getExtensibilityElements();
> >
> > for(Object soap : ll) {
> >
> > if(SOAPOperation.class.isInstance(soap)) {
> >
> > System.out.print(" (" + ((SOAPOperation)soap).getSoapActionURI() + ")");
> >
> > }
> >
> > }
> >
> > System.out.println();
> >
> > }
> >
> > }
> >
> > }
> >
> > }
> >
> >
> > Above code read remote wsdl, and extract its information.
> >
> > Regards,
> > Sukma
> >
> > On Feb 17, 2008 2:09 PM, Demetris G <demetris@ece.neu.edu
> > <ma...@ece.neu.edu>> wrote:
> >
> >
> >     Hi all,
> >
> >        I am trying to use the wsdlParser from the Axis API to parse
> >     the methods
> >     out of an incoming WSDL file - does anyone who has used this
> >     before have
> >     any info on how to use this tool? OR any other way I could get the
> >     operations
> >     of the remote service out of the WSDL file? I would appreciate it.
> >
> >     Thanks
> >
> >
> >
> ---------------------------------------------------------------------
> >     To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> >     <ma...@ws.apache.org>
> >     For additional commands, e-mail: axis-user-help@ws.apache.org
> >     <ma...@ws.apache.org>
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

Re: WSDL parser

Posted by Demetris G <de...@ece.neu.edu>.
Hey Sukma,

    the code below worked fine - I can get the operations out of the 
WSDL. Is there
a similar parser for identifying and extracting the methods out of 
outgoing (from the
stubs) SOAP messages? I capture the SOAP message and I can parse it manually
but is there a standard way (like the code below) for identifying the 
methods the
SOAP message is destined to?

Thanks much once again

Sukma Agung Verdianto wrote:
> Hi Demetris,
>
> You can try to use wsdl4j (http://sourceforge.net/projects/wsdl4j) to 
> get the operations of specified wsdl file. (AFAIK, Axis2 uses this in 
> their wsdl2java code)
>
> public static void main(String[] args) throws Exception {
>
> WSDLFactory fac = WSDLFactoryImpl.newInstance();
>
> WSDLReader reader = fac.newWSDLReader();
>
> Definition def = 
> reader.readWSDL("http://api.google.com/GoogleSearch.wsdl");
>
> Map services = def.getServices();
>
> for(Object serviceKey : services.keySet()) {
>
> QName serviceQName = (QName) serviceKey;
>
> Service service = (Service) services.get(serviceQName);
>
> System.out.println("Namespace: " + 
> service.getQName().getNamespaceURI() + ", Service Name: " + 
> service.getQName().getLocalPart());
>
> Map ports = service.getPorts();
>
> for(Object portKey : ports.keySet()) {
>
> String portName = (String) portKey;
>
> Port port = (Port) ports.get(portName);
>
> System.out.println("  Namespace: " + 
> port.getBinding().getQName().getNamespaceURI() + ", Binding Name: " + 
> port.getBinding().getQName().getLocalPart());
>
> List operations = port.getBinding().getBindingOperations();
>
> for(Object operation : operations) {
>
> BindingOperation op = (BindingOperation) operation;
>
> System.out.print("    Operation Name: " + op.getName());
>
> List ll = op.getExtensibilityElements();
>
> for(Object soap : ll) {
>
> if(SOAPOperation.class.isInstance(soap)) {
>
> System.out.print(" (" + ((SOAPOperation)soap).getSoapActionURI() + ")");
>
> }
>
> }
>
> System.out.println();
>
> }
>
> }
>
> }
>
> }
>
>
> Above code read remote wsdl, and extract its information.
>
> Regards,
> Sukma
>
> On Feb 17, 2008 2:09 PM, Demetris G <demetris@ece.neu.edu 
> <ma...@ece.neu.edu>> wrote:
>
>
>     Hi all,
>
>        I am trying to use the wsdlParser from the Axis API to parse
>     the methods
>     out of an incoming WSDL file - does anyone who has used this
>     before have
>     any info on how to use this tool? OR any other way I could get the
>     operations
>     of the remote service out of the WSDL file? I would appreciate it.
>
>     Thanks
>
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     For additional commands, e-mail: axis-user-help@ws.apache.org
>     <ma...@ws.apache.org>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: WSDL parser

Posted by Demetris G <de...@ece.neu.edu>.
Hey Sukma,

    thanks for the response - I oringally went with the second option 
but I was getting an exception
on the StringReader. I think I know what the problem is - at least you 
verified for me that I am on
the right path. I appreciate it.

Many regards once again

Sukma Agung Verdianto wrote:
> Hi Demetris,
>
> To read a local file you could simply use 
> "file:///path/to/wsdl/file.wsdl" as readWSDL argument 
> -> reader.readWSDL("file:///path/to/your/wsdl");,
> Or if you have a WSDL serialized in String, you could 
> use reader.readWSDL(null, new InputSource(new StringReader(wsdlString)));
>
> Regards,
> Sukma
>
> On Fri, Feb 22, 2008 at 1:22 PM, Demetris G <demetris@ece.neu.edu 
> <ma...@ece.neu.edu>> wrote:
>
>
>     Hi all,
>
>        does anyone know of a piece of code similar to the one below that
>     can read/parse  a local WSDL file
>     serialized in a string rather than a remote WSDL given by a URI?
>
>     Thanks
>
>     Sukma Agung Verdianto wrote:
>     > Hi Demetris,
>     >
>     > You can try to use wsdl4j
>     (http://sourceforge.net/projects/wsdl4j) to
>     > get the operations of specified wsdl file. (AFAIK, Axis2 uses
>     this in
>     > their wsdl2java code)
>     >
>     > public static void main(String[] args) throws Exception {
>     >
>     > WSDLFactory fac = WSDLFactoryImpl.newInstance();
>     >
>     > WSDLReader reader = fac.newWSDLReader();
>     >
>     > Definition def =
>     > reader.readWSDL("http://api.google.com/GoogleSearch.wsdl");
>     >
>     > Map services = def.getServices();
>     >
>     > for(Object serviceKey : services.keySet()) {
>     >
>     > QName serviceQName = (QName) serviceKey;
>     >
>     > Service service = (Service) services.get(serviceQName);
>     >
>     > System.out.println("Namespace: " +
>     > service.getQName().getNamespaceURI() + ", Service Name: " +
>     > service.getQName().getLocalPart());
>     >
>     > Map ports = service.getPorts();
>     >
>     > for(Object portKey : ports.keySet()) {
>     >
>     > String portName = (String) portKey;
>     >
>     > Port port = (Port) ports.get(portName);
>     >
>     > System.out.println("  Namespace: " +
>     > port.getBinding().getQName().getNamespaceURI() + ", Binding
>     Name: " +
>     > port.getBinding().getQName().getLocalPart());
>     >
>     > List operations = port.getBinding().getBindingOperations();
>     >
>     > for(Object operation : operations) {
>     >
>     > BindingOperation op = (BindingOperation) operation;
>     >
>     > System.out.print("    Operation Name: " + op.getName());
>     >
>     > List ll = op.getExtensibilityElements();
>     >
>     > for(Object soap : ll) {
>     >
>     > if(SOAPOperation.class.isInstance(soap)) {
>     >
>     > System.out.print(" (" + ((SOAPOperation)soap).getSoapActionURI()
>     + ")");
>     >
>     > }
>     >
>     > }
>     >
>     > System.out.println();
>     >
>     > }
>     >
>     > }
>     >
>     > }
>     >
>     > }
>     >
>     >
>     > Above code read remote wsdl, and extract its information.
>     >
>     > Regards,
>     > Sukma
>     >
>     > On Feb 17, 2008 2:09 PM, Demetris G <demetris@ece.neu.edu
>     <ma...@ece.neu.edu>
>     > <mailto:demetris@ece.neu.edu <ma...@ece.neu.edu>>> wrote:
>     >
>     >
>     >     Hi all,
>     >
>     >        I am trying to use the wsdlParser from the Axis API to parse
>     >     the methods
>     >     out of an incoming WSDL file - does anyone who has used this
>     >     before have
>     >     any info on how to use this tool? OR any other way I could
>     get the
>     >     operations
>     >     of the remote service out of the WSDL file? I would
>     appreciate it.
>     >
>     >     Thanks
>     >
>     >
>     >    
>     ---------------------------------------------------------------------
>     >     To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     >     <mailto:axis-user-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>
>     >     For additional commands, e-mail:
>     axis-user-help@ws.apache.org <ma...@ws.apache.org>
>     >     <mailto:axis-user-help@ws.apache.org
>     <ma...@ws.apache.org>>
>     >
>     >
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     For additional commands, e-mail: axis-user-help@ws.apache.org
>     <ma...@ws.apache.org>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: WSDL parser

Posted by Sukma Agung Verdianto <sa...@gmail.com>.
Hi Demetris,
To read a local file you could simply use "file:///path/to/wsdl/file.wsdl"
as readWSDL argument -> reader.readWSDL("file:///path/to/your/wsdl");,
Or if you have a WSDL serialized in String, you could use reader.readWSDL(
null, new InputSource(new StringReader(wsdlString)));

Regards,
Sukma

On Fri, Feb 22, 2008 at 1:22 PM, Demetris G <de...@ece.neu.edu> wrote:

>
> Hi all,
>
>    does anyone know of a piece of code similar to the one below that
> can read/parse  a local WSDL file
> serialized in a string rather than a remote WSDL given by a URI?
>
> Thanks
>
> Sukma Agung Verdianto wrote:
> > Hi Demetris,
> >
> > You can try to use wsdl4j (http://sourceforge.net/projects/wsdl4j) to
> > get the operations of specified wsdl file. (AFAIK, Axis2 uses this in
> > their wsdl2java code)
> >
> > public static void main(String[] args) throws Exception {
> >
> > WSDLFactory fac = WSDLFactoryImpl.newInstance();
> >
> > WSDLReader reader = fac.newWSDLReader();
> >
> > Definition def =
> > reader.readWSDL("http://api.google.com/GoogleSearch.wsdl");
> >
> > Map services = def.getServices();
> >
> > for(Object serviceKey : services.keySet()) {
> >
> > QName serviceQName = (QName) serviceKey;
> >
> > Service service = (Service) services.get(serviceQName);
> >
> > System.out.println("Namespace: " +
> > service.getQName().getNamespaceURI() + ", Service Name: " +
> > service.getQName().getLocalPart());
> >
> > Map ports = service.getPorts();
> >
> > for(Object portKey : ports.keySet()) {
> >
> > String portName = (String) portKey;
> >
> > Port port = (Port) ports.get(portName);
> >
> > System.out.println("  Namespace: " +
> > port.getBinding().getQName().getNamespaceURI() + ", Binding Name: " +
> > port.getBinding().getQName().getLocalPart());
> >
> > List operations = port.getBinding().getBindingOperations();
> >
> > for(Object operation : operations) {
> >
> > BindingOperation op = (BindingOperation) operation;
> >
> > System.out.print("    Operation Name: " + op.getName());
> >
> > List ll = op.getExtensibilityElements();
> >
> > for(Object soap : ll) {
> >
> > if(SOAPOperation.class.isInstance(soap)) {
> >
> > System.out.print(" (" + ((SOAPOperation)soap).getSoapActionURI() + ")");
> >
> > }
> >
> > }
> >
> > System.out.println();
> >
> > }
> >
> > }
> >
> > }
> >
> > }
> >
> >
> > Above code read remote wsdl, and extract its information.
> >
> > Regards,
> > Sukma
> >
> > On Feb 17, 2008 2:09 PM, Demetris G <demetris@ece.neu.edu
> > <ma...@ece.neu.edu>> wrote:
> >
> >
> >     Hi all,
> >
> >        I am trying to use the wsdlParser from the Axis API to parse
> >     the methods
> >     out of an incoming WSDL file - does anyone who has used this
> >     before have
> >     any info on how to use this tool? OR any other way I could get the
> >     operations
> >     of the remote service out of the WSDL file? I would appreciate it.
> >
> >     Thanks
> >
> >
> >
> ---------------------------------------------------------------------
> >     To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> >     <ma...@ws.apache.org>
> >     For additional commands, e-mail: axis-user-help@ws.apache.org
> >     <ma...@ws.apache.org>
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

Re: WSDL parser

Posted by Demetris G <de...@ece.neu.edu>.
Hi all,

    does anyone know of a piece of code similar to the one below that 
can read/parse  a local WSDL file
serialized in a string rather than a remote WSDL given by a URI?

Thanks

Sukma Agung Verdianto wrote:
> Hi Demetris,
>
> You can try to use wsdl4j (http://sourceforge.net/projects/wsdl4j) to 
> get the operations of specified wsdl file. (AFAIK, Axis2 uses this in 
> their wsdl2java code)
>
> public static void main(String[] args) throws Exception {
>
> WSDLFactory fac = WSDLFactoryImpl.newInstance();
>
> WSDLReader reader = fac.newWSDLReader();
>
> Definition def = 
> reader.readWSDL("http://api.google.com/GoogleSearch.wsdl");
>
> Map services = def.getServices();
>
> for(Object serviceKey : services.keySet()) {
>
> QName serviceQName = (QName) serviceKey;
>
> Service service = (Service) services.get(serviceQName);
>
> System.out.println("Namespace: " + 
> service.getQName().getNamespaceURI() + ", Service Name: " + 
> service.getQName().getLocalPart());
>
> Map ports = service.getPorts();
>
> for(Object portKey : ports.keySet()) {
>
> String portName = (String) portKey;
>
> Port port = (Port) ports.get(portName);
>
> System.out.println("  Namespace: " + 
> port.getBinding().getQName().getNamespaceURI() + ", Binding Name: " + 
> port.getBinding().getQName().getLocalPart());
>
> List operations = port.getBinding().getBindingOperations();
>
> for(Object operation : operations) {
>
> BindingOperation op = (BindingOperation) operation;
>
> System.out.print("    Operation Name: " + op.getName());
>
> List ll = op.getExtensibilityElements();
>
> for(Object soap : ll) {
>
> if(SOAPOperation.class.isInstance(soap)) {
>
> System.out.print(" (" + ((SOAPOperation)soap).getSoapActionURI() + ")");
>
> }
>
> }
>
> System.out.println();
>
> }
>
> }
>
> }
>
> }
>
>
> Above code read remote wsdl, and extract its information.
>
> Regards,
> Sukma
>
> On Feb 17, 2008 2:09 PM, Demetris G <demetris@ece.neu.edu 
> <ma...@ece.neu.edu>> wrote:
>
>
>     Hi all,
>
>        I am trying to use the wsdlParser from the Axis API to parse
>     the methods
>     out of an incoming WSDL file - does anyone who has used this
>     before have
>     any info on how to use this tool? OR any other way I could get the
>     operations
>     of the remote service out of the WSDL file? I would appreciate it.
>
>     Thanks
>
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     For additional commands, e-mail: axis-user-help@ws.apache.org
>     <ma...@ws.apache.org>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: WSDL parser

Posted by Sukma Agung Verdianto <sa...@gmail.com>.
Hi Demetris,
You can try to use wsdl4j (http://sourceforge.net/projects/wsdl4j) to get
the operations of specified wsdl file. (AFAIK, Axis2 uses this in their
wsdl2java code)

public static void main(String[] args) throws Exception {

WSDLFactory fac = WSDLFactoryImpl.newInstance();

WSDLReader reader = fac.newWSDLReader();

 Definition def = reader.readWSDL("http://api.google.com/GoogleSearch.wsdl"
);

 Map services = def.getServices();

for(Object serviceKey : services.keySet()) {

QName serviceQName = (QName) serviceKey;

Service service = (Service) services.get(serviceQName);

System.out.println("Namespace: " + service.getQName().getNamespaceURI() + ",
Service Name: " + service.getQName().getLocalPart());

 Map ports = service.getPorts();

for(Object portKey : ports.keySet()) {

String portName = (String) portKey;

Port port = (Port) ports.get(portName);

System.out.println("  Namespace: " +
port.getBinding().getQName().getNamespaceURI()
+ ", Binding Name: " + port.getBinding().getQName().getLocalPart());

 List operations = port.getBinding().getBindingOperations();

for(Object operation : operations) {

BindingOperation op = (BindingOperation) operation;

System.out.print("    Operation Name: " + op.getName());

List ll = op.getExtensibilityElements();

for(Object soap : ll) {

if(SOAPOperation.class.isInstance(soap)) {

System.out.print(" (" + ((SOAPOperation)soap).getSoapActionURI() + ")");

}

}

System.out.println();

}

}

}

}

Above code read remote wsdl, and extract its information.

Regards,
Sukma

On Feb 17, 2008 2:09 PM, Demetris G <de...@ece.neu.edu> wrote:

>
> Hi all,
>
>    I am trying to use the wsdlParser from the Axis API to parse the
> methods
> out of an incoming WSDL file - does anyone who has used this before have
> any info on how to use this tool? OR any other way I could get the
> operations
> of the remote service out of the WSDL file? I would appreciate it.
>
> Thanks
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

Re: WSDL parser

Posted by Demetris G <de...@ece.neu.edu>.
Thanks Martin and Sukma - I will try the two methods you send me and see
how they work. I will share on the list the results on anything I find

Regards

Martin Gainty wrote:
> $AXIS2_HOME/bin/wsdl2java -uri NameOfWsdl.wsdl
>
> M-
> ----- Original Message -----
> From: "Demetris G" <de...@ece.neu.edu>
> To: <ax...@ws.apache.org>
> Sent: Sunday, February 17, 2008 2:09 AM
> Subject: WSDL parser
>
>
>   
>> Hi all,
>>
>>     I am trying to use the wsdlParser from the Axis API to parse the
>>     
> methods
>   
>> out of an incoming WSDL file - does anyone who has used this before have
>> any info on how to use this tool? OR any other way I could get the
>> operations
>> of the remote service out of the WSDL file? I would appreciate it.
>>
>> Thanks
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>>
>>     
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: WSDL parser

Posted by Martin Gainty <mg...@hotmail.com>.
$AXIS2_HOME/bin/wsdl2java -uri NameOfWsdl.wsdl

M-
----- Original Message -----
From: "Demetris G" <de...@ece.neu.edu>
To: <ax...@ws.apache.org>
Sent: Sunday, February 17, 2008 2:09 AM
Subject: WSDL parser


>
> Hi all,
>
>     I am trying to use the wsdlParser from the Axis API to parse the
methods
> out of an incoming WSDL file - does anyone who has used this before have
> any info on how to use this tool? OR any other way I could get the
> operations
> of the remote service out of the WSDL file? I would appreciate it.
>
> Thanks
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org