Raymond Feng wrote:
Using the List<String> as the return type is tricky for SOAP WS as the XML
always requires to have a root element. Do you mind trying to create a wrapper
JAXB for the List<String>, such as:
public class Messages {
protected List<String> items;
...
// setter and getters
}
Thanks,
Raymond
Good evening Raymond,
That helped me a lot but did not resolve the problem unfortunately.
I have created a Java class Messages.java and python class Messages.py.
You can find enclosed all the source files (server and client side).
The server interface returns now a "Messages" type class element instead
of an ArrayList. That seems working. I generated the stub correctly in
the client side but now I have this exception:
xception in thread "main" org.osoa.sca.ServiceRuntimeException:
org.apache.tuscany.sca.interfacedef.util.FaultException:
java.lang.IncompatibleClassChangeError: Expected non-static field
org.python.core.PySystemState.builtins
I think that there is a problem in matching the interface written in
Java and its implementation written in Python and between the Java class
Messages.java and the Python class Messages.py.
Have you ever experienced working with python + SCA?
Thanks a lot,
Yours,
--
*ESSOUSSI Mohamed Habib *
TELECOM SudParis
package chatserver;
import org.osoa.sca.annotations.Remotable;
@Remotable
public interface ChatServer {
Messages checkMessages(int received);
}
import Messages
def checkMessages(received):
global messages
return Messages(messages[received:len(messages)])
#programme principal
messages = ["salut", "cava"]
package chatserver;
import java.util.ArrayList;
import java.util.List;
public class Messages {
private List<String> MessageList = new ArrayList<String>();
public List<String> getMessageList() {
return MessageList;
}
public void setMessageList(List<String> messageList) {
MessageList = messageList;
}
}
class Messages(object):
"""Class docstring."""
def __init__(self, arg1):
"""Method docstring."""
self.messageList = arg1
package sca.client;
import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Service;
import chatserver.ChatServer;
import chatserver.Messages;
@Service(Runnable.class)
public class ChatClient implements Runnable {
@Reference
protected ChatServer cs;
@Override
public void run() {
Messages arr = cs.checkMessages(0);
for (String str : arr.getMessageList()) {
System.out.println(str);
}
}
}