Simo Nash wrote:
Hi Mohamed,
Please can you post the generated WSDL file here. Thanks.
Simon
Hello,
Thank you for your help sir.
_*The service interface:*_
package chatserver;
import java.util.List;
import org.osoa.sca.annotations.Remotable;
@Remotable
public interface ChatServer {
List<String> checkMessages(int received);
}
_*The wsdl file: *_
<wsdl:definitions name="ChatServerService"
targetNamespace="http://chatserver/" xmlns:tns="http://chatserver/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:SOAP11="http://schemas.xmlsoap.org/wsdl/soap/">
<wsdl:types>
<xs:schema attributeFormDefault="qualified"
elementFormDefault="unqualified" targetNamespace="http://chatserver/"
xmlns:tns="http://chatserver/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"><xs:element
name="checkMessages"><xs:complexType><xs:sequence><xs:element
minOccurs="0" name="arg0"
type="xs:int"/></xs:sequence></xs:complexType></xs:element><xs:elementname="checkMessagesResponse"><xs:complexType><xs:sequence>*<xs:element
minOccurs="0" name="return" nillable="true"
type="xs:anyType"/>*</xs:sequence></xs:complexType></xs:element></xs:schema>
</wsdl:types>
<wsdl:message name="checkMessages">
<wsdl:part name="checkMessages" element="tns:checkMessages">
</wsdl:part>
</wsdl:message>
<wsdl:message name="checkMessagesResponse">
<wsdl:part name="checkMessagesResponse" element="tns:checkMessagesResponse">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="ChatServer">
<wsdl:operation name="checkMessages">
<wsdl:input message="tns:checkMessages">
</wsdl:input>
<wsdl:output message="tns:checkMessagesResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ChatServerBinding" type="tns:ChatServer">
<SOAP:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="checkMessages">
<SOAP:operation/>
<wsdl:input>
<SOAP:body use="literal"/>
</wsdl:input>
<wsdl:output>
<SOAP:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ChatServerService">
<wsdl:port name="ChatServerPort" binding="tns:ChatServerBinding">
<SOAP:address location="http://localhost:9000/server"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
_*My java client:*_
package sca.client;
import java.util.List;
import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Service;
import chatserver.ChatServer;
@Service(Runnable.class)
public class ChatClient implements Runnable {
@Reference
protected ChatServer cs;
@Override
public void run() {
List<String> arr = (List<String>) cs.checkMessages(0);
for (String str : arr) {
System.out.println(arr);
}
}
}
_*The exception:
*_Exception in thread "main" java.lang.ClassCastException:
org.apache.xerces.dom.ElementNSImpl cannot be cast to java.util.List
at sca.client.ChatClient.run(ChatClient.java:20)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at
org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationInvoker.invoke(JavaImplementationInvoker.java:156)
at
org.apache.tuscany.sca.binding.sca.impl.SCABindingInvoker.invoke(SCABindingInvoker.java:61)
at
org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:349)
at
org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:193)
at $Proxy32.run(Unknown Source)
at sca.client.launcher.ChatLauncher.main(ChatLauncher.java:17)
--
*ESSOUSSI Mohamed Habib *
TELECOM SudParis
--