调用java webservice时出现不兼容的类型错误

时间:2016-09-13 10:37:05

标签: java web-services netbeans

我有一个Netbeans webservice,它从Jama包中返回一个对象(Matrix),但是当我从客户端调用webservice时,我收到了“不兼容类型”的编译错误。在webservice和客户端的代码下面。

我的网络服务:

package Protocol4_Service;

@WebService(serviceName = "Cloud1")
public class Cloud1 {

private Jama.Matrix xPrimeMatrix;

public Cloud1(){ }

 @WebMethod(operationName = "saveXPrime")
 public void saveXPrime(Jama.Matrix xp){
   xPrimeMatrix = xp;
 }

}

我的客户:

package MyTest;

public class Test {

@WebServiceRef(wsdlLocation="http://mypc:8080/ServiceCloud/Cloud1?wsdl")
static Cloud1_Service serviceCloud1;

private Cloud1 portCloud1;
private Jama.Matrix xprime;

public Test(){
    serviceCloud1 = new Cloud1_Service();
    portCloud1 = serviceCloud1.getCloud1Port();


    //COMPILE ERROR: incompatible types: Jama.Matrix cannot be converted to Protocol4_Service.Matrix
    portCloud1.saveXPrime(getXPrime()); 

 }

 private Jama.Matrix getXPrime(){
    xprime = x.inverse();
    return xprime;
 }

}

我在双方使用相同的包裹。我读到该工具生成的类与原始类不同,但我不知道如何使类型兼容。如果你能指出一些代码,它可能是最好的。

提前致谢

0 个答案:

没有答案
相关问题