Eclipse java JAX-RPC web service import generates an interface instead of a class -


therefore, when trying instantiate object of class, error is

cannot instantiate type

enter image description here

does know why eclipse generate interface instead of class? web service written in vb.net can replicated following simple example given here

  1. start eclipse project.
  2. add new web service client http://www.webservicex.net/currencyconvertor.asmx?wsdl
  3. write code...

    package test;  import net.webservicex.www.currencyconvertor;  import net.webservicex.www.currencyconvertorsoap;  import net.webservicex.www.currency;  public class convert  {     public static void main(string[] args)      {         currencyconvertor cc = new currencyconvertor();         // gets implementation of interface can use         // contact web service.         currencyconvertorsoap ccs = cc.getcurrencyconvertorsoap();          // send soap request server , result web service         double conversionrate = ccs.conversionrate(currency.gbp, currency.usd);         system.out.println("£1 worth $" + conversionrate );     } } 

what's happening currencyconverter.java imported interface, can't instantiated.

it should imported class. why isn't it?

enter image description here

i cannot reproduce pb, if use java 1.6+ can generate types wsimport tool provided in jdk.

use following command in terminal:

windows:

"c:\program files\java\jdk1.6.0_45\bin\wsimport.exe" -keep http://www.webservicex.net/currencyconvertor.asmx?wsdl 

linux:

pathtojdk/bin/wsimport -keep http://www.webservicex.net/currencyconvertor.asmx?wsdl 

you'll see warnings, ignore them. you'll class currencyconvertor.

i've tried on machine , works!

--updated 27/07/2015---

i saw you're trying wscompile. in fact, tool had been replaced wsimport long time ago. see oracle documentation:

http://docs.oracle.com/cd/e17802_01/webservices/webservices/docs/2.0/jaxws/usersguide.html

part 1.1.2 dynamic runtime

it should noted wscompile has been replaced 2 new tools: wsimport , wsgen. wsimport used importing wsdls , generating portable artifacts.


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -