Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

NullPointerException  RSS feed

 
Guille Carlos
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
I am very new to web services and I am trying to put together a simple client application. The problem is that I am getting a NullPointerException when at the line
TempConvertSoap port = service.getTempConvertSoap();

Can anyone tell me what is happening? I included my class and the output.
--------------------------------------------------------------------------

public class Main {
@WebServiceRef(wsdlLocation = "http://www.w3schools.com/webservices/tempconvert.asmx?WSDL")
static TempConvert service;


/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Main temp = new Main();
temp.changeTemp((short)1);
}

public void changeTemp(short Temp){
System.out.println("here 3");
TempConvertSoap port = service.getTempConvertSoap();
System.out.println("here 4");
port.celsiusToFahrenheit(Temp);
System.out.println("here 5");

}

}

---------------------------------------------------------------------------
OUTPUT:

here 3
Exception in thread "main" java.lang.NullPointerException
at wsclient.Main.changeTemp(Main.java:38)
at wsclient.Main.main(Main.java:32)
Java Result: 1
 
suresh yerramsetti
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This may help you

http://www.java-tips.org/java-ee-tips/java-api-for-xml-web-services/developing-web-services-using-j.html
[ July 11, 2007: Message edited by: suresh yerramsetti ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!