Good afternoon, trying to connect soap and TreeGrid
class describing the datasource
public class ProtoTreeDataSource extends DataSource{
private static ProtoTreeDataSource instance;
public static ProtoTreeDataSource getInstance() {
if (instance == null) {
instance = new ProtoTreeDataSource("ProtoTree");
}
return instance;
}
private ProtoTreeDataSource(String id) {
setID(id);
setDataFormat(DSDataFormat.XML);
setDataProtocol(DSProtocol.SOAP);
setDataTransport(RPCTransport.XMLHTTPREQUEST);
XmlNamespaces namespaces = new XmlNamespaces();
namespaces.addNamespace("ns2", "http://proteus/");
setServiceNamespace("http://proteus/");
setXmlNamespaces(namespaces);
//create bindings for CRUD operations
OperationBinding fetchBind = new OperationBinding();
fetchBind.setXmlNamespaces(namespaces);
fetchBind.setOperationType(DSOperationType.FETCH);
fetchBind.setWsOperation("getTreeP");
fetchBind.setRecordName("promiteus");
fetchBind.setUseFlatFields(true);
setOperationBindings(fetchBind);
DataSourceField pkField = new DataSourceField("id", FieldType.INTEGER, "id");
pkField.setHidden(true);
pkField.setPrimaryKey(true);
DataSourceField nameField = new DataSourceField("name", FieldType.TEXT, "Name");
DataSourceField parentField = new DataSourceField("parent",FieldType.INTEGER, "Parent");
parentField.setHidden(Boolean.TRUE);
parentField.setRequired(true);
parentField.setForeignKey("id");
parentField.setRootValue(0);
setFields(pkField, nameField, parentField);
}
class describing the treeGrid
public class ProtoTree extends TreeGrid{
public ProtoTree() {
init();
}
private void init() {
TreeGridField nameField=new TreeGridField("name","Имя");
setFields(nameField);
setLoadDataOnDemand(true);
setShowHeader(false);
setLeaveScrollbarGap(false);
setAnimateFolders(true);
setCanAcceptDroppedRecords(true);
setSelectionType(SelectionStyle.SINGLE);
setCanReparentNodes(false);
}
public void attachDataSource(ProtoTreeDataSource ds){
setDataSource(ds);
}
}
private void getSoap() {
//loading data source from service
//RPCManager.setUseHttpProxy(true);
final String xsdURL = "http://194.220.0.80:8084/PrototypeServer/protoServices?xsd=1";
final String wsdlURL = "http://194.220.0.80:8084/PrototypeServer/protoServices?wsdl";
SC.showPrompt("Loading WSDL from: " + wsdlURL);
XMLTools.loadXMLSchema(xsdURL, new XSDLoadCallback() {
@Override
public void execute(SchemaSet schemaSet) {
XMLTools.loadWSDL(wsdlURL, new WSDLLoadCallback() {
@Override
public void execute(WebService service) {
if (service == null) {
SC.warn("WSDL not currently available (tried " + wsdlURL + ")", new BooleanCallback() {
public void execute(Boolean value) {
}
});
return;
}
prDatasource = ProtoDataSource.getInstance();
prtDataSource=ProtoTreeDataSource.getInstance();
listGrid.setDataSource(prDatasource);
editForm.attachDataSource(prDatasource);
prTree.attachDataSource(prtDataSource);
prTree.fetchData();
listGrid.fetchData();
}
});
}
});
}
<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Header></soap:Header>
<soap:Body
xmlns:ns2="http://proteus/">
<ns2:getTreeP>
<id></id>
</ns2:getTreeP>
</soap:Body>
</soap:Envelope>
<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:getTreePResponse xmlns:ns2="http://proteus/">
<return>
<custom>774</custom>
<date>2010-07-06T12:14:55.393+04:00</date>
<id>521</id>
<name>angel0</name>
<parent>0</parent>
</return>
<return>
<custom>392</custom>
<date>2010-07-06T12:14:55.393+04:00</date>
<id>638</id>
<name>angel1</name>
<parent>0</parent>
</return>
<return>
<custom>894</custom>
<date>2010-07-06T12:14:55.393+04:00</date>
<id>930</id>
<name>angel2</name>
<parent>0</parent>
</return>
<return>
<custom>665</custom>
<date>2010-07-06T12:14:55.393+04:00</date>
<id>339</id>
<name>angel4</name>
<parent>0</parent>
</return>
</ns2:getTreePResponse>
</S:Body>
</S:Envelope>
Below are the wsdl and xsd files. I have read TreeDataBinding set PrimaryKey and ForeignKey descriptions in the wsdl service expects parameter id of type int.
Ideally, I understand time opening the site should undertake its PrimaryKey and send as a criterion, but I have always been either transferred to zero if I set the original criteria query manually or nothing. Dear Isomorphic could you tell that I’m wrong
protoServices.wsdl.xml (4.04 KB)
protoServices.xsd.xml (2.48 KB)