Pakira
Pakira

Reputation: 2021

How to add xsd in WSDL

My requirement is to create a webservice on WebSphear. I want to add my xsd file into WSDL. For that I've written my xsd file below -

<xsd:element name="getAppDate" ></xsd:element>
    <xsd:element name="getAppDateResponce"></xsd:element>

   <xsd:complexType name="getAppDate">
  <xsd:sequence>
  <xsd:element name="appdate" type="xsd:string" minOccurs="0"></xsd:element>
  <xsd:element name="uuName" type="xsd:string" minOccurs="0"></xsd:element>
</xsd:sequence>
 </xsd:complexType>

<xsd:complexType name="getAppDateResponce">
 <xsd:sequence>
  <xsd:element name="return" type="xsd:boolean" minOccurs="0"></xsd:element>
 </xsd:sequence>
</xsd:complexType>
   </xsd:schema>

Now I've written one interface for JAX-WS below -

 public interface BookAppointment {

String getAppDate(String date,String uuname);
boolean getAppDateResponce(String date,String uuname);
       }

Next step: I'm executing Java2WSDL command to generate wsdl -

   java org.apache.axis.wsdl.Java2WSDL -o ..\appointmentbooking.wsdl -C C:\Users\px00395
   \IBM\rationalsdp\workspace\PeoplesoftWS\bin\servicecenter.xsd -l 
    http://localhost:9081/AxisServlet/services/appointmentbook  
    com.ubs.peoplesoft.BookAppointment

But I'm getting message : The has already been specified as, C:\Users\px00395\IBM\rati onalsdp\workspace\PeoplesoftWS\bin\servicecenter.xsd. It cannot be specified again as com.ubs.peoplesoft.BookAppointment. Please let me know what wrong I'm doing here and how can I add xsd into WSDL?

Upvotes: 1

Views: 4609

Answers (1)

Alex Kreutznaer
Alex Kreutznaer

Reputation: 1170

You may include your schema to wsdl, something like

<include schemaLocation="C:\Users\px00395
   \IBM\rationalsdp\workspace\PeoplesoftWS\bin\servicecenter.xsd" />

Or you may import schema, something like this:

<import namespace="mynamespace"
        schemaLocation="C:\Users\px00395
   \IBM\rationalsdp\workspace\PeoplesoftWS\bin\servicecenter.xsd" />

If you work in a team, you'd better use some local sever to host your schemas, rather than local file system. This way you won't have to synchronize and copy the .xsd to all develoeprs' computers.


Please, reference WSDL 2.0 specification for more detailed explanation.

Upvotes: 2

Related Questions