WebServices interface

Author: gianni.sandigliano@unifacesolutions.com (gianni)

Hi Unifacers, I am requested to call-out a SOAP WebService including 2 vectors as input parameters. XML Specs AFAIK are considering vectors be used in two possible modes: wrapped or bare. Importing the provided WSDL Uniface has defined these parameters as string leaving all options open; I am currently supposing the wrapped mode should be used. Now my point: The Uapplication running has in memory these two nice uniface lists (parts & codes). How these parameters string should be composed programmatically? I/We tried already: - to pass directly the uniface lists, supposing the SOAP driver being able to manage them - to compose them using word "string" as tag including in it each value (<fieldName><string>value1</string><string>value2</string></fieldName>) nothing works. Could any already applied example be provided/published, either the composed string or directly the full generated SOAP Envelope? Regards, Gianni


  1. Hello Gianni, have a look at SoapUI. With this tool you can import the WSDL and test it. Then you can use the generated XML in Uniface.   Regards Norbert

    Author: Lauterbach (norbert.lauterbach@infraserv.com)
  2. Hello Generating signature with /gen=xml helps with these cases. It includes an example within signature's definition.  Then structs come to help you. Copy example to a blockdata in your code.

    VXML = $template
    xmltostruct Vstruct, VXML
    ;or build struct from scratch
    Vstruct->parameter1 = your value
    Vstruct->parameter2 = another value
    structtoXML VXML, Vstruct

      Then use VXML as parameter when you call the webservice.   Also helps if you define a SOAP_CALLOUT_POST operation that just write the envelope in the log. This way you are sure what the hell are you sending. This serves to reproduce it in SOAPui. And hopefully, find the key that allows you to correct your code.   Regards   Chimichanga team

    Author: luis.vila (luis.vila@uniface.es)
  3. Hi, I had the same problem last week, but I had to call a Rest-Api (UHTTP) with Json format containing a Json array. Then I used the defined Json in a jsontostruct-statement to get the right struct-format. Then it was just a hell to find out how to program the correct struct in Uniface. But as you are able to construct the correct struct in Uniface, just do a structtojson (structtoxml for you) and send the json (xml). I constructed the right struct vieiwng a json array in this way (could be much easier ways and probably doesn't suit your xml-array) tmpStruct = $newstruct tmpStruct->$name = "Group" tmp2Struct = $newstruct tmp2Struct->$name = "" tmp2Struct = "3" tmp2Struct->$parent = tmpStruct tmp3Struct->$name = "" tmp3Struct = "4" tmp3Struct->$parent = tmpStruct tmpStruct->$parent = MyQueryStruct Just saw that  luis.vila gave you almost the same answer. Regards RogerW.

    Author: rogerw (roger.wallin@abilita.fi)