Hello
I want to build a simple Webservice which returns a custom Object.
Object is very simple:
public class Luc {
public String name;
public String nachname;
public int alter;
public Luc(String name, String nachname, int alter) {
this.name = name;
this.nachname = nachname;
this.alter = alter;
}
}
services.xml is like (only relevant lines)
<operation name="getObject">
<messageReceiver
class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
</operation>
Public relevant line of Webservice is like:
public Luc getObject() throws Exception {
return new Luc("luc", "Fischer", 23);
}
WSDL: I can see that there is a namespace ns1:Luc. As a client I use C#
(VisualStudio). The client produces a class called Luc but of course
without any attributes, because they are not provided/specified in the wsdl!
How can I solve that? Do I need to write my own axis2-Receiver? Where is
the problem?
btw. The client works fine if the webservice just offers a simple
String, vgl. getVersion-sample! But with an object ...
<wsdl:definitions xmlns:ns1="http://org.apache.axis2/xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://org.apache.axis2/" targetNamespace="http://org.apache.axis2/"><wsdl:types><xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://org.apache.axis2/xsd" targetNamespace="http://org.apache.axis2/xsd" elementFormDefault="unqualified"
attributeFormDefault="unqualified">
<xs:element type="ns1:Luc" name="Luc" />
<xs:complexType name="Luc">
<xs:sequence />
</xs:complexType>
<xs:element name="getObjectRequest">
<xs:complexType />
</xs:element>
<xs:element name="getObjectResponse">
<xs:complexType>
<xs:sequence>
<xs:element type="ns1:Luc" name="return" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="getVersionRequest">
<xs:complexType />
</xs:element>
<xs:element name="getVersionResponse">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="return" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema></wsdl:types><wsdl:message name="getVersionResponseMessage"><wsdl:part name="part1" element="ns1:getVersionResponse" /></wsdl:message><wsdl:message name="getObjectResponseMessage"><wsdl:part name="part1" element="ns1:getObjectResponse" /></wsdl:message><wsdl:message name="getVersionRequestMessage"><wsdl:part name="part1" element="ns1:getVersionRequest" /></wsdl:message><wsdl:message name="getObjectRequestMessage"><wsdl:part name="part1" element="ns1:getObjectRequest" /></wsdl:message><wsdl:portType name="versionPort"><wsdl:operation
name="getObject"><wsdl:input message="tns:getObjectRequestMessage" /><wsdl:output message="tns:getObjectResponseMessage" /></wsdl:operation><wsdl:operation name="getVersion"><wsdl:input message="tns:getVersionRequestMessage" /><wsdl:output message="tns:getVersionResponseMessage" /></wsdl:operation></wsdl:portType><wsdl:binding name="versionBinding" type="tns:versionPort"><soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /><wsdl:operation name="getObject"><soap:operation soapAction="getObject" style="document" /><wsdl:input><soap:body
use="literal" namespace="http://www.org.apache.axis2" /></wsdl:input><wsdl:output><soap:body use="literal" namespace="http://www.org.apache.axis2" /></wsdl:output></wsdl:operation><wsdl:operation name="getVersion"><soap:operation soapAction="getVersion" style="document" /><wsdl:input><soap:body use="literal" namespace="http://www.org.apache.axis2" /></wsdl:input><wsdl:output><soap:body use="literal" namespace="http://www.org.apache.axis2" /></wsdl:output></wsdl:operation></wsdl:binding><wsdl:service name="version"><wsdl:port name="versionPortType0"
binding="tns:versionBinding"><soap:address location="http://localhost:8080/axis2/services/version" /></wsdl:port></wsdl:service></wsdl:definitions>
Thank you in advance for any help.
Greets
luc