Thanks Mike

Very kind of you



From: Mike Woinoski <[EMAIL PROTECTED]>
Reply-To: axis-user@ws.apache.org
To: axis-user@ws.apache.org
Subject: Re: creating WSDL contract
Date: Sun, 04 Sep 2005 11:06:27 -0400

Plorks mail wrote:
can anyone give me an example of writing a WSDL contract so i can later do wsdl2java?
>
> i'm after an example that retruns xml/arrays/strings

Example WSDL and imported schema below. Note the updatePatientRecord element has a child named visitDetails that is declared with maxOccurs="unbounded". This is the WS-I recommendation for handling arrays.

To generate template Java files and deploy.wsdd:

  java org.apache.axis.wsdl.WSDL2Java --server-side --package mypackage
        --output . OfficeVisitService.wsdl

Generate server-config.wsdd using AdminClient or using the Admin utility:
  java org.apache.axis.utils.Admin -server deploy.wsdd

what editors are best to create the wsdl file?

The WTP Eclipse plug-in includes a very nice WSDL editor: www.eclipse.org/webtools

Cape Science offers a free stand-alone WSDL editor: www.capescience.com/soa

Mike

================ Service WSDL ========================================

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
    targetNamespace="http://www.ltree.com/wsdl/officevisit";
    xmlns:impl="http://www.ltree.com/wsdl/officevisit";
    xmlns:tns="http://www.ltree.com/types";
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
    xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/";
    >

 <wsdl:types>
     <xsd:schema
            targetNamespace="http://www.ltree.com/types";
            xmlns:tns="http://www.ltree.com/types";
            xmlns:xsd="http://www.w3.org/2001/XMLSchema";
            elementFormDefault="qualified">

        <!-- schema shown after WSDL -->
        <xsd:include
schemaLocation="http://localhost:8080/schemas/PatientRecord.xsd"; />

        <xsd:element name="updatePatientRecord">
            <xsd:complexType>
                <xsd:sequence>
<xsd:element name="patientInfo" type="tns:PatientInfo"/> <xsd:element name="visitDetails" type="tns:VisitDetails"
                                 minOccurs="0" maxOccurs="unbounded"/>
                </xsd:sequence>
            </xsd:complexType>
        </xsd:element>

        <xsd:element name="updatePatientRecordResponse">
            <xsd:complexType>
                <xsd:sequence>
<xsd:element name="patientRecord" type="tns:PatientRecord"/>
                </xsd:sequence>
            </xsd:complexType>
        </xsd:element>

    </xsd:schema>
 </wsdl:types>

 <wsdl:message name="updatePatientRecordRequest">
    <wsdl:part name="parameters" element="tns:updatePatientRecord"/>
 </wsdl:message>

 <wsdl:message name="updatePatientRecordResponse">
<wsdl:part name="parameters" element="tns:updatePatientRecordResponse"/>
 </wsdl:message>

 <wsdl:portType name="OfficeVisit">
    <wsdl:operation name="updatePatientRecord">
       <wsdl:input message="impl:updatePatientRecordRequest"
                   name="updatePatientRecordRequest"/>
       <wsdl:output message="impl:updatePatientRecordResponse"
                    name="updatePatientRecordResponse"/>
    </wsdl:operation>
 </wsdl:portType>

 <wsdl:binding name="OfficeVisitBinding" type="impl:OfficeVisit">

    <wsdlsoap:binding
          style="document"
          transport="http://schemas.xmlsoap.org/soap/http"/>

    <wsdl:operation name="updatePatientRecord">
       <wsdlsoap:operation soapAction=""/>

       <wsdl:input name="updatePatientRecordRequest">
          <wsdlsoap:body use="literal" />
       </wsdl:input>

       <wsdl:output name="updatePatientRecordResponse">
          <wsdlsoap:body use="literal"/>
       </wsdl:output>

    </wsdl:operation>
 </wsdl:binding>

 <wsdl:service name="OfficeVisitServicePorts">
<wsdl:port binding="impl:OfficeVisitBinding" name="OfficeVisitService">
       <wsdlsoap:address
location="http://localhost:8080/ex51solBonus/services/OfficeVisitService"/>
    </wsdl:port>
 </wsdl:service>

</wsdl:definitions>



================ PatientRecord.xsd Schema ======================================

<?xml version="1.0" encoding="iso-8859-1"?>
<xsd:schema
        targetNamespace="http://www.ltree.com/types";
        xmlns:xsd="http://www.w3.org/2001/XMLSchema";
        xmlns:tns="http://www.ltree.com/types";
        elementFormDefault="qualified">

    <xsd:complexType name="PatientRecord">
        <xsd:sequence>
            <xsd:element name="patientInfo" type="tns:PatientInfo"/>
            <xsd:element name="visitDetails" type="tns:VisitDetails"
                         minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:string" use="required"/>
    </xsd:complexType>

    <xsd:complexType name="PatientInfo">
        <xsd:sequence>
            <xsd:element name="name" type="xsd:string"/>
            <xsd:element name="address" type="xsd:string"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="VisitDetails">
        <xsd:sequence>
            <xsd:element name="date" type="xsd:string"/>
            <xsd:element name="workCompleted" type="xsd:string"/>
            <xsd:element name="fee" type="xsd:decimal"/>
        </xsd:sequence>
    </xsd:complexType>

</xsd:schema>



_________________________________________________________________
Winks & nudges are here - download MSN Messenger 7.0 today! http://messenger.msn.co.uk

Reply via email to