0% found this document useful (0 votes)
124 views

Webservice Interview Questions - Day1

The document provides information about key concepts related to web services including: - A web service allows software systems to communicate over the internet and offers an interface for end users. - UDDI (Universal Description Discovery and Integration) provides a directory for web services on the internet. Clients use UDDI to find web services based on their needs. - SOAP (Simple Object Access Protocol) is an XML-based protocol that allows applications to exchange information over HTTP. A SOAP message contains an envelope, header and body. - A SOAP request contains mandatory elements like the envelope, which defines the message as a SOAP request, and optional elements like the header, which contains application-

Uploaded by

saumitra2
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
124 views

Webservice Interview Questions - Day1

The document provides information about key concepts related to web services including: - A web service allows software systems to communicate over the internet and offers an interface for end users. - UDDI (Universal Description Discovery and Integration) provides a directory for web services on the internet. Clients use UDDI to find web services based on their needs. - SOAP (Simple Object Access Protocol) is an XML-based protocol that allows applications to exchange information over HTTP. A SOAP message contains an envelope, header and body. - A SOAP request contains mandatory elements like the envelope, which defines the message as a SOAP request, and optional elements like the header, which contains application-

Uploaded by

saumitra2
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 18

Interview Questions

Day 1
WebServices Topic o UDDI o SOAP o WSDL o JAX-RPC o JAX-WS o JAXB

Define Web Service?


A web service is a kind of sof ware !a is accessib"e on !e In erne # I $akes %se of !e X&L $essa'in' s(s e$ and offers an eas( o %nders and) in erface for !e end %sers#

A Web service is a method of communication between two electronic devices over the World Wide Web. A Web service is a software function provided at a network address over the web or the cloud, it is a service that is "always on" as in the concept of utility computing.

W!a UDDI $eans?


