Here is the code. Also I'm trying to generate the clients with adb or
xmlbeans and I'm getting
[ERROR] Part 'fault' of fault message
'{http://icu_test.dev}CFCInvocationException' must be defined with
'element=QName' and not 'type=QName'
this is a coldfusion axis1 ws. I found that "according to the
specification, fault and header message parts must be defined as
document/literal, even if the body is defined as RPC style."
Struct_cards
------------------
public class struct_cards {
protected java.lang.String card_delegate;
protected java.lang.String card_expire_date;
protected java.lang.String card_id;
protected java.lang.String card_lfd;
protected java.lang.String card_name;
protected java.lang.String card_type;
protected java.lang.String usrfld1;
public struct_cards() {}
public struct_cards(String card_delegate, String card_expire_date,
String card_id, String card_lfd, String card_name,
String card_type, String usrfld1) {
this.card_delegate = card_delegate;
this.card_expire_date = card_expire_date;
this.card_id = card_id;
this.card_lfd = card_lfd;
this.card_name = card_name;
this.card_type = card_type;
this.usrfld1 = usrfld1;
}
public String getCard_delegate() {
return card_delegate;
}
public void setCard_delegate(String card_delegate) {
this.card_delegate = card_delegate;
}
public String getCard_expire_date() {
return card_expire_date;
}
public void setCard_expire_date(String card_expire_date) {
this.card_expire_date = card_expire_date;
}
public String getCard_id() {
return card_id;
}
public void setCard_id(String card_id) {
this.card_id = card_id;
}
public String getCard_lfd() {
return card_lfd;
}
public void setCard_lfd(String card_lfd) {
this.card_lfd = card_lfd;
}
public String getCard_name() {
return card_name;
}
public void setCard_name(String card_name) {
this.card_name = card_name;
}
public String getCard_type() {
return card_type;
}
public void setCard_type(String card_type) {
this.card_type = card_type;
}
public String getUsrfld1() {
return usrfld1;
}
public void setUsrfld1(String usrfld1) {
this.usrfld1 = usrfld1;
}
}
invoke method
----------------------
public Object[] invoke() throws Exception {
Object[] params = new Object() {"someid"};
RPCServiceClient serviceClient = new RPCServiceClient();
Options options = serviceClient.getOptions();
EndpointReference targetEPR = new EndpointReference(URL);
options.setTo(targetEPR);
options.setTimeOutInMilliSeconds(TIMEOUT);
QName actionQ = new QName(NAMESPACE, "get_cards");
// Class[] returnTypes = new Class[] { returnTypeClass };
ArrayList resobj = new ArrayList();
resobj.add(struct_cards[].class);
Class[] ax = (Class[])resobj.toArray(new Class[resobj.size()]);
// Class[] returnTypes = new Class[]{struct_cards.class};
Object[] results = serviceClient.invokeBlocking(actionQ,
params, ax);
return results;
}
Rodrigo Asensio
[EMAIL PROTECTED]
http://www.rodrigoasensio.com
"To err is human, but to really screw up requires the root password."
On Wed, Dec 10, 2008 at 2:47 PM, Deepal Jayasinghe <[EMAIL PROTECTED]> wrote:
> Can you please send me your service code, then I will give you the exact
> solution.
>
> Deepal
>
> Rodrigo Asensio wrote:
>> the most accurate test for my case should be the testCompanyArray()
>> where it converts doing something like this
>>
>> ArrayList resobj = new ArrayList();
>> resobj.add(Struct_cards[].class);
>> (Class[])resobj.toArray(new Class[resobj.size()])
>>
>> but the result is the same... below I'm posting the wsdl and extra
>> info that might help (me :))
>>
>> results Object[1] (id=83)
>> [0] Struct_cards (id=84)
>> card_delegate null
>> card_expire_date null
>> card_id null
>> card_lfd null
>> card_name null
>> card_type null
>> usrfld1 null
>>
>> ws created by Macromedia ColdFusion MX version 7,0,2,142559
>> <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
>> <complexType name="Struct_cards">
>> −
>> <sequence>
>> <element name="card_delegate" nillable="true" type="xsd:string"/>
>> <element name="card_expire_date" nillable="true" type="xsd:string"/>
>> <element name="card_id" nillable="true" type="xsd:string"/>
>> <element name="card_lfd" nillable="true" type="xsd:string"/>
>> <element name="card_name" nillable="true" type="xsd:string"/>
>> <element name="card_type" nillable="true" type="xsd:string"/>
>> <element name="usrfld1" nillable="true" type="xsd:string"/>
>> </sequence>
>> </complexType>
>> −
>> <complexType name="ArrayOfStruct_cards">
>> −
>> <complexContent>
>> −
>> <restriction base="soapenc:Array">
>> <attribute ref="soapenc:arrayType" wsdl:arrayType="impl:Struct_cards[]"/>
>> </restriction>
>> </complexContent>
>> </complexType>
>>
>>
>>
>>
>> Rodrigo Asensio
>> [EMAIL PROTECTED]
>> http://www.rodrigoasensio.com
>> "To err is human, but to really screw up requires the root password."
>>
>>
>>
>> On Wed, Dec 10, 2008 at 2:11 PM, Deepal Jayasinghe <[EMAIL PROTECTED]> wrote:
>>
>>> Have a look at following class , it does what you want to do
>>>
>>> https://svn.apache.org/repos/asf/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/RPCCallTest.java
>>>
>>>
>>>> Class[] returnTypes = new Class[]{(Struct_cards[])}
>>>> this don't compile because the objects inside the array must be Class
>>>> type, and I already tried that one
>>>>
>>>> Class[] returnTypes = new Class[]{Struct_cards[].class}
>>>>
>>>>
>>>> Rodrigo Asensio
>>>> [EMAIL PROTECTED]
>>>> http://www.rodrigoasensio.com
>>>> "To err is human, but to really screw up requires the root password."
>>>>
>>>>
>>>>
>>>> On Wed, Dec 10, 2008 at 12:50 PM, Deepal Jayasinghe
>>>> <[EMAIL PROTECTED]> wrote:
>>>>
>>>>
>>>>>> Can't return a simple Object[]
>>>>>>
>>>>>> axis2 141
>>>>>>
>>>>>> client code:
>>>>>> ----------------
>>>>>>
>>>>>> RPCServiceClient serviceClient = new RPCServiceClient();
>>>>>> Options options = serviceClient.getOptions();
>>>>>> EndpointReference targetEPR = new EndpointReference(URL);
>>>>>> options.setTo(targetEPR);
>>>>>> options.setTimeOutInMilliSeconds(TIMEOUT);
>>>>>>
>>>>>> QName actionQ = new QName(NAMESPACE, action);
>>>>>> Class[] returnTypes = new Class[] { Struct_cards.class };
>>>>>> //
>>>>>>
>>>>>>
>>>>> Class[] returnTypes = new Class[]{(Struct_cards[])}
>>>>>
>>>>> would work.
>>>>>
>>>>>
>>>>>> also
>>>>>> tried Struct_cards[].class
>>>>>> Object[] results = serviceClient.invokeBlocking(actionQ,
>>>>>> params, returnTypes);
>>>>>>
>>>>>> It returns an array of 1 element Struct_cards with all its values
>>>>>> empty, below the XML response and the bean code.
>>>>>> I saw that might be a problem of axis2 converting simple object
>>>>>> arrays, but I didn't found any proof. Any help will be appreciated.
>>>>>>
>>>>>>
>>>>>> xml returns :
>>>>>> -----------------
>>>>>>
>>>>>> <get_cardsResponse
>>>>>> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
>>>>>> soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
>>>>>> <get_cardsReturn
>>>>>> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
>>>>>> xmlns:ns1="http://icu_test.dev"
>>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>>> soapenc:arrayType="ns1:struct_cards[2]" xsi:type="soapenc:Array">
>>>>>> <get_cardsReturn xsi:type="ns1:struct_cards">
>>>>>> <card_delegate xsi:type="xsd:string">X</card_delegate>
>>>>>> <card_expire_date xsi:type="xsd:string">XXXX</card_expire_date>
>>>>>> <card_id xsi:type="xsd:string">XXXXXXXXXXXXX</card_id>
>>>>>> <card_lfd xsi:type="xsd:string">xxxx</card_lfd>
>>>>>> <card_name xsi:type="xsd:string">Rodrigo Asensio</card_name>
>>>>>> <card_type xsi:type="xsd:string">1</card_type>
>>>>>> <usrfld1 xsi:type="xsd:string"></usrfld1>
>>>>>> </get_cardsReturn>
>>>>>> <get_cardsReturn xsi:type="ns1:struct_cards">
>>>>>> <card_delegate xsi:type="xsd:string">x</card_delegate>
>>>>>> <card_expire_date xsi:type="xsd:string">xxxxx</card_expire_date>
>>>>>> <card_id xsi:type="xsd:string">xxxxxxxxxxxxxxxxxxxxxxxxx</card_id>
>>>>>> <card_lfd xsi:type="xsd:string">xxxx</card_lfd>
>>>>>> <card_name xsi:type="xsd:string">Rodrigo Asensio</card_name>
>>>>>> <card_type xsi:type="xsd:string">1</card_type>
>>>>>> <usrfld1 xsi:type="xsd:string"></usrfld1>
>>>>>> </get_cardsReturn>
>>>>>> </get_cardsReturn>
>>>>>> </get_cardsResponse>
>>>>>>
>>>>>> bean code: (very basic)
>>>>>> ---------------
>>>>>>
>>>>>> public class Struct_cards {
>>>>>> protected java.lang.String card_delegate;
>>>>>> protected java.lang.String card_expire_date;
>>>>>> protected java.lang.String card_id;
>>>>>> protected java.lang.String card_lfd;
>>>>>> protected java.lang.String card_name;
>>>>>> protected java.lang.String card_type;
>>>>>> protected java.lang.String usrfld1;
>>>>>>
>>>>>> public Struct_cards() {}
>>>>>>
>>>>>> public Struct_cards(String card_delegate, String card_expire_date,
>>>>>> String card_id, String card_lfd, String card_name,
>>>>>> String card_type, String usrfld1) {
>>>>>> this.card_delegate = card_delegate;
>>>>>> this.card_expire_date = card_expire_date;
>>>>>> this.card_id = card_id;
>>>>>> this.card_lfd = card_lfd;
>>>>>> this.card_name = card_name;
>>>>>> this.card_type = card_type;
>>>>>> this.usrfld1 = usrfld1;
>>>>>> }
>>>>>>
>>>>>> public String getCard_delegate() {
>>>>>> return card_delegate;
>>>>>> }
>>>>>>
>>>>>> public void setCard_delegate(String card_delegate) {
>>>>>> this.card_delegate = card_delegate;
>>>>>> }
>>>>>>
>>>>>> public String getCard_expire_date() {
>>>>>> return card_expire_date;
>>>>>> }
>>>>>>
>>>>>> public void setCard_expire_date(String card_expire_date) {
>>>>>> this.card_expire_date = card_expire_date;
>>>>>> }
>>>>>>
>>>>>> public String getCard_id() {
>>>>>> return card_id;
>>>>>> }
>>>>>>
>>>>>> public void setCard_id(String card_id) {
>>>>>> this.card_id = card_id;
>>>>>> }
>>>>>>
>>>>>> public String getCard_lfd() {
>>>>>> return card_lfd;
>>>>>> }
>>>>>>
>>>>>> public void setCard_lfd(String card_lfd) {
>>>>>> this.card_lfd = card_lfd;
>>>>>> }
>>>>>>
>>>>>> public String getCard_name() {
>>>>>> return card_name;
>>>>>> }
>>>>>>
>>>>>> public void setCard_name(String card_name) {
>>>>>> this.card_name = card_name;
>>>>>> }
>>>>>>
>>>>>> public String getCard_type() {
>>>>>> return card_type;
>>>>>> }
>>>>>>
>>>>>> public void setCard_type(String card_type) {
>>>>>> this.card_type = card_type;
>>>>>> }
>>>>>>
>>>>>> public String getUsrfld1() {
>>>>>> return usrfld1;
>>>>>> }
>>>>>>
>>>>>> public void setUsrfld1(String usrfld1) {
>>>>>> this.usrfld1 = usrfld1;
>>>>>> }
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Rodrigo Asensio
>>>>>> [EMAIL PROTECTED]
>>>>>> http://www.rodrigoasensio.com
>>>>>> "To err is human, but to really screw up requires the root password."
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> --
>>>>> Thank you!
>>>>>
>>>>>
>>>>> http://blogs.deepal.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>> --
>>> Thank you!
>>>
>>>
>>> http://blogs.deepal.org
>>>
>>>
>>>
>>
>>
>
> --
> Thank you!
>
>
> http://blogs.deepal.org
>
>