aspose file tools*
The moose likes Spring and the fly likes JAR files / Maven structure for Spring xsdtojava convertion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "JAR files / Maven structure for Spring xsdtojava convertion" Watch "JAR files / Maven structure for Spring xsdtojava convertion" New topic
Forums: Java in General Spring
Author

JAR files / Maven structure for Spring xsdtojava convertion

Pardha Reddy
Greenhorn

Joined: Mar 11, 2010
Posts: 17
Hello

I need to consume the restful service using spring. I have an xsd file. I need the right spring jar file(groupId / artifact Id) to convert from xsd to java. Please let me know if need any other jar files that i need to place in maven structure related to spring.

Thanks
Pardha
Jayesh A Lalwani
Bartender

Joined: Jan 17, 2008
Posts: 2448
    
  28

DO you mean you want to use JAXB? JAXB is part of core java, and you don;t need additional jars
Pardha Reddy
Greenhorn

Joined: Mar 11, 2010
Posts: 17
My requirement is to use spring framework to call a rest service. For that i have a xsd. I need to generte xsdtojava using spring restful service. I need to create a maven dependency for that. I am looking for the right jar(groupId / Artifact Id) file to add in maven. The reason i need to use that is i have some HTTP GET request and basic http authentication etc and want to go with spring as per the project standard.
Jayesh A Lalwani
Bartender

Joined: Jan 17, 2008
Posts: 2448
    
  28

You need JAX-WS as shown here You need to add dependency to spring-web

Are you using spring bill of materials (spring-bom) in your project? If you do, all you need to do is add


Otherwise you will have to find out which spring-web is compatible with your spring version.
H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 471
    
    4
In addition to what has been said.

Use org.springframework.web.client.RestTemplate;

Link for spring 4.x
http://docs.spring.io/spring/docs/current/spring-framework-reference/pdf/spring-framework-reference.pdf

Read
21.10 Accessing RESTful services on the Client
Pardha Reddy
Greenhorn

Joined: Mar 11, 2010
Posts: 17
Thank you Jayesh and Paul. This helped me to move forward.
Pardha Reddy
Greenhorn

Joined: Mar 11, 2010
Posts: 17
I have one more question in addition to this. I used the RestTemplate.getForObject for restful service call. But i need to use HTTP basic authentication (RFC 2617). Is it possible with RestTemplate. I saw some method named RestTemplate.exchange. Please suggest.
H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 471
    
    4



Yes. Either you:

A. config basic auth at httpClient when you create RestTemplate
I have not set up this. But you can. Just Google or check Apache HttpClient

B. add basic header to Request header: I did a quick test and worked for me.

Pardha Reddy
Greenhorn

Joined: Mar 11, 2010
Posts: 17
Awesome. This helped me to build the code. I made just few changes as per the libraries i am using and in my case response is XML.

Thanks a lot for providing such a simple code.
Pardha Reddy
Greenhorn

Joined: Mar 11, 2010
Posts: 17
I am facing some issue in the code at line Base64.getEncoder().encodeToString("tomcat:tomcat".getBytes()); in run time.

As i am using 1.6.x cersion of jdk, i used Base64.encode("tomcat:tomcat"); The base64 that i am using is from org.apache.xmlbeans.impl.util.Base64.

This is giving exception during runtime. This is not going to any exception or so. But as per the logs it is breaking at this line.
No compilation issues, no issues while testing from junit. Issue only at runtime.

I saw couple of online forums that this is an issue but didn't find the solution.

What third party package supports this now for jdk1.6.x version.

Thanks

H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 471
    
    4
(This is how I do: Google for java encode base64)


1. Base64 is since jdk 1.8

2. For jdk 1.6, Use javax.xml.bind.DatatypeConverter.printBase64Binary method
(parseBase64Binary)

from this url http://java-performance.info/base64-encoding-and-decoding-performance/
1. Read: JDK Base64 implementations
2. Read: Third party Base64 implementations

Good luck.
Pardha Reddy
Greenhorn

Joined: Mar 11, 2010
Posts: 17
Little late in reply. That worked with org.apache.xerces.impl.dv.util.Base64.

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JAR files / Maven structure for Spring xsdtojava convertion