Another example of why I feel I misunderstand the results.

I have created a WSDL file that when parsed by Apache's Axis wsdl2java and
Sun's wscompile generate similar code that compiles. The WS definition evolved
from serveral 'unique behaviors' found in each tool.  Wscompile does not like
<fault> messages that have more than one part. From this and a small statement
in the SOAP spec I've made the assumption that <fault> messages must contain
one and only one part. I created a complex-type schema syntax and used it for
the one <fault> message part. The complex type contains the necessary elements
to define an Exception which are code, message, and OverlapOutages. Code
generation from both tools produces a interesting result. Interface methods
throw the complex type defined in the schema syntax(a part of the <fault>
message) instead of the <fault> message.

Here is the WSDL segement followed by the Interface souce file.


        </xsd:schema>
            targetNamespace="http://www.caiso.com/webservices/slic/xsd1";
            <!-- ExceptionContent-->
            <xsd:complexType name="ExceptionContent">
                <xsd:sequence>
                    <xsd:element maxOccurs="1" minOccurs="0" name="code"
type="xsd:int"/>
                    <xsd:element maxOccurs="1" minOccurs="0" name="message"
type="xsd:string"/>
                    <xsd:element maxOccurs="1" minOccurs="0" name="overlaps"
type="xsd1:OverlapOutages"/>
                </xsd:sequence>
            </xsd:complexType>
        </xsd:schema>

    <wsdl:message name="OutageRequestWebServiceException">
        <wsdl:part name="exception_content" type="xsd1:ExceptionContent"/>
    </wsdl:message>
    <wsdl:message name="findByCriteriaRequest">
        <wsdl:part name="types" type="xsd:int"/>
        <wsdl:part name="state_codes" type="xsd:int"/>
        <wsdl:part name="start_date" type="xsd:dateTime"/>
        <wsdl:part name="end_date" type="xsd:dateTime"/>
    </wsdl:message>
    <wsdl:message name="findByCriteriaResponse">
        <wsdl:part name="return" type="xsd:int"/>
    </wsdl:message>
    <wsdl:portType name="OutageRequestWebService">
        <wsdl:operation
            name="findByCriteria"
            parameterOrder="types state_codes start_date end_date">
            <wsdl:input message="tns:findByCriteriaRequest"/>
            <wsdl:output message="tns:findByCriteriaResponse"/>
            <wsdl:fault
                message="tns:OutageRequestWebServiceException"
                name="OutageRequestWebServiceException"/>
        </wsdl:operation>
    </wsdl:portType>


Generated Interface

/**
 * OutageRequestWebService.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis WSDL2Java emitter.
 */

package com.caiso.www.webservices.slic.OutageRequestWebService;

public interface OutageRequestWebService extends java.rmi.Remote {
    public int findByCriteria(int types, int state_codes, java.util.Calendar
start_date, java.util.Calendar end_date)
          throws java.rmi.RemoteException,
com.caiso.www.webservices.slic.xsd1.ExceptionContent;
}


To make the generated code appear the way I would expect it to look I changed
the name ExceptionContent to OutageRequestWebServiceException. Since it is in a
different namespace there is no collision, but posible confusion. I find it
very odd that this behavior is the same for both compilers and don't care to
speculate beyond my misperception of the results. Below is the WSDL file
segement and Interface source file.


        </xsd:schema>
            targetNamespace="http://www.caiso.com/webservices/slic/xsd1";
            <!-- ExceptionContent-->
            <xsd:complexType name="OutageRequestWebServiceException">
                <xsd:sequence>
                    <xsd:element maxOccurs="1" minOccurs="0" name="code"
type="xsd:int"/>
                    <xsd:element maxOccurs="1" minOccurs="0" name="message"
type="xsd:string"/>
                    <xsd:element maxOccurs="1" minOccurs="0" name="overlaps"
type="xsd1:OverlapOutages"/>
                </xsd:sequence>
            </xsd:complexType>
        </xsd:schema>

    <wsdl:message name="OutageRequestWebServiceException">
        <wsdl:part name="exception_content"
type="xsd1:OutageRequestWebServiceException"/>
    </wsdl:message>
    <wsdl:message name="findByCriteriaRequest">
        <wsdl:part name="types" type="xsd:int"/>
        <wsdl:part name="state_codes" type="xsd:int"/>
        <wsdl:part name="start_date" type="xsd:dateTime"/>
        <wsdl:part name="end_date" type="xsd:dateTime"/>
    </wsdl:message>
    <wsdl:message name="findByCriteriaResponse">
        <wsdl:part name="return" type="xsd:int"/>
    </wsdl:message>
    <wsdl:portType name="OutageRequestWebService">
        <wsdl:operation
            name="findByCriteria"
            parameterOrder="types state_codes start_date end_date">
            <wsdl:input message="tns:findByCriteriaRequest"/>
            <wsdl:output message="tns:findByCriteriaResponse"/>
            <wsdl:fault
                message="tns:OutageRequestWebServiceException"
                name="OutageRequestWebServiceException"/>
        </wsdl:operation>
    </wsdl:portType>


Generated Interface

/**
 * OutageRequestWebService.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis WSDL2Java emitter.
 */

package com.caiso.www.webservices.slic.OutageRequestWebService;

public interface OutageRequestWebService extends java.rmi.Remote {
    public int findByCriteria(int types, int state_codes, java.util.Calendar
start_date, java.util.Calendar end_date)
          throws java.rmi.RemoteException,
com.caiso.www.webservices.slic.xsd1.OutageRequestWebServiceException;
}


