Please join us at the new JavaWorld Q&A Forums. Your existing login will work there. The discussions here are now read-only.


JavaWorld Talkback >> 960563

Pages: 1
anandhsridhar
stranger


Reged: 02/11/08
Posts: 2
Error on trying code in XFire Tutorial
      #90798 - 02/11/08 02:49 AM

Hi,
Following the Tutorial on XFire, I am facing problem testing the client. The server side went easy by following the example code given.
I am trying to test my web service through a sample client using xfire client feature.

Here is my code, that hits the service:
Code:
 Service serviceModel = new ObjectServiceFactory().create(IBankingService.class);        
System.out.println("callSoapServiceLocal(): got service model." );

//Create a proxy for the deployed service
XFire xfire = XFireFactory.newInstance().getXFire();
XFireProxyFactory factory = new XFireProxyFactory(xfire);

String serviceUrl = "http://localhost:8080/webservice/services/Banking";
//String serviceUrl = "xfire.local://Banking";

IBankingService client = null;
try {
client = (IBankingService) factory.create(serviceModel, serviceUrl);
System.out.println(client.getClass().getName());
} catch (MalformedURLException e) {
System.out.println("WsClient.callWebService(): EXCEPTION: " + e.toString());
}
catch(Exception e ){
e.printStackTrace();
}

//Invoke the service
String serviceResponse = "";
try {
serviceResponse = client.transferFunds("FROMACCOUNT", "TOACCOUNT", 100.0, "Dollars");
} catch (Exception e){
System.out.println("WsClient.callWebService(): EXCEPTION: " + e.toString());
serviceResponse = e.toString();
}
System.out.println("WsClient.callWebService(): status=" + serviceResponse);
//Return the response
}



I am getting the following exception when I try running this method as a stand alone program.

Code:
  Exception in thread "main" java.lang.NoClassDefFoundError: javax/servlet/ServletOutputStream
at org.codehaus.xfire.transport.http.HttpTransport.createNewChannel(HttpTransport.java:36)
at org.codehaus.xfire.transport.AbstractTransport.createChannel(AbstractTransport.java:47)
at org.codehaus.xfire.transport.AbstractTransport.createChannel(AbstractTransport.java:38)
at org.codehaus.xfire.client.Client.getOutChannel(Client.java:410)
at org.codehaus.xfire.client.Client.invoke(Client.java:240)
at org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
at $Proxy0.transferFunds(Unknown Source)
at com.banking.WSClient.main(WSClient.java:52)



Could any one help me to understand whats going on.? It seems the host is not found.
When I try checking the service by typing the same URL in the browser, it works by displaying the wsdl xml.

Thanks for your help.
Anand


Post Extras: Print Post   Remind Me!   Notify Moderator  
anandhsridhar
stranger


Reged: 02/11/08
Posts: 2
Re: Error on trying code in XFire Tutorial [Re: anandhsridhar]
      #90800 - 02/11/08 02:53 AM

However, using the other serviceURl ( xfire.local://Banking) does not throw the exception. But the status it returns is null.

Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 1 anonymous users are browsing this forum.

Moderator:   

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Topic views: 4316

Rate this topic

Jump to

Contact us JavaWorld

Powered by UBB.threads™ 6.5.5