custom java object as parameter to a web service method?

只谈情不闲聊 提交于 2019-12-08 04:30:34

问题


I am using Axis2 for creating SOAP client in Java. The web service is in Java as follows:

package com.example.axis2.JavaObject
public class ABCService
{
// private variables
public int changeObj(JavaObject obj)
{
// code
}
}

The JavaObject class goes like this:

package com.example.axis2.JavaObject
public class JavaObject
{
public String a;
public Date c;
public int d;
// All setters implemented here
// All getters implemented here
public String[] getAttributesNames()
{
String[] arr = {"a","c","d"};
return arr;
}
}

The web service client is coded as:

package com.example.axis2.JavaObject
public class ABCClient
{
public int callChangeObj(JavaObject obj)
{
ABCServiceStub stub = new ABCServiceStub();
ChangeObj changeobj = new ChangeObj();
**obj.setObj(obj);**
ABCServiceResponse resp = stub.changeObj(changeObj);
System.out.println(resp.get_return());
}
}

The bold Java line is giving error that setObj() expects com.example.axis2.JavaObject.ABCServiceStub.JavaObject not com.example.axis2.JavaObject

How do I resolve this error? Thanks!

来源:https://stackoverflow.com/questions/9699368/custom-java-object-as-parameter-to-a-web-service-method

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!