Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WCF envelope for VFP9 WS - Array params
Message
From
12/07/2018 09:24:10
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro and .NET
Title:
WCF envelope for VFP9 WS - Array params
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012 R2
Network:
Windows Server 2012 R2
Application:
Web Service
Miscellaneous
Thread ID:
01661123
Message ID:
01661123
Views:
69
Hi all:

We have a group of legacy webservices in VFP9-SP2 on W2K3 server with SoapToolkit that we need to migrate to W2K12, but using the same VFP9 code.

Because 2K12 does not support SoapToolkit, I'm making WCF envelopes for those VFP9 webservices using ComSvcConfig utility.

The problem i'm facing is that I don't know which parameter type is needed to receive arrays.

I'm going in more deep to explain.

The legacy in-house framework allow external calls to internal webservices using a middleware, which is composed of a Java component and a MessageQueue.

Clients use this middleware to send XML data, then the middleware processes this XML data using XML input/output templates so the data is formatted specifically for each webservice to acomodate the parameters, which allows that the webservices can be updated and evolved without changes in the client side.


Example of the legacy webservice:

The client data send something like this through middleware:
<DATA
   <value1>Client-data-1</value1>
   <value2>Client-data-2</value2>
</DATA
and after template processing by the middleware, it can be transformed in something like this:
<soapenv:Envelope
      xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:cff="http://tempuri.org/07B8B002-BCCC-4E34-9F51-15721C0B1E3C">
   <soapenv:Header/>
   <soapenv:Body>
      <cff:calc_price>
         <lpoRs_Data>
            <VALUE>
               <RecordSet REG="1">
                  <value>Client-data-1</value>
               </RecordSet>
               <RecordSet REG="2">
                  <value>Client-data-2</value>
               </RecordSet>
            </VALUE>
         </lpoRs_Data>
      <cff:/calc_price>
   </soapenv:Body>
</soapenv:Envelope>
Finally, the middleware send this SOAP message to 2K3 server, whose WSDL have some SoapToolkit-specific extensions configured to call serializer/deserializer components which create RecordSet components that ends calling the COM+ component that receives those RecordSets.


Migrating the webservice with WCF envelope

Ok, SoapToolkit can't be used, so we changed parameter types of VFP/PRG components "as string" (because WCF does not support ADODB-RecordSets), like this:
* ws_module.prg
DEFINE CLASS CALC AS CUSTOM OLEPUBLIC
   PROCEDURE calc_price
      LPARAMETERS value1 as string, value2 as string && Params.previously were RecordSets
      (business rules and calculation)
      RETURN lcResponse
   ENDPROC
ENDDEFINE
and then made WCF envelopes using ComSvcConfig tool, which creates a WCF proxy for each component with WSDL contracts that reflects that "string" parameters.

So far so good.

The problem is that using the same SOAP input, the service throw an error like this:

Error in deserializing body of request message for operation 'calc_price'. End element 'lpoRs_Data' from namespace 'http://tempuri.org/07B8B002-BCCC-4E34-9F51-15721C0B1E3C' expected. Found element 'VALUE' from namespace ''.


So it seems like, because the expected WSDL parameter is "string", then the serialized value (which is, I suposse, an array) causes this error.


The questions then, are:

1) What type of parameters are needed on the VFP side to receive those (array?) values, knowing that VFP does not allow specifying "as array"? (look at intellisense options to see them)

2) In the case that nothing can be done on the VFP side: Is there some configuration that can be done with the WCF envelope to specify different parameters than specified on the VFP components?

3) If yes: HOW?


Sorry for this LOOONG post, but I prefer to give enough data to comment.

Thanks!

Fernando D. Bozzo
Fernando D. Bozzo
Madrid / Spain
Next
Reply
Map
View

Click here to load this message in the networking platform