Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
TonyLeBlanc Super Contributor.
Super Contributor.
3941 views

Browse method in BIS

We are using Browse methods in a web service, using the sample program that came with BIS as a template. 

The output section of the working storage looks like this
             20 Output-Parameters.
                30 Result                  PIC X(80).
                30 FoundRecord            occurs maximum-find-records
                                           indexed by found-inx.
                   40 RecordDigest        pic x(28).
                   copy  "fddesign.rec" replacing ==05== by ==40==.
                30 found-record--count     pic 999.
                30 found-record--name      pic x(11)
                                           value "FoundRecord".

When multiple records are returned, the output looks like this:

xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">

   <env:Body env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      <bdl:BrowseResponse xmlns:bdl="http://tempuri.org/bis/samples/BREADDESIGN/">
         <result>successful</result>
         <foundrecord>
            <foundrecordItems>
               <recorddigest>4qR9YGt1YLOYVD8XR9sAQH3Sqek=</recorddigest>
               <designlabid>EX1</designlabid>
               <designvendor>SHAM</designvendor>
               <designlnam>test</designlnam>
               <designclickfee>100</designclickfee>
            </foundrecordItems>
            <foundrecordItems>
               <recorddigest>/inc/sex7l4AU2/mzYK/FfSjmfU=</recorddigest>
               <designlabid>EX1</designlabid>
               <designvendor>SHAM</designvendor>
               <designlnam>test2</designlnam>
               <designclickfee>12</designclickfee>
            </foundrecordItems>
         </foundrecord>
      </bdl:BrowseResponse>
   </env:Body>
</env:Envelope>

When only one record is returned, the output looks like this:

<!--SOAP 1.1 Message - Powered by Xcentrisity™-->
   <env:Body env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      <bdl:BrowseResponse xmlns:bdl="http://tempuri.org/bis/samples/BREADDESIGN/">
         <result>successful</result>
         <foundrecord>
            <recorddigest>7SpUadYlyBw+xhWIIWWnr2obPcI=</recorddigest>
            <designlabid>EX1</designlabid>
            <designvendor>Oopse</designvendor>
            <designlnam>test</designlnam>
            <designclickfee>100</designclickfee>
         </foundrecord>
      </bdl:BrowseResponse>
   </env:Body>
</env:Envelope>

Note the absence of the "foundrecorditems" tag when there is only a single record returned;  this causes problems for the Visual Studio C# routines which process web services.

Is there a way to have both response return the same tags?  I can't even figure out where the "foundrecorditems" tag is coming from?

Thanks

Tony

0 Likes
10 Replies
Micro Focus Frequent Contributor
Micro Focus Frequent Contributor

RE: Browse method in BIS

On what version of XBIS are you experiencing this issue?

I attempted to reproduce the described behavior with XBIS for extend 9.2.1, but, I receive the "Items" element in my response even when I only have one occurrence of the repeating item.  For example, below is the response that I received when I modified the "getacctinfo" method to return one result:

<!--SOAP 1.1 Message - Powered by Xcentrisity™-->

<env:Envelope xmlns:xsi="www.w3.org/.../XMLSchema-instance" xmlns:xsd="www.w3.org/.../XMLSchema" xmlns:soapenc="schemas.xmlsoap.org/.../" xmlns:env="schemas.xmlsoap.org/.../">

  <env:Body env:encodingStyle="schemas.xmlsoap.org/.../">

     <bdl:getacctinfoResponse xmlns:bdl="tempuri.org/.../">

        <result/>

        <accountdetail>

           <accountdetailItems>

              <accountname>Frodo Baggins</accountname>

              <accountaddress>2 Orc Way</accountaddress>

           </accountdetailItems>

        </accountdetail>

     </bdl:getacctinfoResponse>

  </env:Body>

</env:Envelope>

As you can see, the "accountdetailItems" element is included in this response, even though there was only item returned.

It is possible, however, if you are using an older version of XBIS, that your COBOL to SOAP stylesheet might be different, and thus, might be causing the behavior that you are seeing.

Below are the files that I modified in Sample4:

************getacctinfo.cbl************

      IDENTIFICATION DIVISION.

      PROGRAM-ID.   GetAcctInfo-Method.

      ENVIRONMENT DIVISION.

      DATA DIVISION.

      WORKING-STORAGE SECTION.

      LINKAGE SECTION.

      01 Parameters.

         Copy "getacctinfo.cpy".

      PROCEDURE DIVISION USING Parameters.

      GetAcctInfo-Method.

          Move SPACES To Result.

          Move "Frodo Baggins" To AccountName (1)

          Move "2 Orc Way" To AccountAddress (1)

     *    Move 1 To AccountDetail--Count.

          Exit Program.

      END PROGRAM GetAcctInfo-Method.

************getacctinfo.cpy************

            78 L-AccountDetail-Count      VALUE 1.

            20 Input-Parameters.

               30 AccountNumber           PIC 9(10) OCCURS 10 VALUE 0.

               30 AccountNumber--Count    PIC 9 VALUE 1.

            20 Output-Parameters.

               30 Result                  PIC X(80) VALUE SPACES.

               30 AccountDetail           OCCURS 10 TIMES.

                  40 AccountName          PIC X(40) VALUE SPACES.

                  40 AccountAddress       PIC X(80).

               30 AccountDetail--Count    PIC 9 VALUE L-AccountDetail-Count.

0 Likes
TonyLeBlanc Super Contributor.
Super Contributor.

RE: Browse method in BIS

We're using 9.1.1, with a BIS WAN license.  I can contact sales to see about upgrading our test environment to 9.2.

0 Likes
Knowledge Partner
Knowledge Partner

RE: Browse method in BIS

Tony, do you have attributes enabled?  I think that the XSLT uses the fact that the attribute @maxOccurs is present OR that there are multiple elements named <foundrecord> in the XML output of the program to trigger the behaviour.  Try enabling attributes and see if that helps...


Tom Morrison
Consultant

0 Likes
Knowledge Partner
Knowledge Partner

RE: Browse method in BIS

By the way, the 'Items' is added as a means of communicating the structure that is rather naturally described in COBOL.  The soap_to_cobol.xsl stylesheet adds this.  (In my RM/COBOL version it is at line 272.)


Tom Morrison
Consultant

0 Likes
TonyLeBlanc Super Contributor.
Super Contributor.

RE: Browse method in BIS

Hi, Tom;

I do have attributes enabled, I think,with the

XML ENABLE ATTRIBUTES

option in the program?

I found the section of code in the XSL that seems to control the extra *Items tags; if I change the "when" statement to check "&gt,0" instead of "&gt,1", I get the extra *Items tags for the browse, but I also get them for the other methods which return just single values as well.  I think that will cause other issues with the C# routine that consumes the web service.

Tony

0 Likes
Knowledge Partner
Knowledge Partner

RE: Browse method in BIS

Hi again, Tony.

Is your code placing the number of FoundRecord's in found-record--count (in the failure case, it should be 1)?  That will trigger the ($explicit_count) disjunct without affecting any of the other methods.

Simply use a MOVE:

MOVE count-of-records-returned TO found-record--count

You will note that Steve's example does this.

Hope this helps!

Tom


Tom Morrison
Consultant

0 Likes
TonyLeBlanc Super Contributor.
Super Contributor.

RE: Browse method in BIS

Hi, Tom;

We are setting found-record--count correctly -but when it is 1, I still don't get the Items tags in the output on the browse.  If I specifically change found-record--count to 2 when there is only 1 record - I still don't get the Items tags.  If I add a dummy record,however, in the same code that changed found-record--count to 2, then I do get two records (one dummy), and the Items tags.  It seems like if the record is blank, it is ignored by the output (which makes sense, since the array can be of different sizes).

Tony

0 Likes
TonyLeBlanc Super Contributor.
Super Contributor.

RE: Browse method in BIS

I upgraded the test server to BIS version 9.2 - same results, the Items tags are not included when a single record is returned.  We can work around this, although it would still be good to know how to set it up so that responses are returned consistently.

On a related note, when IIS and BIS are running on one computer, and the data files reside on a different computer, the AcuCobol program attempts to open the files using a complete filepath (\\servername\path\filename.dat).  I get a file error 35, because of permissions; what user does the cobol program, invoked by the BIS service, run as when it tries to access the remote files?  I've set up file access for "Everyone", and still get a permission error.

0 Likes
Micro Focus Expert
Micro Focus Expert

RE: Browse method in BIS

I believe the user will be the person who logged in that started IIS (which is either Administrator or someone in the Administrator group). Sometimes Administrator doesn't translate well when accessing another machine. Not trying to sell you something, but try placing AcuServer where the data files are. Then start AcuServer with a trace and have the BIS runtime Web service access the files remotely, the trace will show which user is trying to access the data.

0 Likes
Knowledge Partner
Knowledge Partner

RE: Browse method in BIS

Hi Tony,

[I thought I had this thread set up for an automatic email, but guess I didn't...]

I do not have the AcuCOBOL version of cobol_to_soap.xsl.  In the version I have (the latest RM/COBOL) at line 238 and 239 the value of the FoundRecord--count is fetched into a variable named explicit_count.  Then, on line 259, this variable is used in an <xsl:when>to detect when a --count data item is present:

   or ($explicit_count) or ...

So, it the data item is present, it should cause that <xsl:when> to test true, ant the Items wrapper should be created.

On the assumption that there is no secret data in your web service, could you post the raw XML output (XML EXPORT FILE with specifying an XSL transform)?  I could then run cobol_to_soap.xsl in a debugger and see what is happening.

Tom


Tom Morrison
Consultant

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.