AL Code Beispiel - Google Distance Matrix Webservice


procedure Test()
    var
        WSTemplate: Record "BCS Webservice Header";
        WSHeader: Record "BCS Webservice Header";
        WSQueryParameter: Record "BCS Webservice Query Parameter";
        WSManagement: Codeunit "BCS Webservice Management";
        WSLineTemp: Record "BCS Webservice Line" temporary;
    begin
        WSTemplate.GET('DISTANCE-MATRIX');
        WSTemplate.CreateRequest(WSHeader);
        with WSQueryParameter do begin
            SETRANGE("Request No.", WSHeader."Request No.");
            SETRANGE(Name, 'origins');
            FINDFIRST;
            Value := 'Hamburg';
            MODIFY;
            SETRANGE(Name, 'destinations');
            FINDFIRST;
            Value := 'München';
            MODIFY;
        end;

        WSManagement.SendRequest(WSHeader);
        WSManagement.CreateTempResponseLines(WSHeader, WSLineTemp);
        WSLineTemp.SETRANGE("Element Path", 'root\rows\elements\distance\value');
        IF WSLineTemp.FINDFIRST THEN
            MESSAGE(WSLineTemp.Value);
    end;
`