Thu Jul 19, 2018 5:23 am
Login Register Lost Password? Contact Us


Layout Creation using DFUInfo

Questions around writing code and queries

Fri Mar 02, 2018 6:38 pm Change Time Zone

I am trying to get the ECL layout for Csv File using DfuInfo soap call

IMPORT STD;

STRING IP :='http://10.224.84.2';
STRING port_ := '8010';
// STRING FileNameInput := '':STORED('Input_file_name'); //'~thorde::future::scrubsgrouped_input1_w20171213-092727_dinputinlay_policy';
STRING FileNameInput := '~thor::DetailedStats1.csv';
STRING FileName := IF(STD.Str.Contains(FileNameInput,'~',true),FileNameInput,'~'+FileNameInput);
STRING Cluster := '';
STRING include_fpos := 'N';

// Build the soap URL
STRING URl := IP+':'+(STRING)port_+'/WsDfu/?ver_=1.36';
STRING fName := FileName;
fname;

// SOAP request data structure
DFUInfoRequest :=
RECORD
STRING FileName{XPATH('FileName')} := fName;
END;


// SOAP result exception data structure

DFUFileDetail := RECORD
STRING Ecl{XPATH('Ecl')};
STRING Filename{XPATH('Filename')};
END;

DFUInfoResponse := RECORD
DFUFileDetail DFUFileDetail{XPATH('FileDetail/DFUFileDetail')};

END;


DFUInfoRequestSoapCall := SOAPCALL(URl
,'DFUInfo'
,DFUInfoRequest
,DFUInfoResponse
,XPATH('DFUInfoRequest')
);
DFUInfoRequestSoapCall;


It generates below Output ,with out anything assigned but same works in SOAP test call

<Ecl></Ecl><Filename></Filename>


Regards
Harsh Desai
harshdesai
 
Posts: 6
Joined: Fri Feb 23, 2018 8:30 am

Fri Mar 02, 2018 7:10 pm Change Time Zone

same works in SOAP test call

Hi Harsh,

What test are you referring to?

If you don't need to use SOAPCALL, this works perfectly:
Code: Select all
OUTPUT(STD.File.GetLogicalFileAttribute(fname,'ECL'));


Bob
bforeman
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 975
Joined: Wed Jun 29, 2011 7:13 pm

Fri Mar 02, 2018 7:15 pm Change Time Zone

HI BOB ,
Greeting
If I do SOAP test it works but not via ECL I don't get output in ECL tag

I mean, SOAP Request
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns="urn:hpccsystems:ws:wsdfu">
<soap:Body>
<DFUInfoRequest>
<Name>thor::DetailedStats1.csv</Name>
<Cluster/>
<UpdateDescription>0</UpdateDescription>
<FileName/>
<FileDesc/>
</DFUInfoRequest>
</soap:Body>
</soap:Envelope>


Response

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/04/secext">
<soap:Body>
<DFUInfoResponse xmlns="urn:hpccsystems:ws:wsdfu">
<FileDetail>
<Name>thor::detailedstats1.csv</Name>
<Filename>detailedstats1.csv</Filename>
<Prefix>thor</Prefix>
<NodeGroup>thor20_dev02</NodeGroup>
<NumParts>20</NumParts>
<Description/>
<Dir>/var/lib/HPCCSystems/hpcc-data/thor/thor</Dir>
<PathMask>detailedstats1.csv._$P$_of_20</PathMask>
<Filesize>25,742</Filesize>
<RecordSize>0</RecordSize>
<RecordCount>480</RecordCount>
<Wuid>W20180228-050818</Wuid>
<Owner>NamdPo01</Owner>
<JobName/>
<Format>utf8n</Format>
<CsvSeparate>\,</CsvSeparate>
<CsvTerminate></CsvTerminate>
<Modified>2018-02-28 10:38:01</Modified>
<Ecl>RECORD
string groupname;
string field;
integer8 valuecount;
integer8 grouptotal;
END;
</Ecl>


So ideally I think we should have got value in ECL tag. in ECL script

Regards
harshdesai
 
Posts: 6
Joined: Fri Feb 23, 2018 8:30 am

Fri Mar 02, 2018 8:28 pm Change Time Zone

Got it!

In your SOAPCALL, change the XPATH to:

Code: Select all
DFUInfoRequestSoapCall := SOAPCALL(URl
,'DFUInfo'
,DFUInfoRequest
,DFUInfoResponse
,XPATH('DFUInfoResponse')
);


and

Code: Select all
DFUInfoResponse := RECORD
  DFUFileDetail DFUFileDetail{XPATH('FileDetail')};
END;


Regards,

Bob
bforeman
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 975
Joined: Wed Jun 29, 2011 7:13 pm

Mon Mar 05, 2018 4:55 am Change Time Zone

HI BOB,
Please find the output for same

<Ecl></Ecl><Filename></Filename>

Can you please guide on the same

// SOAP request data structure
DFUInfoRequest :=
RECORD
STRING FileName{XPATH('FileName')} := fName;
END;


// SOAP result data structure

DFUFileDetail := RECORD
STRING Ecl{XPATH('Ecl')};
STRING Filename{XPATH('Filename')};
END;

//Soap Response Structure
DFUInfoResponse := RECORD
DFUFileDetail DFUFileDetail {XPATH('FileDetail')};
End;


//Soap Call

DFUInfoRequestSoapCall := SOAPCALL(URl
,'DFUInfo'
,DFUInfoRequest
,DFUInfoResponse
,XPATH('DFUInfoResponse')
);
harshdesai
 
Posts: 6
Joined: Fri Feb 23, 2018 8:30 am

Mon Mar 05, 2018 1:21 pm Change Time Zone

Hi BOB,
Able to fetch details by changing the DFUInfoRequest code tagging to Name instead of FileName

Regards
Harsh Desai
harshdesai
 
Posts: 6
Joined: Fri Feb 23, 2018 8:30 am

Mon Mar 05, 2018 1:58 pm Change Time Zone

Hi Harsh,
Able to fetch details by changing the DFUInfoRequest code tagging to Name instead of FileName


Yes, this is what I had in your example:

Code: Select all
DFUInfoRequest := RECORD
STRING Name{XPATH('Name')} := fName;
STRING FileName{XPATH('FileName')} := fName;
END;


But you are right, Name is the important element!

Regards,

Bob
bforeman
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 975
Joined: Wed Jun 29, 2011 7:13 pm


Return to Programming

Who is online

Users browsing this forum: No registered users and 1 guest