hi,
I am trying to call webservice from python client using SUDS. When I call a function with a complex data type as input parameter, it is not passed correctly, but complex data type is getting returned correctly froma webservice call.
Webservice Type:
Soap Binding 1.1
Document/Literal
Webserver:
Weblogic 10.3
Python Version: 2.6.5, SUDS version: 0.3.9
here is the code I am using:
Python Client:
from suds.client import Client
url = 'http://192.168.1.3:7001/WebServiceSecurityOWSM-simple_ws-context-root/SimpleServicePort?WSDL'
client = Client(url)
print client
#simple function with no operation on input...
result = client.service.sopHello()
print result
result = client.service.add10(10)
print result
params = client.factory.create('paramBean')
print params
params.intval = 10
params.longval = 20
params.strval = 'string value'
#print "params"
print params
try:
result = client.service.printParamBean(params)
print result
except WebFault, e:
print e
try:
result = client.service.modifyParamBean(params)
print result
except WebFault, e:
print e
print params
webservice java class:
package simple_ws;
import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
public class SimpleService {
public SimpleService() {
}
public void sopHello(int i) {
System.out.println("sopHello: hello");
}
public int add10(int i) {
System.out.println("add10:");
return 10+i;
}
public void printParamBean(ParamBean pb) {
System.out.println(pb);
}
public ParamBean modifyParamBean(ParamBean pb) {
System.out.println(pb);
pb.setIntval(pb.getIntval()+10);
pb.setStrval(pb.getStrval()+"blah blah");
pb.setLongval(pb.getLongval()+200);
return pb;
}
}
and the bean Class:
package simple_ws;
public class ParamBean {
int intval;
String strval;
long longval;
public void setIntval(int intval) {
this.intval = intval;
}
public int getIntval() {
return intval;
}
public void setStrval(String strval) {
this.strval = strval;
}
public String getStrval() {
return strval;
}
public void setLongval(long longval) {
this.longval = longval;
}
public long getLongval() {
return longval;
}
public String toString() {
String stri = "\nInt val:" +intval;
String strstr = "\nstrval val:" +strval;
String strl = "\nlong val:" +longval;
return stri+strstr+strl;
}
}
so, as issue is like this:
on call: client.service.printParamBean(params) in python client,
output on server side is:
Int val:0
strval val:null
long val:0
but on call: client.service.modifyParamBean(params)
Client output is:
(reply){
intval = 10
longval = 200
strval = "nullblah blah"
}
What am i doing wrong here??