Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Calling Soap (JAX-WS) as http get request  RSS feed

 
Omar Nassar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
How to call a SOAP web service as http get using apache CXF.
please note that we do not need to expose that service as RESTful service.

ex:
http://localhost:8080/hr/Employees?wsdl ------------> this will call WSDL file

http://localhost:8080/hr/Employees/getAnyThing?id=123 ------------> this will call the method with param id = 123

this is done in one of our projects but we do not know how it is done for some reason, so any ideas on that please..
 
Claude Moore
Ranch Hand
Posts: 862
8
IBM DB2 Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mmm, I used to use Apache CXF as JAX-WS framework for exposing web services. For client, I think that using wsimport to generate client-side artifacts should be enough.
 
Omar Nassar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have red alot that says you can not access SOAP ws throw web browser request.
but surprisingly one of our projects can be accessed throw browser using http get request and returns a result as xml.

howwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww???!!!???
 
Claude Moore
Ranch Hand
Posts: 862
8
IBM DB2 Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but surprisingly one of our projects can be accessed throw browser using http get request and returns a result as xml

That's normal, since all SOAP responses are actually XML documents.
 
Omar Nassar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok I know, but we can call one of the service methods and pass it a value for parameter, like we are using rest ws

http://localhost:8080/WS/servic/method?id=123
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, an URL entered into the browser (like for REST) is not sufficient, because the SOAP request is transported in the HTTP body - and only POST requests have a body, not GET requests. And GET is what the browser address bar sends.

If you want to do use SOAP from within a browser, you need to use JavaScript. That's one of the reasons REST is so popular in web apps.
 
Omar Nassar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but that what i am facing.
cxf-beans.xml file contains jax-ws's but no one is jax-rs.
and the source does not contain any annotation for jax-rs & no java script exist just beans.
after all of that is it accessible throw browser using http get requst
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm sure you'll find JavaScript SOAP libraries if you search for them. They're probably not for the faint of heart, though. And again, GET is not an option for interacting with a SOAP WS. If GET is so important to you, why don't you rewrite the WS to have a REST interface as well?

http://cxf.apache.org/docs/javascript-clients.html (found by searching for "javascript soap library") seems extremely relevant to your situation.
 
Omar Nassar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for Interruption,

I searched for "envelop" and found that cxf-2.5.0 has cxf-utils.js Java script file that contain alot of functions.
maybe these functions that do the work for get requets, but how it is used with the project.
it is just added into the lib folder.
 
Omar Nassar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for you all
we solved the problem by using the cxf version 2.5 jar file, then we could call the soap web service from the url like it was Restful webservice.
thanks for your help.
 
Claude Moore
Ranch Hand
Posts: 862
8
IBM DB2 Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad you managed it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!