Axis webservice returning an array of class

J

jeremy

I've created a class with two public properties of type string
(example below). I've created a method in my web service which
returns an array of the class. Compiles fine, but the class
properties don't appear in the web service response, or in the wsdl.
Any help appreciated.

Example:

Class I want to return an array of:
public class WorkGroup implements java.io.Serializable
{
static final long serialVersionUID = 1;
public String Name;
public String SearchCode;

public WorkGroup(IWorkGroup pWorkGroup)
{
this.Name = pWorkGroup.getName();
this.SearchCode = pWorkGroup.getSearchcode();
}

WebService:

public Class PersonWS
{
public WorkGroup[] ListWorkGroups(String strPerson)
{
....
}
}


WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://localhost:8080/axis/
PersonWS.jws" xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://localhost:8080/axis/PersonWS.jws"
xmlns:intf="http://localhost:8080/axis/PersonWS.jws"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns1="http://openview.interiorhealth.ca" xmlns:wsdl="http://
schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/
wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
<wsdl:types>
<schema targetNamespace="http://localhost:8080/axis/PersonWS.jws"
xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://openview.interiorhealth.ca"/>
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="ArrayOf_tns1_WorkGroup">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType"
wsdl:arrayType="tns1:WorkGroup[]"/>
</restriction>
</complexContent>
</complexType>
</schema>
</wsdl:types>

<wsdl:message name="ListWorkGroupsRequest">

<wsdl:part name="strPerson" type="xsd:string"/>

</wsdl:message>

<wsdl:message name="ListWorkGroupsResponse">

<wsdl:part name="ListWorkGroupsReturn"
type="impl:ArrayOf_tns1_WorkGroup"/>

</wsdl:message>

<wsdl:portType name="PersonWS">

<wsdl:eek:peration name="ListWorkGroups"
parameterOrder="strPerson">

<wsdl:input message="impl:ListWorkGroupsRequest"
name="ListWorkGroupsRequest"/>

<wsdl:eek:utput message="impl:ListWorkGroupsResponse"
name="ListWorkGroupsResponse"/>

</wsdl:eek:peration>

</wsdl:portType>

<wsdl:binding name="PersonWSSoapBinding" type="impl:personWS">

<wsdlsoap:binding style="rpc" transport="http://
schemas.xmlsoap.org/soap/http"/>

<wsdl:eek:peration name="ListWorkGroups">

<wsdlsoap:eek:peration soapAction=""/>

<wsdl:input name="ListWorkGroupsRequest">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/
soap/encoding/" namespace="http://DefaultNamespace" use="encoded"/>

</wsdl:input>

<wsdl:eek:utput name="ListWorkGroupsResponse">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/
soap/encoding/" namespace="http://localhost:8080/axis/PersonWS.jws"
use="encoded"/>

</wsdl:eek:utput>

</wsdl:eek:peration>

</wsdl:binding>

<wsdl:service name="PersonWSService">

<wsdl:port binding="impl:personWSSoapBinding" name="PersonWS">

<wsdlsoap:address location="http://localhost:8080/axis/
PersonWS.jws"/>

</wsdl:port>

</wsdl:service>

</wsdl:definitions>
 
A

Alan Cui

I am not sure if Axis would expose these two FIELDs within Web
Service. But why don't you declare them as properties with getter and
setter method? I believe it could work.

I've created a class with two public properties of type string
(example below). I've created a method in my web service which
returns an array of the class. Compiles fine, but the class
properties don't appear in the web service response, or in the wsdl.
Any help appreciated.

Example:

Class I want to return an array of:
public class WorkGroup implements java.io.Serializable
{
static final long serialVersionUID = 1;
public String Name;
public String SearchCode;

public WorkGroup(IWorkGroup pWorkGroup)
{
this.Name = pWorkGroup.getName();
this.SearchCode = pWorkGroup.getSearchcode();

}

WebService:

public Class PersonWS
{
public WorkGroup[] ListWorkGroups(String strPerson)
{
....
}

}

WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://localhost:8080/axis/
PersonWS.jws" xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://localhost:8080/axis/PersonWS.jws"
xmlns:intf="http://localhost:8080/axis/PersonWS.jws"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns1="http://openview.interiorhealth.ca" xmlns:wsdl="http://
schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/
wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
<wsdl:types>
<schema targetNamespace="http://localhost:8080/axis/PersonWS.jws"
xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://openview.interiorhealth.ca"/>
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="ArrayOf_tns1_WorkGroup">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType"
wsdl:arrayType="tns1:WorkGroup[]"/>
</restriction>
</complexContent>
</complexType>
</schema>
</wsdl:types>

<wsdl:message name="ListWorkGroupsRequest">

<wsdl:part name="strPerson" type="xsd:string"/>

</wsdl:message>

<wsdl:message name="ListWorkGroupsResponse">

<wsdl:part name="ListWorkGroupsReturn"
type="impl:ArrayOf_tns1_WorkGroup"/>

</wsdl:message>

<wsdl:portType name="PersonWS">

<wsdl:eek:peration name="ListWorkGroups"
parameterOrder="strPerson">

<wsdl:input message="impl:ListWorkGroupsRequest"
name="ListWorkGroupsRequest"/>

<wsdl:eek:utput message="impl:ListWorkGroupsResponse"
name="ListWorkGroupsResponse"/>

</wsdl:eek:peration>

</wsdl:portType>

<wsdl:binding name="PersonWSSoapBinding" type="impl:personWS">

<wsdlsoap:binding style="rpc" transport="http://
schemas.xmlsoap.org/soap/http"/>

<wsdl:eek:peration name="ListWorkGroups">

<wsdlsoap:eek:peration soapAction=""/>

<wsdl:input name="ListWorkGroupsRequest">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/
soap/encoding/" namespace="http://DefaultNamespace" use="encoded"/>

</wsdl:input>

<wsdl:eek:utput name="ListWorkGroupsResponse">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/
soap/encoding/" namespace="http://localhost:8080/axis/PersonWS.jws"
use="encoded"/>

</wsdl:eek:utput>

</wsdl:eek:peration>

</wsdl:binding>

<wsdl:service name="PersonWSService">

<wsdl:port binding="impl:personWSSoapBinding" name="PersonWS">

<wsdlsoap:address location="http://localhost:8080/axis/
PersonWS.jws"/>

</wsdl:port>

</wsdl:service>

</wsdl:definitions>
 
J

jeremy

I didn't know you could do properties in java. how?

I am not sure if Axis would expose these two FIELDs within Web
Service. But why don't you declare them as properties with getter and
setter method? I believe it could work.

I've created a class with two public properties of type string
(example below). I've created a method in my web service which
returns an array of the class. Compiles fine, but the class
properties don't appear in the web service response, or in the wsdl.
Any help appreciated.

Class I want to return an array of:
public class WorkGroup implements java.io.Serializable
{
static final long serialVersionUID = 1;
public String Name;
public String SearchCode;
public WorkGroup(IWorkGroup pWorkGroup)
{
this.Name = pWorkGroup.getName();
this.SearchCode = pWorkGroup.getSearchcode();
WebService:

public Class PersonWS
{
public WorkGroup[] ListWorkGroups(String strPerson)
{
....
}

WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://localhost:8080/axis/
PersonWS.jws" xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://localhost:8080/axis/PersonWS.jws"
xmlns:intf="http://localhost:8080/axis/PersonWS.jws"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns1="http://openview.interiorhealth.ca" xmlns:wsdl="http://
schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/
wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
<wsdl:types>
<schema targetNamespace="http://localhost:8080/axis/PersonWS.jws"
xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://openview.interiorhealth.ca"/>
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="ArrayOf_tns1_WorkGroup">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType"
wsdl:arrayType="tns1:WorkGroup[]"/>
</restriction>
</complexContent>
</complexType>
</schema>
</wsdl:types>
<wsdl:message name="ListWorkGroupsRequest">
<wsdl:part name="strPerson" type="xsd:string"/>

<wsdl:message name="ListWorkGroupsResponse">
<wsdl:part name="ListWorkGroupsReturn"
type="impl:ArrayOf_tns1_WorkGroup"/>

<wsdl:portType name="PersonWS">
<wsdl:eek:peration name="ListWorkGroups"
parameterOrder="strPerson">
<wsdl:input message="impl:ListWorkGroupsRequest"
name="ListWorkGroupsRequest"/>
<wsdl:eek:utput message="impl:ListWorkGroupsResponse"
name="ListWorkGroupsResponse"/>


<wsdl:binding name="PersonWSSoapBinding" type="impl:personWS">
<wsdlsoap:binding style="rpc" transport="http://
schemas.xmlsoap.org/soap/http"/>
<wsdl:eek:peration name="ListWorkGroups">
<wsdlsoap:eek:peration soapAction=""/>
<wsdl:input name="ListWorkGroupsRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/
soap/encoding/" namespace="http://DefaultNamespace" use="encoded"/>

<wsdl:eek:utput name="ListWorkGroupsResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/
soap/encoding/" namespace="http://localhost:8080/axis/PersonWS.jws"
use="encoded"/>



<wsdl:service name="PersonWSService">
<wsdl:port binding="impl:personWSSoapBinding" name="PersonWS">
<wsdlsoap:address location="http://localhost:8080/axis/
PersonWS.jws"/>


</wsdl:definitions>- Hide quoted text -

- Show quoted text -
 
J

jeremy

Ok, I changed the class to use the get and set methods, but I'm still
having the same problem

public class WorkGroup implements java.io.Serializable
{
static final long serialVersionUID = 1;
private String strName_m;
private String strSearchCode_m;


public WorkGroup()
{
}
public WorkGroup(IWorkGroup pWorkGroup)
{
this.Name = pWorkGroup.getName();
this.SearchCode = pWorkGroup.getSearchcode();
}

public String getName()
{
return strName_m;
}

public void setName(String strName)
{
strName_m = strName;
}

public String getSearchCode()
{
return strSearchCode_m;
}

public void setSearchCode(String strSearchCode)
{
strSearchCode_m = strSearchCode;
}
}

I am not sure ifAxiswould expose these two FIELDs withinWebService. But why don't you declare them as properties with getter and
setter method? I believe it could work.

I've created a class with two public properties oftypestring
(example below). I've created a method in mywebservicewhich
returns an array of the class. Compiles fine, but the class
properties don't appear in thewebserviceresponse, or in the wsdl.
Any help appreciated.

Class I want to return an array of:
public class WorkGroup implements java.io.Serializable
{
static final long serialVersionUID = 1;
public String Name;
public String SearchCode;
public WorkGroup(IWorkGroup pWorkGroup)
{
this.Name = pWorkGroup.getName();
this.SearchCode = pWorkGroup.getSearchcode();
WebService:

public Class PersonWS
{
public WorkGroup[] ListWorkGroups(String strPerson)
{
....
}

WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://localhost:8080/axis/
PersonWS.jws" xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://localhost:8080/axis/PersonWS.jws"
xmlns:intf="http://localhost:8080/axis/PersonWS.jws"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns1="http://openview.interiorhealth.ca" xmlns:wsdl="http://
schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/
wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by ApacheAxisversion: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
<wsdl:types>
<schema targetNamespace="http://localhost:8080/axis/PersonWS.jws"
xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://openview.interiorhealth.ca"/>
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="ArrayOf_tns1_WorkGroup">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType"
wsdl:arrayType="tns1:WorkGroup[]"/>
</restriction>
</complexContent>
</complexType>
</schema>
</wsdl:types>
<wsdl:message name="ListWorkGroupsRequest">
<wsdl:part name="strPerson"type="xsd:string"/>

<wsdl:message name="ListWorkGroupsResponse">
<wsdl:part name="ListWorkGroupsReturn"
type="impl:ArrayOf_tns1_WorkGroup"/>

<wsdl:portType name="PersonWS">
<wsdl:eek:peration name="ListWorkGroups"
parameterOrder="strPerson">
<wsdl:input message="impl:ListWorkGroupsRequest"
name="ListWorkGroupsRequest"/>
<wsdl:eek:utput message="impl:ListWorkGroupsResponse"
name="ListWorkGroupsResponse"/>


<wsdl:binding name="PersonWSSoapBinding"type="impl:personWS">
<wsdlsoap:binding style="rpc" transport="http://
schemas.xmlsoap.org/soap/http"/>
<wsdl:eek:peration name="ListWorkGroups">
<wsdlsoap:eek:peration soapAction=""/>
<wsdl:input name="ListWorkGroupsRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/
soap/encoding/" namespace="http://DefaultNamespace" use="encoded"/>

<wsdl:eek:utput name="ListWorkGroupsResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/
soap/encoding/" namespace="http://localhost:8080/axis/PersonWS.jws"
use="encoded"/>




<wsdl:port binding="impl:personWSSoapBinding" name="PersonWS">
<wsdlsoap:address location="http://localhost:8080/axis/
PersonWS.jws"/>


</wsdl:definitions>- Hide quoted text -

- Show quoted text -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top