axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Demetris G <demet...@ece.neu.edu>
Subject Re: WSDL parser
Date Tue, 19 Feb 2008 05:38:26 GMT

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 
> <mailto:demetris@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
>     <mailto:demetris@ece.neu.edu>
>     > <mailto:demetris@ece.neu.edu <mailto:demetris@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
>     <mailto:axis-user-unsubscribe@ws.apache.org>
>     >     <mailto:axis-user-unsubscribe@ws.apache.org
>     <mailto:axis-user-unsubscribe@ws.apache.org>>
>     >     For additional commands, e-mail:
>     axis-user-help@ws.apache.org <mailto:axis-user-help@ws.apache.org>
>     >     <mailto:axis-user-help@ws.apache.org
>     <mailto:axis-user-help@ws.apache.org>>
>     >
>     >
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>     <mailto:axis-user-unsubscribe@ws.apache.org>
>     For additional commands, e-mail: axis-user-help@ws.apache.org
>     <mailto: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


Mime
View raw message