AFAIK, the packaged in the code are chosen entirely from the XML namespaces.
Your WSDL has a target namespace for the overall contract and that's the
package where the files end up.

If you want your value objects in separate packages, then you need to sort
them into separate namespaces in the types section of your WSDL or in the
schemata that the WSDL includes.

Getting the (client) stub and the skeleton into separate packages is harder.
It looks to me like they are both associated with the binding, so both will
have the package associated with the binding's namespace. Two ways out:

 1. Hack on the code after generation.

 2. Split the WSDL into three files. File #1 has the port-type, message
    and types sections. Files #2 and #3 each have the binding and service
    sections but have different target namespaces; these files wsdl:import
    file #1. Generate the stub from one and the skeleton from another.

Solution 1 is simple but can't easily be automated. Solution 2 is baroque but
can run in an automated build. I'm waving my hands here; I haven't tried this
with Axis on real WSDL. Note that in solution 2 you've made two different
contracts and implemented one in the client and the other in the service. It
may well work out that the contracts are equivalent (I think the namespaces
used in the SOAP messages would come from the port-type, not from the
bindings, and so would match), but it's a technical mis-use of WSDL.

The WSDD files can be fished out of their default package and put in whatever
folder you want.

Is it really worth the grief to get the bits where you want them?


On Fri, 26 Aug 2005 [EMAIL PROTECTED] wrote:

