axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Rudolf <michael_rud...@t-online.de>
Subject Re: Why can I use generated stub to call a web service?
Date Mon, 31 Oct 2005 04:24:23 GMT
Hey!

Your code to create a client should look like

BNPrice bnp = new BNPriceLocator();
BNPriceSoapStub  stub = bnp.getBNPrice();

or similar. Take a look at the user guide....i actually dont have a 
SoapStub class but a class BNPricePortType. But i think that shouldnt 
make any difference.
Michael


> Hi, Axis Users,
>
> I am new to Axis, and am trying to use WSDL2Java to generate stubs and 
> call a web service.
> I got WSDL from here:
> http://www.abundanttech.com/webservices/bnprice/bnprice.wsdl
>
> Then I use WSDL2Java to generate stubs:
> BNPrice.java, BNPriceLocator.java, BNPriceSoap.java, BNPriceSoapStub.java
> =======================
> C:\workspace\thesis>dir com\abundanttech\www\webservices\BNPrice
> Volume in drive C has no label.
> Volume Serial Number is 9474-3D18
>
> Directory of C:\workspace\thesis\com\abundanttech\www\webservices\BNPrice
>
> 30/10/2005  11:13 PM    <DIR>          .
> 30/10/2005  11:13 PM    <DIR>          ..
> 30/10/2005  11:12 PM               578 BNPrice.java
> 30/10/2005  11:12 PM             5,499 BNPriceLocator.java
> 30/10/2005  11:12 PM               353 BNPriceSoap.java
> 30/10/2005  11:12 PM             5,548 BNPriceSoapStub.java
>               4 File(s)         11,978 bytes
>               2 Dir(s)  44,316,176,384 bytes free
>
> C:\workspace\thesis>
> =======================
>
> In my client code, I can't even create a stub object.
> =======================
> package testing;
> import com.abundanttech.www.webservices.BNPrice.*;
>
> public class TestClient {
>
>     /**
>      * @param args
>      */
>     public static void main(String[] args) throws Exception{
>         BNPriceSoap bnpsoap = new BNPriceSoapStub();
>     }
> }
> =======================
>
> I got these error messages:
> =======================
> - Factory 
> org.apache.axis.configuration.EngineConfigurationFactoryServlet 
> Ignored: invoke method failed: public static 
> EngineConfigurationFactory newFactory(Object).
> java.lang.reflect.InvocationTargetException
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>     at java.lang.reflect.Method.invoke(Unknown Source)
>     at 
> org.apache.axis.configuration.EngineConfigurationFactoryFinder.newFactory(EngineConfigurationFactoryFinder.java:189)

>
>     at 
> org.apache.axis.configuration.EngineConfigurationFactoryFinder.access$2(EngineConfigurationFactoryFinder.java:163)

>
>     at 
> org.apache.axis.configuration.EngineConfigurationFactoryFinder$1.run(EngineConfigurationFactoryFinder.java:128)

>
>     at java.security.AccessController.doPrivileged(Native Method)
>     at 
> org.apache.axis.configuration.EngineConfigurationFactoryFinder.newFactory(EngineConfigurationFactoryFinder.java:113)

>
>     at 
> org.apache.axis.configuration.EngineConfigurationFactoryFinder.newFactory(EngineConfigurationFactoryFinder.java:160)

>
>     at 
> org.apache.axis.client.Service.getEngineConfiguration(Service.java:812)
>     at org.apache.axis.client.Service.getAxisClient(Service.java:103)
>     at org.apache.axis.client.Service.<init>(Service.java:112)
>     at 
> com.abundanttech.www.webservices.BNPrice.BNPriceSoapStub.<init>(BNPriceSoapStub.java:50)

>
>     at 
> com.abundanttech.www.webservices.BNPrice.BNPriceSoapStub.<init>(BNPriceSoapStub.java:40)

>
>     at testing.TestClient.main(TestClient.java:10)
> Caused by: java.lang.Error: Unresolved compilation problems:
>     ServletConfig cannot be resolved to a type
>     ServletConfig cannot be resolved to a type
>
>     at 
> org.apache.axis.configuration.EngineConfigurationFactoryServlet.newFactory(EngineConfigurationFactoryServlet.java:79)

>
>     ... 16 more
> =======================
>
> I guess the stub approach is the easiest way to call a web service. 
> But I don't know what I did was wrong? I also went through the User 
> Guide of Axis, but find no further instructions about stubs. If you 
> know any documents related to this, please help to post out. Thank you 
> very much!
>
> Cheers,
>
> Chang Zhou
>
>
>
>


Mime
View raw message