3

I want to call a SOAP service using REST service. Can anybody please share some example programme or snippets where we can invoke a soap service using JAX-RS(Jersey) written REST service. I am using jdk 1.7 & eclipse juno. What will we be using to refer to the soap service? Please note that I am entirely new to webservice, so examples will be a huge help!

5
  • It looks like you're trying to mail a holiday card by just shouting someone's name, which you can't do. Likewise, you can't call a SOAP service by using a REST service. What you can do, is manually invoke the Web Service by using Java's Dispatch API (Google it). Commented Sep 30, 2014 at 13:06
  • I didnt know anything about this but i found an answer saying it is just a normal thing to do at this link stackoverflow.com/questions/17986498/calling-soap-in-jersey Is this answer wrong or my understandin?? – @Davio Commented Oct 1, 2014 at 5:35
  • You can do it, but they're different things. You can do whatever you like from the point where your REST service is called. You could connect to a database, create an infinite while loop, it's your party! Commented Oct 1, 2014 at 7:10
  • So you are saying your first comment is not right? i am having a hard time understanding the difference of wrapping SOAP with REST and Calling SOAP with REST. Can you please explain with an example? @ Davio Commented Oct 1, 2014 at 9:33
  • Well, you can create a Java class to respond to SOAP calls and another to respond to REST calls. I thought you were trying to write a REST client to invoke a SOAP service, which is nonsense, you must use a SOAP client for this. It's okay if you want to call a SOAP service from your own REST listener, but you must use a SOAP client, like Java's Dispatch API. Commented Oct 1, 2014 at 14:26

2 Answers 2

4

You cannot use a REST service framework to access a SOAP Web-Service. This are two completely different technologies.

It's like you're asking how to drive with a locomotive on a motorway...

Sign up to request clarification or add additional context in comments.

7 Comments

I didnt know anything about this but i found an answer saying it is just a normal thing to do at this link stackoverflow.com/questions/17986498/calling-soap-in-jersey Is this answer wrong or my understandin?? @Uwe Plonus
@RBz Perhaps you question is not clear. If you want to wrap a SOAP service with a REST Service then this is possible as described in the answer mentioned. If you want to call a SOAP Service using a REST service then this is simple impossible.
Can you please define what we mean by wrapping? Please forgive my ignorence, i dont understand how both are different. @Uwe Plonus
@RBz Wrapping means that you create a REST service and call a SOAP service out of the newly created REST service. Calling means that you create a REST service and want to call a SOAP service with this.
@RBz to explain it with pseudo code: Using MyService extends RESTClient to access a SOAP service does not work (Calling). Using MyService extends RESTService and handle() { call SOAPService } will work as you create a new web service that is a REST service and call from this new service a SOAP web service (Wrapping).
|
4

You can call the SOAP service using restful API. In SOAP the xml is built dynamically. You can built the soap request XML in your program and call the SOAP URI with this xml as string parameter.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.