> Thanks a lot Guy.   I gave the right package name in the mapping during
> WSD2Java invocation and got the package name that I needed.
>
> Here is another question that relates to the package created by WSDL2Java.
>   Currenty it creates all the java classes ..(Interface, stub,
> BindingImpl, skeleton etc)   in ONE package.. is there any way I can route
> the generated classes in to different  pakages?  ie.   I need to put my
> .wsdd in a separate folder, stub in one package, skeleton in one
> packgage..  my value objects for the messages in one package ..   any
> idea?
>
>
> Your help is highly appreciated!
>
> Raj
>
>
>
>
> Guy Rixon <[EMAIL PROTECTED]>
> 08/26/2005 12:00 PM
> Please respond to axis-user
>
>
>         To:     axis-user@ws.apache.org
>         cc:
>         Subject:        Re: Axis 1.2   WSDl2Java  creating packages in the 
> REVERSE order
>
>
> Hi,
>
> I think Axis is expecting to see namespace URIs with the http scheme, as
> in
> the http://www.w3.org/2001/XMLSchema of your example. When it finds the
> authority part of the URI it reverses it, because it expects it to look
> like a
> server name a la DNS. Arguably, it should only do this if the scheme of
> the
> URI is one of those where the authority is really an address (http, https,
> ftp, etc.), so yes, I'd call this a bug.
>
> To get round this, you need to use an explicit mapping of the namespace to
> your preferred package and to set this mapping in the invocation of
> WSDL2java.
> See the "reference documentation" for details.
>
> On Fri, 26 Aug 2005 [EMAIL PROTECTED] wrote:
>
> > Hello,
> >
> > I am trying to throw an custom exception and when I run WSDL2Java  it
> > creates my excepion  but the package name is REVERSED for
> InvalidDataFormatException.java   WSDL2Java puts this java class in
> exceptions.ws.com package instead of
> > com.ws.exceptions package
> >
> > Please let me know if its a bug in AXIS 1.2 or  I am making a mistake in
> > my declaration( I hope so.. but I don't have a clue)
> >
> > Here is the schema for my exception (ExceptionSchema.xsd)
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";
> >     xmlns:stns="java:com.ws.exceptions"
> >     elementFormDefault="qualified"
> >     attributeFormDefault="qualified"
> >     targetNamespace="java:com.ws.exceptions">
> >
> >
> >    <xsd:complexType name="InvalidDataFormatException">
> >     <xsd:sequence>
> >      <xsd:element type="xsd:string"
> >        name="errorCode"
> >        minOccurs="1"
> >        nillable="true"
> >        maxOccurs="1">
> >      </xsd:element>
> >      <xsd:element type="xsd:string"
> >        name="errorDescription"
> >        minOccurs="1"
> >        nillable="true"
> >        maxOccurs="1">
> >      </xsd:element>
> >      <xsd:element type="xsd:string"
> >        name="variables"
> >        minOccurs="1"
> >        nillable="true"
> >        maxOccurs="1">
> >      </xsd:element>
> >     </xsd:sequence>
> >    </xsd:complexType>
> > </xsd:schema>
> >
> > and here is my WSDL
> >
> >
> >
> > <?xml version="1.0" ?>
> >
> > <definitions name="urn:DataInquiry"
> >              targetNamespace="urn:DataInquiry2"
> >              xmlns:tns="urn:DataInquiry2"
> >              xmlns:typens="urn:DataInquiry2"
> >              xmlns:xsd="http://www.w3.org/2001/XMLSchema";
> >              xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
> >              xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
> >              xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/";
> >              xmlns="http://schemas.xmlsoap.org/wsdl/"; 
> > xmlns:xsd1="java:com.ws.exceptions">
> >
> >   <!-- type defs -->
> >   <import namespace="java:com.ws.exceptions" 
> > location="ExceptionSchema.xsd"></import>
> >   <types>
> >     <xsd:schema targetNamespace="urn:DataInquiry2"
> >                 xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
> >
> >
> >       <xsd:complexType name="inquiryRequest">
> >         <xsd:all>
> >             <xsd:element name="so" type="xsd:string"/>
> >             <xsd:element name="lNumber" type="xsd:string"/>
> >         </xsd:all>
> >       </xsd:complexType>
> >
> >       <xsd:complexType name="inquiryResponse">
> >         <xsd:all>
> >             <xsd:element name="status" type="xsd:string"/>
> >             <xsd:element name="mNumber" type="xsd:string"/>
> >             <xsd:element name="mFlag" type="xsd:string"/>
> >             <xsd:element name="mAFlag" type="xsd:string"/>
> >             <xsd:element name="mLFlag" type="xsd:string"/>
> >         </xsd:all>
> >       </xsd:complexType>
> >
> >
> >
> >
> >     </xsd:schema>
> >   </types>
> >
> >   <!-- message declns -->
> >   <message name="empty"/>
> >
> >
> >
> >   <!-- Raj -->
> >
> >    <message name="GetInquiryDataRequest">
> >     <part  name="inquiryRequest" type="typens:inquiryRequest"/>
> >   </message>
> >
> >    <message name="GetInquiryDataResponse">
> >     <part  name="inquiryResponse" type="typens:inquiryResponse"/>
> >   </message>
> >
> >   <message name="InvalidDataFormatException">
> >   <part  name="InvalidDataFormatException"
> type="xsd1:InvalidDataFormatException">
> >   </part>
> >   </message>
> >
> >
> >   <!-- port type declns -->
> >   <portType name="DataInquiry">
> >
> >     <operation name="getInquiryData">
> >       <input name="input" message="tns:GetInquiryDataRequest"/>
> >       <output name="output" message="tns:GetInquiryDataResponse"/>
> >       <fault name="InvalidDataFormatException"
> message="tns:InvalidDataFormatException"/>
> >
> >     </operation>
> >   </portType>
> >
> >   <!-- binding declns -->
> >   <binding name="DataInquirySOAPBinding" type="tns:DataInquiry">
> >     <soap:binding style="document"
> >                   transport="http://schemas.xmlsoap.org/soap/http"/>
> >
> >     <operation name="getInquiryData">
> >
> >        <soap:operation soapAction=""/>
> >       <input name="input">
> >         <soap:body use="literal"/>
> >       </input>
> >       <output name="output">
> >         <soap:body use="literal"/>
> >       </output>
> >       <wsdl:fault name="InvalidDataFormatException">
> >         <wsdlsoap:fault name="InvalidDataFormatException"
> use="literal"/>
> >       </wsdl:fault>
> >     </operation>
> >   </binding>
> >
> >   <!-- service decln -->
> >   <service name="DataInquiryService">
> >     <port name="DataInquiry" binding="tns:DataInquirySOAPBinding">
> >       <soap:address 
> > location="http://localhost:8080/InquiryWSWAR/services/DataInquiry"/>
> >     </port>
> >   </service>
> >
> > </definitions>
> >
> >
>
> Guy Rixon       [EMAIL PROTECTED]
> Institute of Astronomy                                   Tel:
> +44-1223-337542
> Madingley Road, Cambridge, UK, CB3 0HA                           Fax:
> +44-1223-337523
>
>
>

Guy Rixon                                       [EMAIL PROTECTED]
Institute of Astronomy                          Tel: +44-1223-337542
Madingley Road, Cambridge, UK, CB3 0HA          Fax: +44-1223-337523

Reply via email to