> ---  Reynardine <[EMAIL PROTECTED]> wrote:
> > Mark,
> > 
> > Before trying ant/build.xml, you could try running WSDL2Java manually from
> > the command line to see what you get
> > 
> > i.e.
> > 
> > >
> > > java org.apache.axis.wsdl.WSDL2Java  -o . -d Session  -s  -p yourpath.ws
> > yourwsdlfilename.wsdl
> > > dir yourpath\ws\*.*
> > >
> > 
> > Then, if this works you know WSDL2Java runs ok on your code.
> > 
> > Rey.
> > 
> > ----- Original Message -----
> > From: mark pope <[EMAIL PROTECTED]>
> > Date: Mon, 23 Jun 2003 08:52:18 -0700 (PDT)
> > To: [EMAIL PROTECTED]
> > Subject: Re: WSDL2Java bug? or my misunderstanding
> > 
> > > Sorry I ran the last test with genned files from previous test. I re-ran
> > wsdl
> > > with 1.1 and got the following.
> > > 
> > > The following is accurate:
> > > 
> > > With  type="xsd1:ExceptionContent":
> > > 1. ExceptionContent.java is generated.
> > > 2. OutageRequestWebServiceException.java is NOT generated.
> > > 3. OutageRequestWebService.java is generated with ExceptionContent not
> > > OutageRequestWebServiceException in the throws clause.
> > > 
> > > What I expect is OutageRequestWebServiceException.java to be generated
> and
> > that
> > > it contains a member ExceptionContent. As well as
> > OutageRequestWebService.java
> > > including OutageRequestWebServiceException in its throws clause. This is
> > the
> > > way its supposed to work, right?
> > > 
> > > Regards,
> > > Mark Pope
> > > 
> > > --- mark pope <[EMAIL PROTECTED]> wrote:
> > > > Chris,
> > > > 
> > > > I'm calling wsdl2java with ant(build.xml) the only parameters I'm
> passing
> > are
> > > > "-osrc" for the location of ouput.
> > > > 
> > > > With  type="xsd1:ExceptionContent" ExceptionContent.java is generated,
> > > > OutageRequestWebServiceException.java is generated, and
> > > > OutageRequestWebService.java(below). Notice that the throws clause
> > contains
> > > > ExceptionContent not OutageRequestWebServiceException as defined in the
> > wsdl
> > > > file.
> > > > 
> > > > I will try it with the nightly build now. 
> > > > 
> > > > 
> > > > 
> > > > /**
> > > >  * OutageRequestWebService.java
> > > >  *
> > > >  * This file was auto-generated from WSDL
> > > >  * by the Apache Axis WSDL2Java emitter.
> > > >  */
> > > > 
> > > > package com.caiso.www.webservices.slic.OutageRequestWebService;
> > > > 
> > > > public interface OutageRequestWebService extends java.rmi.Remote {
> > > >     public int findByCriteria(int types, int state_codes,
> > java.util.Calendar
> > > > start_date, java.util.Calendar end_date) throws
> java.rmi.RemoteException,
> > > > com.caiso.www.webservices.slic._xsd1.ExceptionContent;
> > > > }
> > > > 
> > > > 
> > > > 
> > > > Thanks for your help.
> > > > 
> > > > Regards,
> > > > Mark Pope
> > > > 
> > > > --- chaddad <[EMAIL PROTECTED]> wrote:
> > > > > Mark - 
> > > > > 
> > > > > When testing the wsdl (and uncommenting the part) wsdl2java is
> properly
> > > > > parsing the file.  i'm using a nightly build.
> > > > > 
> > > > > can you provide the exact command line that you are using?
> > > > > 
> > > > > thanks,
> > > > > 
> > > > > /Chris
> > > > > 
> > > > > 
> > > > > ---------- Original Message ----------------------------------
> > > > > From: mark pope <[EMAIL PROTECTED]>
> > > > > Reply-To: [EMAIL PROTECTED]
> > > > > Date:  Fri, 20 Jun 2003 16:21:36 -0700 (PDT)
> > > > > 
> > > > > >Attached is a very simple example of a WSDL file that fails(produces
> > > > > undesired
> > > > > >behavior in my opinion) when parsed with WSDL2Java and Sun's
> JWSDP_1.1
> > > > > >wscompile.
> > > > > >
> > > > > >Basically I want to define a fault message that contains a part that
> > is of
> > > > > >complextype like this:
> > > > > >
> > > > > >    <wsdl:message name="OutageRequestWebServiceException">
> > > > > >        <wsdl:part name="exception_content"
> > type="xsd1:ExceptionContent"/>
> > > > > >    </wsdl:message>
> > > > > >
> > > > > >If I define the part type as "xsd:int" the
> > > > > >OutageRequestWebServiceException.java file is generated.
> > > > > >
> > > > > >When the part type is "xsd1:ExceptionContent" the java file is not
> > > > generated
> > > > > >and  other generated files do not have the Exception in their throws
> > > > clause.
> > > > > >
> > > > > >What's up?
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > ><?xml version="1.0" encoding="UTF-8"?>
> > > > > ><wsdl:definitions
> > > > > >   
> > > > >
> > > >
> > >
> >
>
>targetNamespace="http://www.caiso.com/webservices/slic/OutageRequestWebService";
> > > > > >    xmlns="http://schemas.xmlsoap.org/wsdl/";
> > > > > >    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
> > > > > >   
> > > > >
> > xmlns:tns="http://www.caiso.com/webservices/slic/OutageRequestWebService";
> > > > > >    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
> > > > > >    xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/";
> > > > > >    xmlns:xsd="http://www.w3.org/2001/XMLSchema";
> > > > > >    xmlns:xsd1="http://www.caiso.com/webservices/slic/.xsd1";>
> > > > > >    <wsdl:types>
> > > > > >        <xsd:schema
> > > > > >           
> > targetNamespace="http://www.caiso.com/webservices/slic/.xsd1";
> > > > > >            xmlns="http://schemas.xmlsoap.org/wsdl/";
> > > > > >           
> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
> > > > > >           
> > > > >
> > >xmlns:tns="http://www.caiso.com/webservices/slic/OutageRequestWebService";
> > > > > >            xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
> > > > > >            xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/";
> > > > > >            xmlns:xsd="http://www.w3.org/2001/XMLSchema";
> > > > > >           
> xmlns:xsd1="http://www.caiso.com/webservices/slic/.xsd1";>
> > > > > >            <xsd:complexType name="ExceptionContent">
> > > > > >                <xsd:sequence>
> > > > > >                    <xsd:element maxOccurs="1" minOccurs="0"
> > name="code"
> > > > > >type="xsd:int"/>
> > > > > >                </xsd:sequence>
> > > > > >            </xsd:complexType>
> > > > > >        </xsd:schema>
> > > > > >    </wsdl:types>
> > > > > >    <wsdl:message name="OutageRequestWebServiceException">
> > > > > >       <!--<wsdl:part name="exception_content"
> > > > > >type="xsd1:ExceptionContent"/>-->
> > > > > >        <wsdl:part name="exception_content" type="xsd:int"/>
> > > > > >    </wsdl:message>
> 
=== message truncated ===


=====
Regards,
Mark Pope

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

Reply via email to