• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Consuming SOAP

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, guys!

I'm having a problem right now that is burning what is lack of my brain. I'm trying call a method in a wsdl file which is located in another server. I don't have access to this server nor I know which tecnology they used to create the wsdl file. What I need to do is to call this method and use its return value (a single string) to create a windows media object.

My first thought was on coding it using AJAX, but I wasn't successful. I skimmed through many tutorials, but not a single one helped me. By reading, a found that - maybe - there is a security issue with using javascript which prevents me to access external wsdl files. Is that correct?

is there any solution to that? Do I have to install/learn/implement this solution using Axis? For the time being, I don't want to feed any webservice information, just to consume it.

Many thanks in advance,

Fabio
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you have the terminology (and maybe technology) mixed up. A WSDL file describes a Web Service - it is not generally used for accessing it.
It is possible to consume a WS in JavaScript using the XmlHttpRequest object; check the Web Services FAQ for links to a couple of introductory articles that help in doing this.
[ February 08, 2006: Message edited by: Ulf Dittmer ]
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Be sure to visit the Web service FAQ to find clarification.


I'm trying call a method in a wsdl file which is located in another server.


You don't call a method in a WSDL file. The WSDL (Web Services Description Langauge) merely describes the Web Service. If the WSDL is complete you will find the URL of the web service in the port element.

I don't have access to this server


It�s going to be "difficult" to call the service if you don�t have "access" to the server.

nor I know which tecnology they used to create the wsdl file.


That shouldn�t matter.

What I need to do is to call this method and use its return value (a single string) to create a windows media object.

My first thought was on coding it using AJAX, but I wasn't successful. I skimmed through many tutorials, but not a single one helped me. By reading, a found that - maybe - there is a security issue with using javascript which prevents me to access external wsdl files. Is that correct?


I presume in AJAX you would HTTP-POST a SOAP message structured to the specifications of the WSDL to the URL specified in the WSDL.
But again, if you don�t have access to the server, AJAX can�t help you.

Do I have to install/learn/implement this solution using Axis?


If you don�t have access to the server/web service you are going to have to create a mock web service to test against. That mock web service has to expose the interface as specified by the WSDL. You can use Tomcat/Axis, ASP.NET or whatever to do that. Your chosen framework will usually have a tool that can generate server stubs from a WSDL � however you will still have to code the service to return the results you want.

For the time being, I don't want to feed any webservice information, just to consume it.


As long as you don�t have access to a service that matches the interface specified by the WSDL you will have create you own stripped down version.
 
Fabio Fonseca
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks guys for the promptly replies!

I got it working with ajax, but I don't know if it would be useful. Anyway, I will share with others what I discovered. Maybe someone is trying to implemente something like that and is having problems.

First thing, I got this XML tool called Stylus Studio to check if everything was ok with the WSDL file in the other server. From the Stylus Studio I was able to send an envelope to the method I should call, with the arguments required. From there I got an example of the envelope I should send in order to receive the return value of the method.

Ok, then I plugged the envelope code in the XMLHttpRequest using setRequestHeader and send methods.

Example:



Ok, it works alright. But there's still the security problems with the browsers. The user will receive that dreadful security warning every now and then (Good discussion about this subject I found in the book AJAX in Action) . Dunno if my company will accept that.

So.. I'm gonna to play with this little thing I found yesterday:

SOAP taglib ver. 1.5
http://www.servletsuite.com/servlets/soaptag.htm

Let's see what happens.

[ February 09, 2006: Message edited by: Fabio Fonseca ]
[ February 09, 2006: Message edited by: Fabio Fonseca ]
 
Fabio Fonseca
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


SOAP taglib ver. 1.5
http://www.servletsuite.com/servlets/soaptag.htm



For the unknown greenhorn that will someday end up here, the taglib above worked all right. It allowed me to send my SOAP envelope and get the replie right on my jsp. But that wasn't the final solution. I used jsp as a proxy to get the SOAP response and then used AJAX to parse and use it. Just remember to make your jsp content XML using
 
If you are using a rototiller, you are doing it wrong. Even on this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic