I created the webservice stubs using axis2-1.5's wsdl2java.bat. This created a src folder with the following structure in it:
我使用axis2-1.5的wsdl2java.bat创建了webservice存根。这创建了一个src文件夹,其中包含以下结构:
src/net/mycompany/www/services/SessionIntegrationStub.java
The package of the SessionIntegration.java file is: package net.mycompany.www.services;
SessionIntegration.java文件的包是:package net.mycompany.www.services;
Now, I am trying to use this stub in my java code. I placed my java file in the same services folder. I set the same package. Here is my entire class:
现在,我试图在我的java代码中使用这个存根。我将我的java文件放在同一个services文件夹中。我设置了相同的包。这是我的全班:
package net.mycompany.www.services;
import net.mycompany.www.services;
public class DynamicProxy
{
public static void main(String[] args)
{
try
{
SessionIntegrationStub stub = new SessionIntegrationStub();
System.out.println(stub.getSessionIntegration("test"));
}
catch (Exception e)
{
System.out.println(e);
}
}
}
Then I tried to compile this code with the following cmd:
然后我尝试使用以下cmd编译此代码:
javac DynamicProxy.java
However I keep getting this error message:
但是我不断收到此错误消息:
C:\data\net\mycompany\www\services>javac DynamicProxy.java
DynamicProxy.java:9: cannot find symbol
symbol : class SessionIntegrationStub
location: package net.mycompany.www.services
import net.mycompany.www.services.SessionIntegrationStub;
^
DynamicProxy.java:17: cannot find symbol
symbol : class SessionIntegrationStub
location: class net.mycompany.www.services.DynamicProxy
SessionIntegrationStub stub = new SessionIntegrationStub();
^
DynamicProxy.java:17: cannot find symbol
symbol : class SessionIntegrationStub
location: class net.mycompany.www.services.DynamicProxy
SessionIntegrationStub stub = new SessionIntegrationStub();
^
3 errors
Any idea what I am missing here?
知道我在这里缺少什么吗?
Update 1:
I compiled the stubs (thanks to the answers below) and I got rid of the first error. I changed the import to this import net.americanapparel.www.services.*; however I still get an error for the SessionIntegrationStub: cannot find symbol. I also tried this import: net.americanapparel.www.services.SessionIntegrationStub, but that did not help either. Is there anything else I am missing?
我编译了存根(感谢下面的答案),我摆脱了第一个错误。我将导入更改为此导入net.americanapparel.www.services。*;但是我仍然得到SessionIntegrationStub的错误:找不到符号。我也试过这个导入:net.americanapparel.www.services.SessionIntegrationStub,但这也没有帮助。还有什么我想念的吗?
2 个解决方案
#1
0
You have to compile your stub first or both together, since wsdl2java only creates a .java
file, not the .class
file. The compiler error clearly says it don't know the SessionIntegrationStub.
您必须首先编译存根,或者将它们编译在一起,因为wsdl2java只创建.java文件,而不是.class文件。编译器错误清楚地表明它不知道SessionIntegrationStub。
The other answer is right too: you have to
另一个答案也是正确的:你必须这样做
import net.mycompany.www.services.*;
not
import net.mycompany.www.services;
#2
0
You don't seem to import it.
你似乎没有导入它。
import net.mycompany.www.services.SessionIntegrationStub;
should do the trick.
应该做的伎俩。
and then:
shell$ javac my/package/*.java
which should enable javac to find or compile all the files it needs.
这应该使javac能够找到或编译它需要的所有文件。
#1
0
You have to compile your stub first or both together, since wsdl2java only creates a .java
file, not the .class
file. The compiler error clearly says it don't know the SessionIntegrationStub.
您必须首先编译存根,或者将它们编译在一起,因为wsdl2java只创建.java文件,而不是.class文件。编译器错误清楚地表明它不知道SessionIntegrationStub。
The other answer is right too: you have to
另一个答案也是正确的:你必须这样做
import net.mycompany.www.services.*;
not
import net.mycompany.www.services;
#2
0
You don't seem to import it.
你似乎没有导入它。
import net.mycompany.www.services.SessionIntegrationStub;
should do the trick.
应该做的伎俩。
and then:
shell$ javac my/package/*.java
which should enable javac to find or compile all the files it needs.
这应该使javac能够找到或编译它需要的所有文件。