UDDI s ands for Universa") Descri* ion) Discover() and In e'ra ion# I is !e discover( "a(er in !e web services *ro oco" s ack#

+,*"ain in brief) w!a UDDI is?


UDDI -Universa" Descri* ion) Discover() and In e'ra ion. *rovides conso"ida ed direc or( for web services on !e in erne # C"ien s %se UDDI o find web services as *er !eir b%siness needs# I basica""( !os s !e web services fro$ vario%s co$*anies# In order o s!are web services) (o% need o *%b"is! i in UDDI#

SOAP
W!a is SOAP ?
SOAP, originally defined as Simple Object Access Protocol, is a protocol specification for exchanging structured information in the implementation of Web Services in computer networks. It relies on xtensible !arkup "anguage #$!"% for its message format, and usually relies on other Application "ayer protocols, most notably &ypertext 'ransfer (rotocol #&''(% and Simple !ail 'ransfer (rotocol #S!'(%, for message negotiation and transmission.

SOAP s ands for Si$*"e Ob/ec Access Pro oco" SOAP is a si$*"e X&L-based *ro oco" o "e a**"ica ions e,c!an'e infor$a ion over 011P# Soa*) in i s c%rren for$) is a $e !od for RPC -Re$o e Proced%re Ca""s. over a ne work# I is a"so %sed a wa( o ransfer doc%$en s aro%nd as X&L SOAP a""ows (o% o 'e aro%nd firewa""s SOAP is a co$$%nica ion *ro oco" SOAP is for co$$%nica ion be ween a**"ica ions SOAP is a for$a for sendin' $essa'es SOAP is desi'ned o co$$%nica e via In erne SOAP is *"a for$ inde*enden SOAP is "an'%a'e inde*enden SOAP is based on X&L SOAP is si$*"e and e, ensib"e +,a$*"e &essa'e
POST /InStock HTTP/1.1 Host: www.example.org Content-Type: application/soap+xml c!arset"#t$-% Content-&engt!: '(( SO)P)ction: *!ttp://www.w+.org/',,+/,-/soap-en.elope* /0xml .ersion"*1.,*01 /soap:2n.elope xmlns:soap"*!ttp://www.w+.org/',,+/,-/soap-en.elope*1 /soap:Hea3er1 //soap:Hea3er1 /soap:4o3y1 /m:5etStockPrice xmlns:m"*!ttp://www.example.org/stock*1 /m:Stock6ame1I47//m:Stock6ame1 //m:5etStockPrice1 //soap:4o3y1

//soap:2n.elope1

W!a is SOAP2s S(n a, R%"es?


0ere are so$e i$*or an s(n a, r%"es3 4 A SOAP $essa'e &US1 be encoded %sin' X&L 4 A SOAP $essa'e &US1 %se !e SOAP +nve"o*e na$es*ace 4 A SOAP $essa'e &US1 %se !e SOAP +ncodin' na$es*ace 4 A SOAP $essa'e $%s 5O1 con ain a D1D reference 4 A SOAP $essa'e $%s 5O1 con ain X&L Processin' Ins r%c ions Ske"e on SOAP &essa'e 6?,$" version789#:8?; 6soa*3+nve"o*e ,$"ns3soa*78! *3<<www#www#or'<=:9:<9=<soa*-enve"o*e8 soa*3encodin'S ("e78! *3<<www#www#or'<=:9:<9=<soa*-encodin'8; 6soa*30eader; ### 6<soa*30eader; 6soa*3Bod(; ### 6soa*3>a%" ; ### 6<soa*3>a%" ; 6<soa*3Bod(; 6<soa*3+nve"o*e;

W!a is SOAP +nve"o*e?


1!e 011P re?%es bod( con ains !e SOAP re?%es i se"f# 1!is is wra**ed in a SOAP enve"o*e) w!ic! con ains $e ada a i$*or an for %nders andin' !e re?%es # 1!e s r%c %re is as fo""ows3 6SOAP-+5@3+nve"o*e ,$"ns3SOAP-+5@78! *3<<www#www#or'<soa*<enve"o*e<8 SOAP-+5@3encodin'S ("e78! *3<<www#www#or'<soa*<encodin'<8 ; 6A-- SOAP bod( 'oes !ere --; 6<SOAP-+5@3+nve"o*e; 1!e SOAP enve"o*e is in !e X&L na$es*ace *rescribed b( !e s*ecifica ion3 ! *3<<www#www#or'<soa*<enve"o*e<# 1!e enve"o*e $%s s*ecif( !ow o in er*re !e SOAP bod(# 1!is is acco$*"is!ed wi ! !e SOAP-+5@3encodin'S ("e a rib% e# 1!e va"%e is a URI indica in' a s*ecifica ion for !e s r%c %re of !e bod(#

W!a is SOAP +nve"o*e +"e$en ?


1!e SOAP +nve"o*e e"e$en is !e roo e"e$en of a SOAP $essa'e# 1!e re?%ired SOAP +nve"o*e e"e$en is !e roo e"e$en of a SOAP $essa'e# 1!is e"e$en defines !e X&L doc%$en as a SOAP $essa'e# +,a$*"e 6?,$" version789#:8?; 6soa*3+nve"o*e ,$"ns3soa*78! *3<<www#www#or'<=:9:<9=<soa*-enve"o*e8 soa*3encodin'S ("e78! *3<<www#www#or'<=:9:<9=<soa*-encodin'8; ### &essa'e infor$a ion 'oes !ere ### 6<soa*3+nve"o*e;

W!a does SOAP 5a$es*ace defines ?


1!e na$es*ace defines !e +nve"o*e as a SOAP +nve"o*e# If a differen na$es*ace is %sed) !e a**"ica ion 'enera es an error and discards !e $essa'e#

W!ic! Pro oco" is %sed b( Web service and Web service cons%$er o co$$%nica e wi ! eac! o !er ?
SOAP is a X&L based 2$essa'e2 !a a web service c"ien can send o an ac %a" web service -B vice versa.# 1!e reason w!( !is $essa'e is er$ed as a 2*ro oco"2 is beca%se !e X&L se$an ics inside !is $essa'e is based on a we"" know s andard %nders ood b( bo ! !e ac %a"web service B a"" i s c"ien s#

W!a is SOAP 0eader +"e$en


1!e SOAP 0eader e"e$en con ains !eader infor$a ion# 1!e o* iona" SOAP 0eader e"e$en con ains a**"ica ion-s*ecific infor$a ion -"ike a% !en ica ion) *a($en ) e c. abo% !e SOAP $essa'e# If !e 0eader e"e$en is *resen ) i $%s be !e firs c!i"d e"e$en of !e +nve"o*e e"e$en # 5o e3 A"" i$$edia e c!i"d e"e$en s of !e 0eader e"e$en $%s be na$es*ace-?%a"ified# 6?,$" version789#:8?; 6soa*3+nve"o*e ,$"ns3soa*78! *3<<www#www#or'<=:9:<9=<soa*-enve"o*e8 soa*3encodin'S ("e78! *3<<www#www#or'<=:9:<9=<soa*-encodin'8;

6soa*30eader; 6$31rans ,$"ns3$78! *3<<www#www#or'<=:9:<9=< ransac ion<8 soa*3$%s Unders and7898;=CD 6<$31rans; 6<soa*30eader; ### ### 6<soa*3+nve"o*e;

Describe !e SOAP ac or a rib% e?


A SOAP $essa'e $a( rave" fro$ a sender o a receiver b( *assin' differen end*oin s a"on' !e $essa'e *a !# 0owever) no a"" *ar s of a SOAP $essa'e $a( be in ended for !e %" i$a e end*oin ) ins ead) i $a( be in ended for one or $ore of !e end*oin s on !e $essa'e *a !# 1!e SOAP ac or a rib% e is %sed o address !e 0eader e"e$en o a s*ecific end*oin # S(n a, soa*3ac or78URI8 +,a$*"e 6?,$" version789#:8?; 6soa*3+nve"o*e ,$"ns3soa*78! *3<<www#www#or'<=:9:<9=<soa*-enve"o*e8 soa*3encodin'S ("e78! *3<<www#www#or'<=:9:<9=<<soa*-encodin'8; 6soa*30eader; 6$31rans ,$"ns3$78! *3<<www#www#or'<=:9:<9=< ransac ion<8 soa*3ac or78! *3<<www#www#or'<=:9:<9=<a**$"<8;=CD 6<$31rans; 6<soa*30eader; ### ### 6<soa*3+nve"o*e;

Describe !e SOAP $%s Unders and a rib% e?


1!e SOAP $%s Unders and a rib% e can be %sed o indica e w!e !er a !eader en r( is $anda or( or o* iona" for !e reci*ien o *rocess# If (o% add $%s Unders and7898 o a c!i"d e"e$en of !e 0eader e"e$en i indica es !a !e receiver *rocessin' !e 0eader $%s reco'niEe !e e"e$en # If !e receiver does no reco'niEe !e e"e$en i wi"" fai" w!en *rocessin' !e 0eader# S(n a, soa*3$%s Unders and78:F98

+,a$*"e 6?,$" version789#:8?; 6soa*3+nve"o*e ,$"ns3soa*78! *3<<www#www#or'<=:9:<9=<soa*-enve"o*e8 soa*3encodin'S ("e78! *3<<www#www#or'<=:9:<9=<soa*-encodin'8; 6soa*30eader; 6$31rans ,$"ns3$78! *3<<www#www#or'<=:9:<9=< ransac ion<8 soa*3$%s Unders and7898;=CD 6<$31rans; 6<soa*30eader; ### ### 6<soa*3+nve"o*e;

+,*"ain abo% Re$o e ca"" *roced%re?


Re$o e ca"" *roced%re is considered as a ver( i$*or an f%nc ion in SOAP# In RCP a %ser -node. sends a re?%es o ano !er node -server. w!ere !e infor$a ion is *rocesses and sent to the user. It immediately sends message across the network.

An )(* is initiated by the client, which sends a re+uest message to a known remote server to execute a specified procedure with supplied parameters. 'he remote server sends a response to the client, and the application continues its process. While the server is processing the call, the client is blocked #it waits until the server has finished processing before resuming execution%, unless the client sends an asynchronous re+uest to the server, such as an $&''( call. 'here are many variations and subtleties in various implementations, resulting in a variety of different #incompatible% )(* protocols.

W!a is !e SOAP bod(?


1!ere is one $ore "a(er of SOAP e"e$en enc"osin' !e ac %a" e"e$en s of !e s*ecia"iEed even ca"endar re?%es s# 6SOAP-+5@3Bod(; 6A-- User re?%es code !ere --; 6<SOAP-+5@3Bod(; 1!e SOAP bod( c"ear"( $arks !e se*ara ion of SOAP $e ada a and da a#

W!a is SOAP Bod( +"e$en ?


SOAP Bod( e"e$en con ains !e ac %a" SOAP $essa'e in ended for !e %" i$a e end*oin of !e $essa'e# I$$edia e c!i"d e"e$en s of !e SOAP Bod( e"e$en $a( be na$es*ace-?%a"ified#

+,a$*"e 6?,$" version789#:8?; 6soa*3+nve"o*e ,$"ns3soa*78! *3<<www#www#or'<=:9:<9=<soa*-enve"o*e8 soa*3encodin'S ("e78! *3<<www#www#or'<=:9:<9=<soa*-encodin'8; 6soa*3Bod(; 6$3Ge Price ,$"ns3$78! *3<<www#www#or'<=:9:<9=<*rices8; 6$3I e$;A**"es 6<$3Ge Price; 6<soa*3Bod(; 6<soa*3+nve"o*e;

1e"" $e abo% w!a kinds of infor$a ion inc"%ded in SOAP !eader?


0eader of SOAP con ains infor$a ion "ike !a ) 9# In SOAP !eader c"ien s!o%"d !and"e a% !en ica ion and ransac ion# =# 1!e SOAP $essa'e s!o%"d *rocess b( c"ien # C# +ncodin'S ("e is a"so !as in !eader#

0ow (o% e,*"ain >a%" +"e$en of SOAP?


1!e SOAP >a%" e"e$en !o"d errors and s a %s infor$a ion for a SOAP $essa'e# 1!e o* iona" SOAP >a%" e"e$en is %sed o indica e error $essa'es# If a >a%" e"e$en is *resen ) i $%s a**ear as a c!i"d e"e$en of !e Bod( e"e$en # A >a%" e"e$en can on"( a**ear once in a SOAP $essa'e# 1!e SOAP >a%" e"e$en !as !e fo""owin' s%b e"e$en s3 <faultcode> A code for iden if(in' !e fa%" <faultstring> A !%$an readab"e e,*"ana ion of !e fa%" <faultactor> Infor$a ion abo% w!o ca%sed !e fa%" o !a**en <detail> 0o"ds a**"ica ion s*ecific error infor$a ion re"a ed o !e Bod( e"e$en

WSDL
W!a is WSDL?

WSDL is a doc%$en wri en in X&L# 1!e doc%$en describes a Web service# I s*ecifies !e "oca ion of !e service and !e o*era ions -or $e !ods. !e service e,*oses# WSDL s ands for Web Services Descri* ion Lan'%a'e WSDL is wri en in X&L WSDL is an X&L doc%$en WSDL is %sed o describe Web services WSDL is a"so %sed o "oca e Web services WSDL is no (e a WCC s andard

WSDL Por s
1!e e"e$en is !e $os i$*or an WSDL e"e$en # I describes a web service) !e o*era ions !a can be *erfor$ed) and !e $essa'es !a are invo"ved# 1!e e"e$en can be co$*ared o a f%nc ion "ibrar( -or a $od%"e) or a c"ass. in a radi iona" *ro'ra$$in' "an'%a'e#

WSDL &essa'es
1!e e"e$en defines !e da a e"e$en s of an o*era ion# +ac! $essa'e can consis of one or $ore *ar s# 1!e *ar s can be co$*ared o !e *ara$e ers of a f%nc ion ca"" in a radi iona" *ro'ra$$in' "an'%a'e#

WSDL 1(*es
1!e e"e$en defines !e da a (*e !a are %sed b( !e web service# >or $a,i$%$ *"a for$ ne% ra"i () WSDL %ses X&L Sc!e$a s(n a, o define da a (*es#

WSDL Bindin's
1!e e"e$en defines !e $essa'e for$a and *ro oco" de ai"s for eac! *or #

WSDL Por s
1!e e"e$en is !e $os i$*or an WSDL e"e$en # I defines a web service) !e o*era ions !a can be *erfor$ed) and !e $essa'es !a are invo"ved#1!e *or defines !e connec ion *oin o a web service# I can be co$*ared o a f%nc ion "ibrar( -or a $od%"e) or a c"ass. in a radi iona" *ro'ra$$in' "an'%a'e# +ac! o*era ion can be co$*ared o a f%nc ion in a radi iona" *ro'ra$$in' "an'%a'e#

Bindin' o SOAP
1!e bindin' e"e$en !as wo a rib% es - !e na$e a rib% e and !e (*e a rib% e#1!e na$e a rib% e -(o% can %se an( na$e (o% wan . defines !e na$e of !e bindin') and !e (*e a rib% e *oin s o !e *or for !e bindin') in !is case !e 8'"ossar(1er$s8 *or #1!e soa*3bindin' e"e$en !as wo a rib% es - !e s ("e a rib% e and !e rans*or a rib% e#1!e s ("e a rib% e can be 8r*c8 or 8doc%$en 8# In !is case we %se doc%$en # 1!e rans*or a rib% e defines !e SOAP *ro oco" o %se# In !is case we %se 011P#1!e o*era ion e"e$en defines eac! o*era ion !a !e *or e,*oses#>or eac! o*era ion !e corres*ondin' SOAP ac ion !as o be defined# Ho% $%s a"so s*ecif( !ow !e in*% and o% *% are encoded# In !is case we %se 8"i era"8#

/0xml .ersion"*1.,*01 /3e$initions name"*Stock8#ote* target6amespace"*!ttp://example.com/stock9#ote.ws3l* xmlns:tns"*!ttp://example.com/stock9#ote.ws3l* xmlns:xs31"*!ttp://example.com/stock9#ote.xs3* xmlns:soap"*!ttp://sc!emas.xmlsoap.org/ws3l/soap/* xmlns"*!ttp://sc!emas.xmlsoap.org/ws3l/*1 /types1 /sc!ema target6amespace"*!ttp://example.com/stock9#ote.xs3* xmlns"*!ttp://www.w+.org/',,,/1,/:7&Sc!ema*1 /element name"*Tra3ePrice;e9#est*1 /complexType1 /all1 /element name"*tickerSym<ol* type"*string*/1 //all1 //complexType1 //element1 /element name"*Tra3ePrice*1 /complexType1 /all1 /element name"*price* type"*$loat*/1 //all1 //complexType1 //element1 //sc!ema1 //types1 /message name"*5et&astTra3ePriceInp#t*1 /part name"*<o3y* element"*xs31:Tra3ePrice;e9#est*/1 //message1 /message name"*5et&astTra3ePriceO#tp#t*1 /part name"*<o3y* element"*xs31:Tra3ePrice*/1 //message1 /portType name"*Stock8#otePortType*1 /operation name"*5et&astTra3ePrice*1 /inp#t message"*tns:5et&astTra3ePriceInp#t*/1 /o#tp#t message"*tns:5et&astTra3ePriceO#tp#t*/1 //operation1 //portType1 /<in3ing name"*Stock8#oteSoap4in3ing* type"*tns:Stock8#otePortType*1 /soap:<in3ing style"*3oc#ment* transport"*!ttp://sc!emas.xmlsoap.org/soap/!ttp*/1 /operation name"*5et&astTra3ePrice*1 /soap:operation soap)ction"*!ttp://example.com/5et&astTra3ePrice*/1 /inp#t1 /soap:<o3y #se"*literal*/1 //inp#t1 /o#tp#t1 /soap:<o3y #se"*literal*/1 //o#tp#t1 //operation1 //<in3ing1

/ser.ice name"*Stock8#oteSer.ice*1 /3oc#mentation17y $irst ser.ice//3oc#mentation1 /port name"*Stock8#otePort* <in3ing"*tns:Stock8#ote4in3ing*1 /soap:a33ress location"*!ttp://example.com/stock9#ote*/1 //port1 //ser.ice1 //3e$initions1

/0xml .ersion"*1.,* enco3ing"*=T>-%*01 /3escription xmlns"*!ttp://www.w+.org/ns/ws3l* xmlns:tns"*!ttp://www.tmsws.com/ws3l',sample* xmlns:w!ttp"*!ttp://sc!emas.xmlsoap.org/ws3l/!ttp/* xmlns:wsoap"*!ttp://sc!emas.xmlsoap.org/ws3l/soap/* target6amespace"*!ttp://www.tmsws.com/ws3l',sample*1 /?-- )<stract type --1 /types1 /xs:sc!ema xmlns:xs"*!ttp://www.w+.org/',,1/:7&Sc!ema* xmlns"*!ttp://www.tmsws.com/ws3l',sample* target6amespace"*!ttp://www.example.com/ws3l',sample*1 /xs:element name"*re9#est*1 /xs:complexType1 /xs:se9#ence1 /xs:element name"*!ea3er* maxOcc#rs"*#n<o#n3e3*1 /xs:complexType1 /xs:simpleContent1 /xs:extension <ase"*xs:string*1 /xs:attri<#te name"*name* type"*xs:string* #se"*re9#ire3*/1 //xs:extension1 //xs:simpleContent1 //xs:complexType1 //xs:element1 /xs:element name"*<o3y* type"*xs:anyType* minOcc#rs"*,*/1 //xs:se9#ence1 /xs:attri<#te name"*met!o3* type"*xs:string* #se"*re9#ire3*/1 /xs:attri<#te name"*#ri* type"*xs:any=;I* #se"*re9#ire3*/1 //xs:complexType1 //xs:element1 /xs:element name"*response*1 /xs:complexType1 /xs:se9#ence1 /xs:element name"*!ea3er* maxOcc#rs"*#n<o#n3e3*1 /xs:complexType1 /xs:simpleContent1 /xs:extension <ase"*xs:string*1 /xs:attri<#te name"*name* #se"*re9#ire3*/1 //xs:extension1 //xs:simpleContent1 //xs:complexType1 //xs:element1

/xs:element name"*<o3y* type"*xs:anyType* minOcc#rs"*,*/1 //xs:se9#ence1 /xs:attri<#te name"*stat#s-co3e* type"*xs:anySimpleType* #se"*re9#ire3*/1 /xs:attri<#te name"*response-p!rase* #se"*re9#ire3*/1 //xs:complexType1 //xs:element1 //xs:sc!ema1 //types1 /?-- )<stract inter$aces --1 /inter$ace name"*;2ST$#lInter$ace*1 /$a#lt name"*Client2rror* element"*tns:response*/1 /$a#lt name"*Ser.er2rror* element"*tns:response*/1 /$a#lt name"*;e3irection* element"*tns:response*/1 /operation name"*5et* pattern"*!ttp://www.w+.org/ns/ws3l/in-o#t*1 /inp#t message&a<el"*In* element"*tns:re9#est*/1 /o#tp#t message&a<el"*O#t* element"*tns:response*/1 //operation1 /operation name"*Post* pattern"*!ttp://www.w+.org/ns/ws3l/in-o#t*1 /inp#t message&a<el"*In* element"*tns:re9#est*/1 /o#tp#t message&a<el"*O#t* element"*tns:response*/1 //operation1 /operation name"*P#t* pattern"*!ttp://www.w+.org/ns/ws3l/in-o#t*1 /inp#t message&a<el"*In* element"*tns:re9#est*/1 /o#tp#t message&a<el"*O#t* element"*tns:response*/1 //operation1 /operation name"*@elete* pattern"*!ttp://www.w+.org/ns/ws3l/in-o#t*1 /inp#t message&a<el"*In* element"*tns:re9#est*/1 /o#tp#t message&a<el"*O#t* element"*tns:response*/1 //operation1 //inter$ace1 /?-- Concrete 4in3ing O.er HTTP --1 /<in3ing name"*;2ST$#lInter$aceHttp4in3ing* inter$ace"*tns:;2ST$#lInter$ace* type"*!ttp://www.w+.org/ns/ws3l/!ttp*1 /operation re$"*tns:5et* w!ttp:met!o3"*52T*/1 /operation re$"*tns:Post* w!ttp:met!o3"*POST* w!ttp:inp#tSerialiAation"*application/x-www-$orm#rlenco3e3*/1 /operation re$"*tns:P#t* w!ttp:met!o3"*P=T* w!ttp:inp#tSerialiAation"*application/x-www-$orm#rlenco3e3*/1 /operation re$"*tns:@elete* w!ttp:met!o3"*@2&2T2*/1 //<in3ing1 /?-- Concrete 4in3ing wit! SO)P--1 /<in3ing name"*;2ST$#lInter$aceSoap4in3ing* inter$ace"*tns:;2ST$#lInter$ace* type"*!ttp://www.w+.org/ns/ws3l/soap* wsoap:protocol"*!ttp://www.w+.org/',,+/,-/soap/<in3ings/HTTP/* wsoap:mep@e$a#lt"*!ttp://www.w+.org/',,+/,-/soap/mep/re9#estresponse*1 /operation re$"*tns:5et* /1 /operation re$"*tns:Post* /1 /operation re$"*tns:P#t* /1

/operation re$"*tns:@elete* /1 //<in3ing1 /?-- Be< Ser.ice o$$ering en3points $or <ot! <in3ings--1 /ser.ice name"*;2ST$#lSer.ice* inter$ace"*tns:;2ST$#lInter$ace*1 /en3point name"*;2ST$#lSer.iceHttp2n3point* <in3ing"*tns:;2ST$#lInter$aceHttp4in3ing* a33ress"*!ttp://www.example.com/rest/*/1 /en3point name"*;2ST$#lSer.iceSoap2n3point* <in3ing"*tns:;2ST$#lInter$aceSoap4in3ing* a33ress"*!ttp://www.example.com/soap/*/1 //ser.ice1 //3escription1

/3e$initions name"*HelloSer.ice* target6amespace"*!ttp://www.examples.com/ws3l/HelloSer.ice.ws3l* xmlns"*!ttp://sc!emas.xmlsoap.org/ws3l/* xmlns:soap"*!ttp://sc!emas.xmlsoap.org/ws3l/soap/* xmlns:tns"*!ttp://www.examples.com/ws3l/HelloSer.ice.ws3l* xmlns:xs3"*!ttp://www.w+.org/',,1/:7&Sc!ema*1 /message name"*SayHello;e9#est*1 /part name"*$irst6ame* type"*xs3:string*/1 //message1 /message name"*SayHello;esponse*1 /part name"*greeting* type"*xs3:string*/1 //message1 /portType name"*HelloCPortType*1 /operation name"*sayHello*1 /inp#t message"*tns:SayHello;e9#est*/1 /o#tp#t message"*tns:SayHello;esponse*/1 //operation1 //portType1 /<in3ing name"*HelloC4in3ing* type"*tns:HelloCPortType*1 /soap:<in3ing style"*rpc* transport"*!ttp://sc!emas.xmlsoap.org/soap/!ttp*/1 /operation name"*sayHello*1 /soap:operation soap)ction"*sayHello*/1 /inp#t1 /soap:<o3y enco3ingStyle"*!ttp://sc!emas.xmlsoap.org/soap/enco3ing/* namespace"*#rn:examples:!elloser.ice* #se"*enco3e3*/1 //inp#t1 /o#tp#t1 /soap:<o3y enco3ingStyle"*!ttp://sc!emas.xmlsoap.org/soap/enco3ing/* namespace"*#rn:examples:!elloser.ice* #se"*enco3e3*/1 //o#tp#t1 //operation1 //<in3ing1

/ser.ice name"*HelloCSer.ice*1 /3oc#mentation1BS@& >ile $or HelloSer.ice//3oc#mentation1 /port <in3ing"*tns:HelloC4in3ing* name"*HelloCPort*1 /soap:a33ress location"*!ttp://www.examples.com/SayHello/*1 //port1 //ser.ice1 //3e$initions1

JAX-RPC/JAX-WS/JAXB
W!a is JAX-RPC?
JAX-RPC s ands for Java API for X&L-based RPC# I 2s an API for b%i"din' Web services and c"ien s !a %sed re$o e *roced%re ca""s -RPC. and X&L# Of en %sed in a dis rib% ed c"ien <server $ode") an RPC $ec!anis$ enab"es c"ien s o e,ec% e *roced%res on o !er s(s e$s# In JAX-RPC) a re$o e *roced%re ca"" is re*resen ed b( an X&L-based *ro oco" s%c! as SOAP# 1!e SOAP s*ecifica ion defines enve"o*e s r%c %re) encodin' r%"es) and a conven ion for re*resen in' re$o e *roced%re ca""s and res*onses# 1!ese ca""s and res*onses are rans$i ed as SOAP $essa'es over 011P# In !is re"ease) JAX-RPC re"ies on SOAP 9#9 and 011P 9#9#

Java API for XML-based RPC #,A$-)(*% allows a ,ava application to invoke a ,ava-based Web Service with a known description while still being consistent with its WS." description. It can be seen as ,ava )!Is over Web services. ,A$-)(* /.0 was renamed ,A$-WS /.0 #,ava A(I for $!" Web Services%. ,A$-)(* 1 is deprecated with ,ava 2.314 'he ,A$-)(* service utili5es W6* #World Wide Web *onsortium% standards like WS." or Web Service .escription "anguage 3/4 It works as follows7
9# A ,ava program invokes a method on a stub #local ob8ect representing the remote service%

/. 'he stub invokes routines in the ,A$-)(* )untime System #)S%


C# 'he )S converts the remote method invocation into a S9A( message D# 'he )S transmits the message as an &''( re+uest

'he advantage of such a method is that it allows the Web Service to be implemented at serverside as a Servlet or ,: container. 'hus, Servlet or ,: applications are made available through Web services.

W!a is JAX-WS?
JAX-WS =#: is !e s%ccessor of JAX-RPC 9#9 - !e Java API for X&L-based Web services# If *ossib"e) JAX-WS s!o%"d be %sed ins ead as i is based on !e $os recen

ind%s r( s andards# 4 JAX-WS s i"" s%**or s SOAP 9#9 over 011P 9#9) so in ero*erabi"i ( wi"" no be affec ed# 1!e sa$e $essa'es can s i"" f"ow across !e wire# 4 JAX-WS s i"" s%**or s WSDL 9#9) so w!a (o%2ve "earned abo% !a s*ecifica ion is s i"" %sef%"# A WSDL =#: s*ecifica ion is nearin' co$*"e ion) b% i was s i"" in !e works a !e i$e !a JAX-WS =#: was fina"iEed#

W!a is !e difference be ween JAX--WS and JAX-RPC?


Java API for X&L-Based RPC -JAX-RPC. is a Le'ac( Web Services Java API) i %ses SOAP and 011P o do RPCs over !e ne work and enab"es b%i"din' of Web services and Web a**"ica ions based on !e SOAP 9#9 s*ecifica ion) Java S+ 9#D or "ower#JAXWS =#: is !e s%ccessor o JAX-RPC 9#9# JAX-WS s i"" s%**or s SOAP 9#9 over 011P 9#9) so in ero*erabi"i ( wi"" no be affec ed# 0owever !ere are "o s of differences3 JAX-WS $a*s o Java I#: and re"ies on $an( of !e fea %res new in Java I#: "ike Web Service anno a ions# JAX-RPC !as i s own da a $a**in' $ode") JAX-WS2s da a $a**in' $ode" is JAXB# JAXB *ro$ises $a**in's for a"" X&L sc!e$as# JAX-WS in rod%ces $essa'e-orien ed f%nc iona"i () d(na$ic as(nc!rono%s f%nc iona"i ( w!ic! are $issin' in JAX-RPC# JAX-WS a"so add s%**or ) via JAXB) for &1O&) !e new a ac!$en s*ecifica ion#

W!a is JAXB?
X&L and Java ec!no"o'( are reco'niEed as idea" b%i"din' b"ocks for deve"o*in' Web services and a**"ica ions !a access Web services# A new Java API ca""ed Java Arc!i ec %re for X&L Bindin' -JAXB. can $ake i easier o access X&L doc%$en s fro$ a**"ica ions wri en in !e Java *ro'ra$$in' "an'%a'e#

W!a are !e s e*s o Use JAXB?


The general steps to use the JAXB API are: 1. Bind the schema: It requires two steps:

o o

enerate classes !ompile classes

".

#nmarshal It includes the $ollowing steps:

o o o

enerate content tree %alidate &optional' Process the content

(.

)arshal

JAXP is Ja*a API $or X)+ Processing, which pro*ides a plat$orm $or us to Parse the X)+ -iles with the ./) /r 0AX Parsers. 1here as JAXB is Ja*a Architecture $or X)+ Binding, it will make it easier to access X)+ documents $rom applications written in the Ja*a programming language. -or 23ample : !omputer.3ml -ile, i$ we can want to access the data with JAXP, we will 4e per$orming the $ollowing steps 1' !reate a 0AX Parser or ./) Parser and then PArse the data, i$ we use ./), it may 4e memory intensi*e i$ the document is too 4ig. 0uppose i$ we use 0AX parser, we need to identi$y the 4eginning o$ the document. 1hen it encounters something signi$icant &in 0AX terms, an 5e*ent5' such as the start o$ an X)+ tag, or the te3t inside o$ a tag, it makes that data a*aila4le to the calling application. Then !reate a content handler that de$ines the methods to 4e noti$ied 4y the parser when it encounters an e*ent. These methods, known as call4ack methods, take the appropriate action on the data they recei*e. The Same Operations if it is performed by JAXB, the following steps needs to be performed to access the Computer. ml

1. ".

Bind the schema $or the X)+ document.

#nmarshal the document into Ja*a content o46ects. The Ja*a content o46ects represent the content and organi7ation o$ the X)+ document, and are directly a*aila4le to your program. A$ter unmarshalling, your program can access and display the data in the X)+ document simply 4y accessing the data in the Ja*a content o46ects and then displaying it. There is no need to create and use a parser and no need to write a content handler with call4ack methods. 1hat this means is that de*elopers can access and process X)+ data without ha*ing to know X)+ or X)+ processing

You might also like