cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexandre Gazola <alexandregaz...@yahoo.com.br>
Subject Acessing a WS with CXF by using a DynamicClient...
Date Thu, 29 Nov 2007 22:46:53 GMT
Hello guys,

I´m starting to develop with webservices... I would like to start with a simple call to a
WS, given that I have the WSDL url. To relieve me from generating service interfaces, I´m
trying to use a DynamicClient (as shown in  http://xfire.codehaus.org/Dynamic+Client ). But
I downloaded CXF instead of XFire. 

After download CXF, I created an Eclipse project and put all jars of CXF/lib in my project´s
classpath. Then I tried to make the same code work, but I didn´t succeed (actually, I changed
the class Client to ClientImpl, since Client is a interface in CXF). 

public static void main(String[] args) throws Exception {      URL url = new URL("http://www.webservicex.net/CurrencyConvertor.asmx?WSDL");
     Client client = new ClientImpl(url);      Object[] results = client.invoke("ConversionRate",
new Object[] {              "BRL", "UGX" });        // Service returns a double of the currency
conversion rate.      System.out.println((Double) results[0]);  } 

But when I execute this code I get the NullPointerException bellow. Can anybody help?

 29/11/2007 18:39:29 org.apache.cxf.configuration.spring.ConfigurerImpl <init>

 INFO: Could not find the configuration file cxf.xml on the classpath.

 29/11/2007 18:39:33 org.apache.cxf.phase.PhaseInterceptorChain doIntercept

 INFO: Interceptor has thrown exception, unwinding now

 java.lang.NullPointerException

 at
org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeToOutputStream(AbstractOutDatabindingInterceptor.java:110)

 	at org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:67)

 	at org.apache.cxf.interceptor.BareOutInterceptor.handleMessage(BareOutInterceptor.java:6

 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:207)

 	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:254)

 	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:205)

 	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:180)

 	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:200)

 	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:186)

 	at mypackage.test.main(MyTestClass.java:4)

 Exception in thread "main" java.lang.NullPointerException

 at
org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeToOutputStream(AbstractOutDatabindingInterceptor.java:110)

 	at org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:67)

 	at org.apache.cxf.interceptor.BareOutInterceptor.handleMessage(BareOutInterceptor.java:6

 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:207)

 	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:254)

 	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:205)

 	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:180)

 	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:200)

 	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:186)

 	at mypackage.test.main(MyTestClass.java:4)





      Abra sua conta no Yahoo! Mail, o único sem limite de espaço para armazenamento!
http://br.mail.yahoo.com/
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message