Create Aw Sdl From Scratch

download Create Aw Sdl From Scratch

of 14

Transcript of Create Aw Sdl From Scratch

  • 8/12/2019 Create Aw Sdl From Scratch

    1/14

    Aim

    Creating a XSD and WSDL from scratch.

    We want to create a WSDL file that defines an operation called CreateStudent.CreateStudent should be a request response operation and should take aStudent object as input and return the Student ID as output. Student objectstores the student name and marks

    Solution

    his code is a!ailable under the accompan"ing #ip file Project1.zip .

    Create a $eneric project

    %ight click the &roject'( and select )ew. Select *ll Items. hen enter WSDL inthe top left search bo+. It will show the following items.

    Cop"right http,--soatraining.hpage.com

  • 8/12/2019 Create Aw Sdl From Scratch

    2/14

    Select WSDL Document Web Ser!ices/

    Cop"right http,--soatraining.hpage.com

  • 8/12/2019 Create Aw Sdl From Scratch

    3/14

    It opens a wi#ard dialog. 0nter the !alue as followsWSDL Name , StudentDirectory Name , %emo!e public1html-web1inf etc. &lace the WSDL directl"under the project file.Target Namespace , 2suall" we gi!e some 2%L here. So enter

    http,--soatraining.hpage.com-StudentCreate Port Type Check o! , Check itName , &rocessStudentSer"ice Style , Document default/

    &ress 34. It opens the WSDL document in design !iew.

    0+pand messages b" clicking on 5

    Cop"right http,--soatraining.hpage.com

  • 8/12/2019 Create Aw Sdl From Scratch

    4/14

  • 8/12/2019 Create Aw Sdl From Scratch

    5/14

    )ow( we need to define the structure of Student element. *s of now( the in partis defined as +sd,an"( while we would like to ha!e a student element here.

    We would create the student definition in a separate +sd( and then import that+sd in this wsdl document.

    Creation o' (SD

    XSDs can be created in man" wa"s.'. Creating XSD from a gi!en X7L document8. Creating the XSD from scratch.

    We e+plore the first one.

  • 8/12/2019 Create Aw Sdl From Scratch

    6/14

    he +ml file is added to the project

    Cop"right http,--soatraining.hpage.com

  • 8/12/2019 Create Aw Sdl From Scratch

    7/14

  • 8/12/2019 Create Aw Sdl From Scratch

    8/14

    Target Namespace , http,--soatraining.hpage.com-Student-t"pes(%L Document) *ro#se , Select the sample +ml file

    &ress 34.

    In source mode

    Cop"right http,--soatraining.hpage.com

    http://soatraining.hpage.com/Student/typeshttp://soatraining.hpage.com/Student/types
  • 8/12/2019 Create Aw Sdl From Scratch

    9/14

  • 8/12/2019 Create Aw Sdl From Scratch

    10/14

    In the source code things look like this

    Eack to the schema tab(

    '. remo!e the namespace definition in the >schema=

    8. From propert" inspector( select default for the elementFormDefault

    9. Select the import node and enter the following !alues in the &ropert" inspector Select the ne+t to the schemaLocation = Select 0dit

    Cop"right http,--soatraining.hpage.com

  • 8/12/2019 Create Aw Sdl From Scratch

    11/14

    Erowse to select Student.+sd

    0nter the following !alue in the namespacehttp,--soatraining.hpage.com-Student-t"pes

    he schema looks as follows on the Schema tab

    Cop"right http,--soatraining.hpage.com

    http://soatraining.hpage.com/Student/typeshttp://soatraining.hpage.com/Student/types
  • 8/12/2019 Create Aw Sdl From Scratch

    12/14

    In source tab( itGs as follows( after all modifications

    )ow( we want to change the Student7essage so that it takes a Student as input.his can be done from the design !iew. Select the part- xsd-any in and modif"the element from the propert" inspector( choosing Student .

    he message part gets modified( but

  • 8/12/2019 Create Aw Sdl From Scratch

    13/14

    his is coming because Student is in a different namespacehttp,--soatraining.hpage.com-Student-t"pes / than this WSDL documentGs

    target)amespace http,--soatraining.hpage.com-Student /. So the WSDL cannotfind this element.

    We need to create an alias for http,--soatraining.hpage.com-Student-t"pes andthen use it to qualif" Student

    *dd an alias named client to the definitions as shown

    )ow modif" the part as follows. "pe Hclient, in front of Student. It will show apopup. Jou can select the client,Student.

    he return is a simple string. So we can use the string datat"pe from XSDstandard.7odif" the part name return as follows

    )ote( we ha!e used type ( instead of element here.

    Cop"right http,--soatraining.hpage.com

    http://soatraining.hpage.com/Student/typeshttp://soatraining.hpage.com/Studenthttp://soatraining.hpage.com/Student/typeshttp://soatraining.hpage.com/Student/typeshttp://soatraining.hpage.com/Studenthttp://soatraining.hpage.com/Student/types
  • 8/12/2019 Create Aw Sdl From Scratch

    14/14

    This completes the +e'inition o' the WSDL . )ote( this WSDL is called*bstract WSDL as it does not "et ha!e bindings and ser!ice elements. heseget usuall" added b" the tools such as jde!eloper/ during compilation.

    Cop"right http,--soatraining.hpage.com