Soap envbody xmlnsns2 httpin28mi ns2course ns2id 1

Info icon This preview shows pages 236–257. Sign up to view the full content.

<SOAP-ENV:Body> <ns2:getCourseDetailsResponse xmlns:ns2 = " <ns2:course> <ns2:id> 1 </ns2:id> <ns2:name> Spring </ns2:name> <ns2:description> 10 Steps </ns2:description> </ns2:course> </ns2:getCourseDetailsResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
Image of page 236

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

SOAP Header <Envelope xmlns = " " > <Header> <wsse:Security xmlns:wsse = " mustUnderstand = "1" > <wsse:UsernameToken> <wsse:Username> user </wsse:Username> <wsse:Password> password </wsse:Password> </wsse:UsernameToken> </wsse:Security> </Header> <Body> <GetCourseDetailsRequest xmlns = " <id> 1 </id> </GetCourseDetailsRequest> </Body>
Image of page 237
Questions What is WSDL (Web Service Definition Language)? What are the different parts of a WSDL?
Image of page 238

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

WSDL Web Service Definition Language
Image of page 239
Image of page 240

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Image of page 241
Questions What is Contract First Approach? What is an XSD? Can you give an example of an XSD?
Image of page 242

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Contract Service Definition specifying Format of Request Format of Response Request/Response Structure Transport used Endpoint details
Image of page 243
Contract First We define a contract first! With Spring Web Services, we define an XSD first
Image of page 244

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

XSD XML Specification Document! How does a valid XML Look like?
Image of page 245
Request XML <GetCourseDetailsRequest xmlns = " <id> 1 </id> </GetCourseDetailsRequest>
Image of page 246

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

XSD <xs:element name = "GetCourseDetailsRequest" > <xs:complexType> <xs:sequence> <xs:element name = "id" type = "xs:int" /> </xs:sequence> </xs:complexType> </xs:element>
Image of page 247
Response XML <ns2:GetCourseDetailsResponse xmlns:ns2 = " <ns2:CourseDetails> <ns2:id> 1 </ns2:id> <ns2:name> Spring </ns2:name> <ns2:description> 10 Steps </ns2:description> </ns2:CourseDetails> </ns2:GetCourseDetailsResponse>
Image of page 248

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

XSD <xs:element name = "GetCourseDetailsResponse" > <xs:complexType> <xs:sequence> <xs:element name = "CourseDetails" type = "tns:CourseDetails </xs:sequence> </xs:complexType> </xs:element>
Image of page 249
XSD <xs:complexType name = "CourseDetails" > <xs:sequence> <xs:element name = "id" type = "xs:int" /> <xs:element name = "name" type = "xs:string" /> <xs:element name = "description" type = "xs:string" /> </xs:sequence> </xs:complexType>
Image of page 250

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Questions What is JAXB? How do you configure a JAXB Plugin?
Image of page 251
Convert from Java to SOAP XML
Image of page 252

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

JAXB Plugin <plugin> <groupId> org.codehaus.mojo </groupId> <artifactId> jaxb2-maven-plugin </artifactId> <version> 1.6 </version> <executions> <execution> <id> xjc </id> <goals> <goal> xjc </goal> </goals> </execution> </executions> <configuration> <schemaDirectory> ${project.basedir}/src/main/resources </sc <outputDirectory> ${project.basedir}/src/main/java </outputD <clearOutputDir> false </clearOutputDir>
Image of page 253
Questions What is an Endpoint? Can you show an example endpoint written with Spring Web Services?
Image of page 254

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Endpoint @PayloadRoot (namespace = " " , localPart = "GetCourseDetailsRequest" ) @ResponsePayload public GetCourseDetailsResponse processCourseDetailsRequest (@RequestPayload GetCourseDetailsRequest request) { Course course = service.findById(request.getId()); if (course == null ) throw new CourseNotFoundException( "Invalid Course Id " + r return mapCourseDetails(course); }
Image of page 255
This is the end of the preview. Sign up to access the rest of the document.
  • Spring '18
  • LN Rao
  • public class, Spring Framework, Spring Boot, Spring Security

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern