You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by S P <sp...@googlemail.com> on 2011/11/14 00:15:14 UTC

Web Service Development using XML Schema

I want to generate a web service. What I have at the moment is an XML
Schema (Person.xsd).
Using the web service user should able to upload their information as
described in XML Schema to the Server.

I want to take your advice how can I develop such a web service using
Axis2.

I have following technologies available:
Axis2.
Java.
Eclipse.
Code generation Plugin.
Service Archiver Plugin.

I have just put Person.xsd at the end of this e-mail.

Regards,
Peter

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
    <xs:element name="Person">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="Student">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="FirstName" type="xs:string"/>
                            <xs:element name="DateOfBirth" type="xs:date"/>
                        </xs:sequence>
                        <xs:attribute name="surname" type="xs:string"/>
                    </xs:complexType>
                </xs:element>
                <xs:element name="Employed">
                    <xs:complexType>
                        <xs:attribute name="surname" type="xs:string"/>
                    </xs:complexType>
                </xs:element>
                <xs:element name="Unemployed">
                    <xs:complexType>
                        <xs:attribute name="surname" type="xs:string"/>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>

unsubscribe

Posted by Thanhy Mather <tm...@yahoo.com>.
unsubscribe

Re: Web Service Development using XML Schema

Posted by S P <sp...@googlemail.com>.
Hello Both,

Thank you Deepal for clarification for WSDL and its relation to XSD.

Thank you Ron for sharing your expertise on XSD Modelling. I will contact
you if I will have some questions regarding XSD
technology.

Thanks again,
S

On Mon, Nov 14, 2011 at 8:13 AM, Ron McNulty <rm...@clear.net.nz> wrote:

> **
> Hi Deepal
>
> It may be off topic, but I would advise you to run your XSD past an
> experienced data modeller or senior developer/architect. It does not appear
> to be a clean definition of a Person. For instance:
>
>   - Student/Employed/Unemployed should be a single top-level enumerated
> field. As it stands, changing your employment status appears to redefine
> your surname.
>   - The surname attribute is common to all sub-elements and needs to move
> up into the Person element.
>   - Date of birth, firstName and Surname should be top-level elements with
> some being optional if the business rules say so.
>   - Cardinallity by default is one only mandatory occurrance. So for every
> person you would need to have Student, Employed and Unemployed elements. I
> doubt that you want that.
>
> It is important that you get your data structures correct before
> committing them to a web service. Fixing a service that others connect to
> is much harder than getting it right first time.
>
> Just my 2c worth...
>
> Regards
>
> Ron
>
>
> ----- Original Message -----
> *From:* Deepal Jayasinghe <de...@opensource.lk>
> *To:* java-user@axis.apache.org
> *Sent:* Monday, November 14, 2011 1:51 PM
> *Subject:* Re: Web Service Development using XML Schema
>
> I am not 100% sure whether our code generator can generate code from XML
> schema since it does not have the binding.  Because, having a schema simply
> means a collection of data types. Thus, there should be a way to associate
> them (such as WSDL binding). Best approach would be to create a WSDL and
> generate code.
>
> On 11/13/2011 6:15 PM, S P wrote:
>
> I want to generate a web service. What I have at the moment is an XML
> Schema (Person.xsd).
> Using the web service user should able to upload their information as
> described in XML Schema to the Server.
>
> I want to take your advice how can I develop such a web service using
> Axis2.
>
> I have following technologies available:
> Axis2.
> Java.
> Eclipse.
> Code generation Plugin.
> Service Archiver Plugin.
>
> I have just put Person.xsd at the end of this e-mail.
>
> Regards,
> Peter
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified">
>     <xs:element name="Person">
>         <xs:complexType>
>             <xs:sequence>
>                 <xs:element name="Student">
>                     <xs:complexType>
>                         <xs:sequence>
>                             <xs:element name="FirstName"
> type="xs:string"/>
>                             <xs:element name="DateOfBirth"
> type="xs:date"/>
>                         </xs:sequence>
>                         <xs:attribute name="surname" type="xs:string"/>
>                     </xs:complexType>
>                 </xs:element>
>                 <xs:element name="Employed">
>                     <xs:complexType>
>                         <xs:attribute name="surname" type="xs:string"/>
>                     </xs:complexType>
>                 </xs:element>
>                 <xs:element name="Unemployed">
>                     <xs:complexType>
>                         <xs:attribute name="surname" type="xs:string"/>
>                     </xs:complexType>
>                 </xs:element>
>             </xs:sequence>
>         </xs:complexType>
>     </xs:element>
> </xs:schema>
>
>
> --
> Blog - http://blogs.deepal.org/
>
>

Re: Web Service Development using XML Schema

Posted by Ron McNulty <rm...@clear.net.nz>.
Hi Deepal

It may be off topic, but I would advise you to run your XSD past an experienced data modeller or senior developer/architect. It does not appear to be a clean definition of a Person. For instance:

  - Student/Employed/Unemployed should be a single top-level enumerated field. As it stands, changing your employment status appears to redefine your surname.
  - The surname attribute is common to all sub-elements and needs to move up into the Person element.
  - Date of birth, firstName and Surname should be top-level elements with some being optional if the business rules say so.
  - Cardinallity by default is one only mandatory occurrance. So for every person you would need to have Student, Employed and Unemployed elements. I doubt that you want that.

It is important that you get your data structures correct before committing them to a web service. Fixing a service that others connect to is much harder than getting it right first time.

Just my 2c worth...

Regards

Ron

  ----- Original Message ----- 
  From: Deepal Jayasinghe 
  To: java-user@axis.apache.org 
  Sent: Monday, November 14, 2011 1:51 PM
  Subject: Re: Web Service Development using XML Schema


  I am not 100% sure whether our code generator can generate code from XML schema since it does not have the binding.  Because, having a schema simply means a collection of data types. Thus, there should be a way to associate them (such as WSDL binding). Best approach would be to create a WSDL and generate code. 

  On 11/13/2011 6:15 PM, S P wrote: 
    I want to generate a web service. What I have at the moment is an XML Schema (Person.xsd).
    Using the web service user should able to upload their information as described in XML Schema to the Server.


    I want to take your advice how can I develop such a web service using Axis2. 



    I have following technologies available:
    Axis2.
    Java.
    Eclipse.
    Code generation Plugin.
    Service Archiver Plugin.



    I have just put Person.xsd at the end of this e-mail.



    Regards,
    Peter



    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
        <xs:element name="Person">
            <xs:complexType>
                <xs:sequence>
                    <xs:element name="Student">
                        <xs:complexType>
                            <xs:sequence>
                                <xs:element name="FirstName" type="xs:string"/>
                                <xs:element name="DateOfBirth" type="xs:date"/>
                            </xs:sequence>
                            <xs:attribute name="surname" type="xs:string"/>
                        </xs:complexType>
                    </xs:element>
                    <xs:element name="Employed">
                        <xs:complexType>
                            <xs:attribute name="surname" type="xs:string"/>
                        </xs:complexType>
                    </xs:element>
                    <xs:element name="Unemployed">
                        <xs:complexType>
                            <xs:attribute name="surname" type="xs:string"/>
                        </xs:complexType>
                    </xs:element>
                </xs:sequence>
            </xs:complexType>
        </xs:element>
    </xs:schema> 


  -- 
  Blog - http://blogs.deepal.org/

Re: Web Service Development using XML Schema

Posted by Deepal Jayasinghe <de...@opensource.lk>.
I am not 100% sure whether our code generator can generate code from XML
schema since it does not have the binding.  Because, having a schema
simply means a collection of data types. Thus, there should be a way to
associate them (such as WSDL binding). Best approach would be to create
a WSDL and generate code.

On 11/13/2011 6:15 PM, S P wrote:
> I want to generate a web service. What I have at the moment is an XML
> Schema (Person.xsd).
> Using the web service user should able to upload their information as
> described in XML Schema to the Server.
>
> I want to take your advice how can I develop such a web service using
> Axis2.
>
> I have following technologies available:
> Axis2.
> Java.
> Eclipse.
> Code generation Plugin.
> Service Archiver Plugin.
>
> I have just putPerson.xsd at the end of this e-mail.
>
> Regards,
> Peter
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified">
>     <xs:element name="Person">
>         <xs:complexType>
>             <xs:sequence>
>                 <xs:element name="Student">
>                     <xs:complexType>
>                         <xs:sequence>
>                             <xs:element name="FirstName"
> type="xs:string"/>
>                             <xs:element name="DateOfBirth"
> type="xs:date"/>
>                         </xs:sequence>
>                         <xs:attribute name="surname" type="xs:string"/>
>                     </xs:complexType>
>                 </xs:element>
>                 <xs:element name="Employed">
>                     <xs:complexType>
>                         <xs:attribute name="surname" type="xs:string"/>
>                     </xs:complexType>
>                 </xs:element>
>                 <xs:element name="Unemployed">
>                     <xs:complexType>
>                         <xs:attribute name="surname" type="xs:string"/>
>                     </xs:complexType>
>                 </xs:element>
>             </xs:sequence>
>         </xs:complexType>
>     </xs:element>
> </xs:schema> 

-- 
Blog - http://blogs.deepal.org/