{"id":19827331,"url":"https://github.com/sandysanthosh/springboot-jaxb","last_synced_at":"2026-06-09T06:31:08.526Z","repository":{"id":107709169,"uuid":"143190585","full_name":"sandysanthosh/SpringBoot-JAXB","owner":"sandysanthosh","description":"Java to xml binding","archived":false,"fork":false,"pushed_at":"2022-09-28T05:34:36.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-28T20:57:11.639Z","etag":null,"topics":["java","jaxb","xml"],"latest_commit_sha":null,"homepage":"https://sandysanthosh.github.io/SpringBoot-JAXB/","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sandysanthosh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-01T17:59:48.000Z","updated_at":"2022-09-28T05:22:49.000Z","dependencies_parsed_at":"2023-06-08T20:00:24.805Z","dependency_job_id":null,"html_url":"https://github.com/sandysanthosh/SpringBoot-JAXB","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sandysanthosh/SpringBoot-JAXB","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandysanthosh%2FSpringBoot-JAXB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandysanthosh%2FSpringBoot-JAXB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandysanthosh%2FSpringBoot-JAXB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandysanthosh%2FSpringBoot-JAXB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sandysanthosh","download_url":"https://codeload.github.com/sandysanthosh/SpringBoot-JAXB/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandysanthosh%2FSpringBoot-JAXB/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34095242,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","jaxb","xml"],"created_at":"2024-11-12T11:13:03.443Z","updated_at":"2026-06-09T06:31:08.522Z","avatar_url":"https://github.com/sandysanthosh.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# JAVA-JAXB\n\nJava to xml binding\n\n\njaxb\n\n```\n//Without name attribute\n@XmlRootElement             //1\n \n//With name attribute         \n@XmlRootElement(name = \"employee\")                //2\n\n```\n\n#### @XmlRootElement with ‘name’ attribute:\n\n\n```\n@XmlRootElement(name = \"employee\")\npublic class Employee implements Serializable \n{\n  @XmlElement(name=employeeId)\n  private Integer id;\n \n  @XmlElement\n  private String firstName;\n \n  private String lastName;\n  private Department department;\n}\n```\n\n#### Above converts to:\n\n```\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cemployee\u003e\n  \u003cemployeeId\u003e1\u003c/employeeId\u003e\n    \u003cfirstName\u003eLokesh\u003c/firstName\u003e\n\u003c/employee\u003e\n\n```\n\n\n#### @XmlRootElement with ‘name’ attribute with JSON attribute:\n\n```\n@XmlRootElement(name = \"employee\")\npublic class Employee implements Serializable \n{\n  @XmlElement(name=\"id\")\n  @JonProperty(\"id\")\n  private Integer id;\n \n  @XmlElement(name=\"firstName\")\n  @JonProperty(\"firstName\")\n  private String firstName;\n  \n  @XmlElement(name=\"lastName\")\n  @JonProperty(\"lastName\")\n  private String lastName;\n  \n  @XmlElement(name=\"department\")\n  @JonProperty(\"department\")\n  private Department department;\n}\n```\n\n\n\n#### Maven plugin:\n\n\t\u003cdependency\u003e\n\t\u003cgroupId\u003ewsdl4j\u003c/groupId\u003e\n\t\u003cartifactId\u003ewsdl4j\u003c/artifactId\u003e\n\t\u003c/dependency\u003e\n\n       \u003cgroupId\u003eorg.codehaus.mojo\u003c/groupId\u003e\n       \u003cartifactId\u003ejaxb2-maven-plugin\u003c/artifactId\u003e\n        \u003cversion\u003e1.6\u003c/version\u003e\n                  \n#### Student POJO:\n\n        public class Student {\n          private Long id;\n          private String name;\n          private String passportNumber;\n          }\n          \n#### Endpoint:\n\n\n    @Endpoint\n     public class StudentDetailsEndpoint {\n\n      @PayloadRoot(namespace = \"http://in28minutes.com/students\", localPart = \"GetStudentDetailsRequest\")\n       @ResponsePayload\n        public GetStudentDetailsResponse processCourseDetailsRequest(@RequestPayload GetStudentDetailsRequest request) {\n              GetStudentDetailsResponse response = new GetStudentDetailsResponse();\n\n              StudentDetails studentDetails = new StudentDetails();\n              studentDetails.setId(request.getId());\n              studentDetails.setName(\"Adam\");\n              studentDetails.setPassportNumber(\"E1234567\");\n\n              response.setStudentDetails(studentDetails);\n\n              return response;\n            }\n          }\n\t  \n          \n#### WebServiceConfig:\n\n      @EnableWs\n      @Configuration\n      public class WebServiceConfig {\n\n        @Bean\n        public ServletRegistrationBean messageDispatcherServlet(ApplicationContext context) {\n          MessageDispatcherServlet messageDispatcherServlet = new MessageDispatcherServlet();\n          messageDispatcherServlet.setApplicationContext(context);\n          messageDispatcherServlet.setTransformWsdlLocations(true);\n          return new ServletRegistrationBean(messageDispatcherServlet, \"/ws/*\");\n        }\n\n        @Bean(name = \"students\")\n        public DefaultWsdl11Definition defaultWsdl11Definition(XsdSchema studentsSchema) {\n          DefaultWsdl11Definition definition = new DefaultWsdl11Definition();\n          definition.setPortTypeName(\"StudentPort\");\n          definition.setTargetNamespace(\"http://in28minutes.com/students\");\n          definition.setLocationUri(\"/ws\");\n          definition.setSchema(studentsSchema);\n          return definition;\n        }\n\n        @Bean\n        public XsdSchema studentsSchema() {\n          return new SimpleXsdSchema(new ClassPathResource(\"student-details.xsd\"));\n        }\n      }\n  \n  \n#### /src/main/resources/student-details.xsd\n\n\n        \u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\n      \u003cxs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" \n      targetNamespace=\"http://in28minutes.com/students\" \n      xmlns:tns=\"http://in28minutes.com/students\" elementFormDefault=\"qualified\"\u003e\n\n        \u003cxs:element name=\"GetStudentDetailsRequest\"\u003e\n          \u003cxs:complexType\u003e\n            \u003cxs:sequence\u003e\n              \u003cxs:element name= \"id\" type=\"xs:int\"/\u003e\n            \u003c/xs:sequence\u003e\t\n          \u003c/xs:complexType\u003e\n        \u003c/xs:element\u003e\n\n        \u003cxs:element name=\"GetStudentDetailsResponse\"\u003e\n          \u003cxs:complexType\u003e\n            \u003cxs:sequence\u003e\n              \u003cxs:element name= \"StudentDetails\" type=\"tns:StudentDetails\"/\u003e\n            \u003c/xs:sequence\u003e\t\n          \u003c/xs:complexType\u003e\n        \u003c/xs:element\u003e\n\n        \u003cxs:complexType name=\"StudentDetails\"\u003e\n          \u003cxs:sequence\u003e\n            \u003cxs:element name=\"id\" type=\"xs:int\"/\u003e\n            \u003cxs:element name=\"name\" type=\"xs:string\"/\u003e\n            \u003cxs:element name=\"passportNumber\" type=\"xs:string\"/\u003e\n          \u003c/xs:sequence\u003e\n        \u003c/xs:complexType\u003e\n    \u003c/xs:schema\u003e\n\t\n  \n  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsandysanthosh%2Fspringboot-jaxb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsandysanthosh%2Fspringboot-jaxb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsandysanthosh%2Fspringboot-jaxb/lists"}