• 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

creating web service client

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
am finding it difficult to create a client for a web service created in coldfusion. I know the language in which the web service was implemented doesnt really matter.

Can anyone please show me the steps of creating the client from how to generate the artifacts using wsimport to using the artifacts to communicate with the service.

Thank you in anticipation.....
 
hangman
Posts: 220
Angular Framework Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Abayomi;

There are quite a few different ways to do this. Please check out the "wsimport" options. As long as you have your Java 1.6 $JAVA_HOME/bin in your $PATH environment variable, just type
"wsimport" from your command prompt (I think it is %JAVA_HOME%\bin in your %PATH% in Windows). If you do not have JDK 1.6, then wsimport should be in the bin directory in your jaxws-ri or glassfish3/glassfish directory, depending on how you are learning java web services.

If the cold fusion service that you are talking about is up and running and working as a real SOAP Web Service, then there should be a navigable WSDL you can see in your browser somehow ( http://localhost:8080/mycoldfusionservice?wsdl or something like that) that describes the operations, ports, messages, etc., of your service.

Once you know what it is, just create two folders, "src" and "bin", then say:
wsimport -keep -s src -d bin http://localhost:8080/mycoldfusionservice?wsdl (you might need to try this a few times using the -p option with the right package name before you actually get what you need).

Once this works, you have nearly everything you need for your client, but your class with the main method. You have to build that yourself, using a few lines of code that create an instance of the generated ?*Service.java class that wsimport gave you, then call its "get?Port()" method. See http://www.javadb.com/create-a-web-service-client-with-jax-ws for an example of how to do this.

I hope this helps.
 
Ranch Hand
Posts: 59
Hibernate Redhat Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Coldfusion does it all for you.
All you need is something like:

Then just call your method with something like:
myResponse = myWS.someMethod(someRequestObject)

That's it.

The only tricky part is:
You need to make sure that you populate your request object "exactly" as described in the WSDL.
Or else you will get an error that says your method signature does not match.

The response object is automagically created for you by CF.

Coldfusion also has another way to create a webservice client also by using the <cfinvoke> tag.
Google it, but it goes something like:


Some other stuff that may be helpful:
CF7 uses Apache Axis-1.
CF8 & 9 use Apache Axis-2.

Just Google something like:

There are tons of examples.

Good Luck.
 
Rick Roberts
Ranch Hand
Posts: 59
Hibernate Redhat Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
O.K. I just re-read your question.
Now I interpret it to mean that you are trying to consume a Coldfusion Web Service.
My post was all about how to consume one using a Coldfusion client.

Give me a bit to collect my thoughts and I will follow up with some "Java client" related ramblings.

Apologies.
 
Rick Roberts
Ranch Hand
Posts: 59
Hibernate Redhat Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Alright. Don't hate on me if this is not perfect. Wife has me Bar-B-Que'ing, so in a rush.

Assuming these 2 Interfaces, 1 Local and 1 Remote:

MyWebServiceLocal.java:


MyWebServiceRemote.java:



Also assuming this webservice:


This client code should work:




You may also need a jndi.properties file that has a line something like:
java.naming.provider.url=localhost:1099

Google it for details.


This may not be exactly complete, but it should get you on the right path.

Bar-B-Que is calling.
Good Luck.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic