Hi,

You can use the Parser class in WSIF (see my previous post on this thread) to do exactly what you need.

JROM isn't to be used for parsing a schema, it is a representation of an instance of some schema (sort of like DOM, except that it relates parts of the XML element to java objects in a more natural way, which makes it convenient for processing in a java program).

Nirmal.


Xserty <[EMAIL PROTECTED]>

02/26/2003 09:44 AM
Please respond to wsif-user

       
        To:        [EMAIL PROTECTED]
        cc:        
        Subject:        Re: WSIF, WSDL and Complex Types!



Hi again! :)
       I'm slowly getting there (I hope!).
I iterated through all my services, got all my operations, etc, but now I'm blocked at the message parts! :(
Say I have a WSDL definition that contains the following types:

<types>
       <s:schema elementFormDefault="qualified" targetNamespace="http://www.whatever.com">
               <s:element name="sendMSGFull">
                       <s:complexType>
                               <s:sequence>
                                       <s:element minOccurs="1" maxOccurs="1" name="strInParm" type="s:string"/>
                                       <s:element minOccurs="1" maxOccurs="1" name="intInParm" type="s:int"/>
                               </s:sequence>
                       </s:complexType>
               </s:element>
               <s:element name="sendMSGFullResponse">
                       <s:complexType>
                               <s:sequence>
                                       <s:element minOccurs="0" maxOccurs="1" name="sendMSGFullResult" type="s:string"/>
                               </s:sequence>
                       </s:complexType>
               </s:element>
               <s:element name="string" nillable="true" type="s:string"/>
       </s:schema>
</types>

Is there some easy way to drill-down like I've been doing so far?
Or this is the time to use JROM?
Hope to hear from you!
All the best, Xserty

At 08:09 AM 2/26/03 -0500, you wrote:

Hi,

WSIF does have some schema parsing support, which is a convenient way of accessing the types defined and also for getting a default mapping of the declared types to corresponding java classes. The class org.apache.wsif.schema.Parser has this code. Here are the two probably most useful methods in the class:


   /**

    * Populate a List with all the top level SchemaType objects (complexTypes, simpleTypes and elements) generated

    * by parsing the schemas associated with a Definition object

    * @param def The Definition object representing the wsdl

    * @param schemaTypes The List to proulate with the SchemaType objects

    * @param loc WSDLLocator equal or equivalent to that used to locate the original wsdl document. This is required in order

    * to resolve imported schemas.

    * @exception A WSIFException is thrown if a problem occurs when parsing the schemas

    */

       public static void getAllSchemaTypes(Definition def, List schemaTypes, WSDLLocator loc) throws WSIFException


   /**

    * Given a Definition object, populate a Map with all the types defined in the schemas in the definition and

    * their corresponding Java class names.

    * @param def The Definition object representing the wsdl

    * @param table The Map to proulate with xml type -> Java class name (QName -> String) mappings

    * @param loader A ClassLoader to use in resolving xsd locations

    */

   public static void getTypeMappings(Definition def, Map table, ClassLoader loader) throws WSIFException


Hope that helps,

Nirmal.



"Jeff Greif" <[EMAIL PROTECTED]>


02/25/2003 11:47 PM

Please respond to wsif-user
       
       To:        <[EMAIL PROTECTED]>

       cc:        
       Subject:        Re: WSIF, WSDL and Complex Types!



The port has a set of operations (see the WSDL spec).  Each operation has
parameters which have types.  The types mentioned should be defined in
elements of the wsdl with xpaths /wsdl:definitions/wsdl:types/xsd:schema OR
possible referenced in elements /wsdl:definitions/wsdl:import if they're in
different namespaces from the wsdl target namespace, or in further imports
in the imported documents.

So if you want to discover methods, you iterate through the operations of
the wsifPort (look at the java doc for details).  If you have an operation
and want to determine the types of its parameters, you iterate through
those.  (The DynamicInovker example shows how to do both of these.)

Jeff

----- Original Message -----
From: "Xserty" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 25, 2003 10:24 AM
Subject: WSIF, WSDL and Complex Types!


> Hi,
> could you please help me to discover methods and it's parameters
> (especially complex types) using WSIF (and JROM?!)?
>
> I get the WSIFPort in the following way:
> wsifService = wsifServiceFact.getService(wsdlDefinition, service,
> binding.getPortType());
> wsifPort = wsifService.getPort();
>
> but then I don't have a clue on how to continue!
> All examples found on Internet deal with dinamic invocation, but all I
> want to do is discover the complex types parameters of all operations.
> Can someone give me at least a birds eye view of what (and how) has to
> be done?
> Thanks very much!
> Xserty
>
>

Reply via email to