开发者

"cannot find symbol" on a wsdl Java Client

This is part of a lab exercise for a course I'm doing, it's not assessable, just a learning exercise. Not sure why but the tut didn't go through it, so I just went through it at home but I'm stuck on the last part.

I'm trying to write a java WSDL client to access http://www.nano开发者_高级运维null.com/TimeService/TimeService.asmx?WSDL - I should input UTC+10 to display the current time. Below is the code that I have written:

package time;
class Client {
 public static void main(String args[]){
        TimeService service = new TimeService();
        TimeServiceSoap port= service.getTimeServiceSoap();
        String result = port.GetTimeZoneTime("UTC+10");
        System.out.println("Time is "+result);
 }

}

When I try and compile the code I get the following error:

C:\Program Files\Java\jdk1.6.0_22\bin>javac -d . "c:\Program Files\Java\jdk1.6.0
_22\bin\time\Client.java"
c:\Program Files\Java\jdk1.6.0_22\bin\time\Client.java:13: cannot find symbol
symbol  : method GetTimeZoneTimeResponse(java.lang.String)
location: interface time.TimeServiceSoap
        String result = port.GetTimeZoneTime("UTC+10");
                            ^
1 error

Any thoughts on what I'm doing wrong?


Did you mean

String result = port.getTimeZoneTime("UTC+10");

with a lowercase g? Java method names are case-sensitive, so it won't recognize the method if you get its letter casing wrong. As per both WSDL's TimeServiceSoap documentation and Java naming conventions, method names are in camel case beginning with a lowercase letter.


What does your TimeServiceSoap look like?

Perhaps you meant to use getTimeZoneTime() (starting with a lower case letter)?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