简体   繁体   English

如何在WSDL中添加XSD

[英]How to add xsd in WSDL

My requirement is to create a webservice on WebSphear. 我的要求是在WebSphear上创建一个Web服务。 I want to add my xsd file into WSDL. 我想将我的xsd文件添加到WSDL中。 For that I've written my xsd file below - 为此,我在下面编写了我的xsd文件-

<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 - 现在,我在下面为JAX-WS编写了一个界面-

 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 - 下一步:我正在执行Java2WSDL命令以生成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. 但是我得到的消息是:已被指定为C:\\ Users \\ px00395 \\ IBM \\ rati onalsdp \\ workspace \\ PeoplesoftWS \\ bin \\ servicecenter.xsd。 It cannot be specified again as com.ubs.peoplesoft.BookAppointment. 不能再次将其指定为com.ubs.peoplesoft.BookAppointment。 Please let me know what wrong I'm doing here and how can I add xsd into WSDL? 请让我知道我在这里做错什么以及如何将xsd添加到WSDL中?

You may include your schema to wsdl, something like 您可以将架构包含到wsdl中,例如

<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. 这样,您将不必同步.xsd并将其复制到所有develoeprs的计算机。


Please, reference WSDL 2.0 specification for more detailed explanation. 请参考WSDL 2.0规范以获取更多详细说明。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM