[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Ftpapi] Can I get a 2nd set of eyes to look at this please



Hi Jeff,

1. The debugger only shows you 1024 characters by default.  If you want more you have to tell it to show you more -- this has nothing to do with what is actually in the variable, it is just the way the debugger works.   For example in the green screen (strdbg) debugger, you can type "eval MYVAR:c 2000" to see 2000 characters.  Or change the 2000 to whatever length you want to view.

 2. You are telling it the path is UnitDetailsListResMessage, but this appears to be inside <s:Envelope><s:Body>. The point of the path= option is to tell it which elements to look inside to find the part of the document that your program needs, so you'll need to specify these as well as UnitDetailsListResMessage.   I would recommend using the ns=remove option to strip the 's:' from the tags (its possible that a different namespace could be used aside from 's', so hard-coding the 's' in the path is not a good idea, imho, you should strip it instead.)

For example:

    options = 'case=convert +
            +  ns=remove +
            +  path=UnitDetailsListResMessage';

I would recommend always using 'case=convert' instead of 'case=any', its much more versatile.

It's not clear why you had 'allowextra' and 'allowmissing' specified.   But, if you do need these for some reason you could add them as well.  (I strongly recommend only adding them if you truly need them, though, they can make problems really hard to understand.)

That's as far as I could see with a quick glance at the code, but maybe it's enough to get you going?  Unfortunately, I don't have time to write a whole program and test it to get all of the bugs out.

-SK


On 12/31/2019 10:21 AM, Jeff Bianchi wrote:

Hello!

 

Here’s the method’s output parm from the WSDL I’m working with:

 

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">

   <s:Body>

      <UnitDetailsListResMessage xmlns="http://tmwsystems.com/AMS">

         <Result xmlns:i="http://www.w3.org/2001/XMLSchema-instance">

            <Error>

               <Code>0</Code>

               <InnerErrorMessage/>

               <Message/>

               <Severity>None</Severity>

            </Error>

            <ItemCount>1</ItemCount>

            <UnitList>

               <UnitDetails>

                  <ActivCode i:nil="true"/>

                  <ActiveCode>Y</ActiveCode>

                  <Activity>LINE HAUL</Activity>

                  <AssetNum/>

                  <Capacity/>

                  <Color/>

                  <CompanyId>TMT</CompanyId>

                  <CompanyName i:nil="true"/>

                  <CompanyUnit>Y</CompanyUnit>

                  <CostCTCode>001</CostCTCode>

                  <CostCenter>001</CostCenter>

                  <CreatedBy>IMPORT</CreatedBy>

                  <CreatedDate>2019-10-08T08:58:00-07:00</CreatedDate>

                  <CustId>0</CustId>

                  <CustomerName/>

                  <CustomerPhone/>

                  <CustomerStopService/>

                  <DedUnitNumber/>

                  <DepPeriod>0</DepPeriod>

                  <Department>WASHINGTON</Department>

                  <DeprBase>0001-01-01T00:00:00</DeprBase>

                  <DeptCode>WASHINGTON</DeptCode>

                  <Descrip>LINE TRACTOR</Descrip>

                  <Description>LINE TRACTOR</Description>

                  <Division>DYNAMICS</Division>

                  <DivisionCD>DYNAMICS</DivisionCD>

                  <Domicile>001</Domicile>

                  <DwTimeStamp>0x00000000001EC8BB</DwTimeStamp>

                  <EmpDrvId>-2147483648</EmpDrvId>

                  <Engine/>

                  <FleetId>282</FleetId>

                  <FluidType i:nil="true"/>

                  <FluidTypePrimary>false</FluidTypePrimary>

                  <FluidTypeUOM i:nil="true"/>

                  <GroupsId>N</GroupsId>

                  <InService>2017-12-18T00:00:00-08:00</InService>

                  <IsSlidingPM>false</IsSlidingPM>

                  <IsTire>N</IsTire>

                  <LastDone>2019-11-27T00:00:00-08:00</LastDone>

                  <LastInterval>0</LastInterval>

                  <License>YAIS624</License>

                  <LoanerStatus/>

                  <LoanerUnit>N</LoanerUnit>

                  <MFGPartId/>

                  <Make>FRGHT</Make>

                  <MeterDef1>0</MeterDef1>

                  <MeterDef2>0</MeterDef2>

                  <MeterDef3>0</MeterDef3>

                  <MeterDefID>0</MeterDefID>

                  <MeterDefPrimary>false</MeterDefPrimary>

                  <Model>PE116DC</Model>

                  <ModelYear>2018</ModelYear>

                  <ModifiedBy>1293</ModifiedBy>

                  <ModifiedDate>2019-12-13T15:10:00-08:00</ModifiedDate>

                  <MonDepr>0</MonDepr>

                  <NameCustomer/>

                  <ObjId>12437</ObjId>

                  <ObjImageId>-2147483648</ObjImageId>

                  <ObjType>900</ObjType>

                  <OutofService>0</OutofService>

                  <ParentMeter>N</ParentMeter>

                  <ParkFacility/>

                  <ParkFacilityName/>

                  <ParksLot/>

                  <PartId>-2147483648</PartId>

                  <PhyLocation>IN-SHOP</PhyLocation>

                  <PhyShopLocation>005</PhyShopLocation>

                  <Pressure/>

                  <PriceTBLID>-2147483648</PriceTBLID>

                  <PurchFrom/>

                  <PurchPrice>0</PurchPrice>

                  <PurchUOM>US$</PurchUOM>

                  <RepairLimit>-1.7976931348623157E+308</RepairLimit>

                  <RowNum>1</RowNum>

                  <SalvageValue>-1.7976931348623157E+308</SalvageValue>

                  <SerialNo>3AKBHSDV6JSJZ4632</SerialNo>

                  <State>OR</State>

                  <Status>ACTIVE</Status>

                  <Terminated>0001-01-01T00:00:00</Terminated>

                  <TireConfigCode/>

                  <Title/>

                  <TmtCodeID>-2147483648</TmtCodeID>

                  <TotalDepr>0</TotalDepr>

                  <Type i:nil="true"/>

                  <UnitID>632</UnitID>

                  <UnitManager/>

                  <UnitNumber>2900C</UnitNumber>

                  <UnitPrefix/>

                  <UnitType>TRACTOR</UnitType>

                  <UnitUserFld1/>

                  <UnitUserFld2/>

                  <UnitUserFld3/>

                  <UnitUserFld4/>

                  <UnitUserFld5/>

                  <UnitUserFld6/>

                  <UnitUserFld7>P</UnitUserFld7>

                  <UnitUserFld8/>

                  <UnitWeight>-1.7976931348623157E+308</UnitWeight>

                  <ValidateUnitMtr i:nil="true"/>

                  <Vendor>800343</Vendor>

                  <VendorName>PINNACLE FLEET SOLUTIONS</VendorName>

                  <WARRLife1>0</WARRLife1>

                  <WARRLife2>0</WARRLife2>

                  <WARRLife3>0</WARRLife3>

                  <WarInService>2017-12-15T00:00:00-08:00</WarInService>

                  <WheelBase/>

                  <Year>2018</Year>

                  <YearDepr>0</YearDepr>

               </UnitDetails>

            </UnitList>

         </Result>

      </UnitDetailsListResMessage>

   </s:Body>

</s:Envelope>

 

Here’s the way I have the data structures set up in my RPGLE:

 

  // Unit result variables                    

  dcl-ds Result         qualified inz;        

    Error               likeDS(Error_T);      

    ItemCount           int(10);              

    UnitList            likeDS(UnitList_T);   

  end-ds;                                      

                                               

  dcl-ds Error_T        Template;             

    Code                int(10);              

    InnerErrorMessage   varchar(500);         

    Message             varchar(500);          

    Severity            varchar(500);         

  end-ds;                                     

                                               

  dcl-ds UnitList_T     Template qualified;   

    UnitDetails         likeDS(UnitDetails_T);

  end-ds;              

                                        

  dcl-ds UnitDetails_T  Template;      

    ActivCode           varchar(100);  

    ActiveCode          char(1);       

    Activity            varchar(100);  

    AssetNum            varchar(100);  

    Capacity            varchar(100);  

    Color               varchar(100);  

    CompanyId           varchar(100);  

    CompanyName         varchar(100);  

    CompanyUnit         varchar(100);  

    CostCTCode          int(10);        

    CostCenter          int(10);       

    CreatedBy           varchar(100);  

    CreatedDate         timestamp;     

    CustId              int(10);       

    CustomerName        varchar(100); 

    CustomerPhone       varchar(100); 

    CustomerStopService varchar(100); 

    DedUnitNumber       varchar(100); 

    DepPeriod           int(10);      

    Department          varchar(100); 

    DeprBase            timestamp;    

    DeptCode            varchar(100); 

    Descrip             varchar(100); 

    Description         varchar(100); 

    Division            varchar(100); 

    DivisionCD          varchar(100); 

    Domicile            int(10);      

    DwTimeStamp         timestamp;    

    EmpDrvId            int(10);      

    Engine              varchar(100); 

    FleetId             int(10);       

    FluidType           ind;           

    FluidTypePrimary    varchar(100);  

    FluidTypeUOM        ind;           

    GroupsId            varchar(100);  

    InService           timestamp;     

    IsSlidingPM         ind;           

    IsTire              varchar(100);  

    LastDone            timestamp;     

    LastInterval        int(10);       

    License             varchar(100);   

    LoanerStatus        varchar(100);  

    LoanerUnit          varchar(100);  

    MFGPartId           varchar(100);  

    Make                varchar(100);  

    MeterDef1           int(10);       

    MeterDef2           int(10);      

    MeterDef3           int(10);      

    MeterDefID          int(10);      

    MeterDefPrimary     varchar(100); 

    Model               varchar(100); 

    ModelYear           varchar(100); 

    ModifiedBy          varchar(100); 

    ModifiedDate        timestamp;    

    MonDepr             int(10);      

    NameCustomer        varchar(100); 

    ObjId               int(10);      

    ObjImageId          int(10);      

    ObjType             int(10);      

    OutofService        int(10);      

    ParentMeter         varchar(100); 

    ParkFacility        varchar(100); 

    ParkFacilityName    varchar(100);  

    ParksLot            varchar(100);  

    PartId              int(10);       

    PhyLocation         varchar(100);  

    PhyShopLocation     varchar(100);  

    Pressure            varchar(100);  

    PriceTBLID          int(10);       

    PurchFrom           varchar(100);  

    PurchPrice          int(10);       

    PurchUOM            varchar(100);   

    RepairLimit         int(10);       

    RowNum              int(10);       

    SalvageValue        int(10);       

    SerialNo            varchar(100);  

    State               varchar(100);  

    Status              varchar(100);  

    Terminated          timestamp;   

    TireConfigCode      varchar(100);

    Title               varchar(100);

    TmtCodeID           int(10);     

    TotalDepr           int(10);     

    Type                varchar(100);

    UnitID              int(10);     

    UnitManager         varchar(100);

    UnitNumber          varchar(100);

    UnitPrefix          varchar(100);

    UnitType            varchar(100);

    UnitUserFld1        varchar(100);

    UnitUserFld2        varchar(100);

    UnitUserFld3        varchar(100);

    UnitUserFld4        varchar(100);

    UnitUserFld5        varchar(100);

    UnitUserFld6        varchar(100); 

    UnitUserFld7        varchar(100); 

    UnitUserFld8        varchar(100); 

    UnitWeight          int(10);      

    ValidateUnitMtr     varchar(100); 

    Vendor              int(10);      

    VendorName          varchar(100); 

    WARRLife1           int(10);      

    WARRLife2           int(10);      

    WARRLife3           int(10);      

    WarInService        timestamp;    

    WheelBase           varchar(100); 

    Year                int(10);      

    YearDepr            int(10);      

  end-ds;

 

After setting my SOAP action parm I call:

     http_setOption('SoapAction':soapAction);

 

And then run this code:

 

    soapResponse =                                               

                  http_string('POST': soapEndPointURL: soapRequest:

                              'text/xml');              

 

soapResonse is getting populated with valid data – up to a point. In other words, the http_String call seems to be giving me the data that I’m expecting. However, keep reading.          

 

    options = 'case=any allowextra=yes allowmissing=yes ' +

              'path=UnitDetailsListResMessage';           

                                                           

    XML-INTO Result %XML(soapResponse: options); 

 

So I am having two problems and #1 might be causing #2, but I don’t know enough about this to know:

1.       My soapResponse field (dcl-s soapResponse         varchar(100000);) is only being populated to a size/length of 1024. When I put the program into debug, and display the field with F11, it only shows me 1024 chars. Any idea why? We’re on V7R3 (but our PTFs are not up to date).

2.       The XML-INTO op code returns error message RNQ0353 - XML document does not match RPG variable. Based on the program code above, this might simply be the result of the bad length being returned to soapResponse, but it could also be something I’ve screwed up in defining my DSs.

 

Any comments would be greatly appreciated.

 

Thanks – and Happy New Year!

 

 

 

Jeff Bianchi

 

Jeff.Bianchi@xxxxxxxx| P 253.804.1034

Oak Harbor Freight Lines, Inc.

"Bringing Peace of Mind Since 1916."

 


-- 
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi