• 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
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

JAX-WS webservice without interface

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying figure out JAX-WS webservice without interface, there is no interface.





I created Java web service client manually.




I am getting error: If i use interface then it runs fine. am i missing something? I need help!






 
Ranch Hand
Posts: 954
4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It looks like getPort requires interface not class.
 
Bikki Malla
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank for help Tushar Goel. But, my issue is in this line.



I am not using any Interface web service, i am trying to call directly web service class. Is there any way to call that from the main method?
And, I have run successfully by using Interface.

 
Ranch Hand
Posts: 734
7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@op
You can setup a service server-side, probably bottom-up approach in your case, without explicitly writing an endpoint interface and go directly to an implementation class.

But at the client-side, with again the bottom-up approach without even using any code generation tool, when you call for getPort() in the process of setting up the client code, the documentation shows a couple of overloads all call for referring to an interface... That means on the client-side, you have to "write" up an endpoint interface rather than an implementation class. (If you use code generation tool for the stub, it would be taken care of, of course.)

When you think about it, even you're on a testing stage with full knowledge of the details of the implementation class, you cannot simply copy the implementation class to the client-side and use it... The spec/documentation calls for an interface _not_ without a good reason. The reason is simply that the client should have zero knowledge of the implementation and that knowledge is shielded away from the client. What the client knows is the contractual detail of the port (via the inspection of the wsdl or via direct communication with the provider of the service) which translates into the (endpoint) interface in the java code. Hence, you've to "write" up an interface with the proper name for it and the methods' name/arguments etc... That you know from the implementation class for this specific situation of testing, or most often via the publicly exposed wsdl. In this case, you simply eliminate all the implementation code and make an interface out of it. With the interface, you put it to use on the client-side code. That's the main idea behind it.
 
I wish to win the lottery. I wish for a lovely piece of pie. And I wish for a tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic