WS call-out and occurrence data type

Author: claudio.palladini@cortislentini.it (Claudio)

Hello, I've imported a WSDL with Uniface (9.6.05.01 - 0519_1) and now I've my SOAP signature like this:

PARAMETER IN OUT DATA TYPE
Loginresult   X Occurrence
Username X   String
Password X   String

  The call-out work "quite" fine, but result in some unwanted behaviuors: 1) It add an occurrence in the focused entity, where my calling button is placed, with contents of the "loginresult" out parameter. 2) The variable passed to parameter "loginresult" it's EVER empty. My question is: what's the correct way to handle this kind of parameters?   Thanks all Claudio

15 Comments

  1. Claudio said Gianni: I've seen it because it referred in the Web Services chapter, my reply was to better explain. However, I don't think it's possible to define a variable that maps an entity.
    rogerw said Hi, if you just have to move around an "simple" occurrence or entity it will probably work. The problem with Uniface and web-services is usually complex data-types. C#, Java etc. languages handles these by objects and serialization/deserialization. Uniface have tried to manage these problems by structs. Everyone who has used Uniface structs know that they are quite difficult to program. Especially then, you would really want some intelliSense behaviour into Uniface. 
    Hi RogerW, bingo: 286 complex type + 100 simple type = funny and pessimistic coding days... Thanks Regards Claudio  

    Ciao Claudio, you are asking to refer to a pointer or an handle in Uniface terminology. As of today (U9.7.03) being Uniface component based and NOT object based, handles are not available/usable on all internal objects: - when you need to apply some logic to an entity while you are building the related hitlist you should program your logic into the specific component (form/service) managing that entity and its hitlist. - when you need to apply some logic moving entity contents around after completing/truncating the hitlist you can easily build a Uniface list with: vEntity = "" forentity "MYENTITY" putlistitems/occ vOcc, "MYENTITY" putitem vEntity, -1, vOcc endfor and do whatever you need with your vEntity list... Structs: they are implementing/managing trees and a tree is never a simple object to deal with. I agree with the idea that current structs implementation could be improved... Gianni


    Author: gianni (gianni.sandigliano@unifacesolutions.com)
  2. Claudio said
    1) It add an occurrence in the focused entity, where my calling button is placed, with contents of the "loginresult" out parameter. 2) The variable passed to parameter "loginresult" it's EVER empty. My question is: what's the correct way to handle this kind of parameters?

     1) When an Occurrence parameter is used then an implicit creocc is performed on each call to the operation. This behavior is as-documented (see paragraph "Entity and Occurrence Parameters" here). An Entity parameter on the other hand will not do this. 2) I don't really understand what you are trying to say here. Constructed parameters (like Entity and Occurrence Parameters) must be specified as a string that contains the name of a modeled entity that is painted on the component. Hope this helps. Thanks, Daniel


    Author: diseli (daniel.iseli@uniface.com)
  3. diseli said
    Claudio said
    1) It add an occurrence in the focused entity, where my calling button is placed, with contents of the "loginresult" out parameter. 2) The variable passed to parameter "loginresult" it's EVER empty. My question is: what's the correct way to handle this kind of parameters?
     1) When an Occurrence parameter is used then an implicit creocc is performed on each call to the operation. This behavior is as-documented (see paragraph "Entity and Occurrence Parameters" here). An Entity parameter on the other hand will not do this. 2) I don't really understand what you are trying to say here. Constructed parameters (like Entity and Occurrence Parameters) must be specified as a string that contains the name of a modeled entity that is painted on the component. Hope this helps. Thanks, Daniel  

    Hello Daniel, and thanks for your quick answer. 1) I need to try to change the parameter type with entity, thanks. 2) I made the call-out with  activate "MY_WS".my_method(v_xml, username, password), so I would expected some kind of value in v_xml variable. Just this. Sorry if I did not explain, or explains it incompletely. Thanks for your help, Kind Regards Claudio


    Author: Claudio (claudio.palladini@cortislentini.it)
  4. Hello Claudio, Thanks for the additional info. And you are welcome. This makes it a bit clearer for me. Regarding 2): this will only work when you assign the name of the entity to v_xml before doing the activate; e.g.

    v_xml = "ent1.mod1" activate “MY_WS”.my_method(v_xml, username, password) The result is written to the fields of the painted entity "ent1.mod1". Hope this helps. Kind regards, Daniel


    Author: diseli (daniel.iseli@uniface.com)
  5. diseli said Hello Claudio, Thanks for the additional info. And you are welcome. This makes it a bit clearer for me. Regarding 2): this will only work when you assign the name of the entity to v_xml before doing the activate; e.g.

    v_xml = "ent1.mod1" activate “MY_WS”.my_method(v_xml, username, password) The result is written to the fields of the painted entity "ent1.mod1". Hope this helps. Kind regards, Daniel  

    Thanks Daniel, there is any way/workaround/trick to have it directly in a variable without painting the correlated entity? Thanks again Kind Regards Claudio


    Author: Claudio (claudio.palladini@cortislentini.it)
  6. Hello Claudio, This would only work if you would define the OUT parameter Loginresult as string (instead of as an Occurrence parameter). Hope this helps. Kind regards, Daniel


    Author: diseli (daniel.iseli@uniface.com)
  7. diseli said Hello Claudio, This would only work if you would define the OUT parameter Loginresult as string (instead of as an Occurrence parameter). Hope this helps. Kind regards, Daniel  

    Thanks, but Uniface "have decided" to import the WSDL parameter as occurrence type. Changing it, could cause interface not working? I suppose I just need to test it.. Thanks Kind Regards Claudio


    Author: Claudio (claudio.palladini@cortislentini.it)
  8. Hello Claudio, Changing the parameter from Occurrence to string should work. In that case v_xml would contain the XML returned for the parameter Loginresult. Kind regards, Daniel


    Author: diseli (daniel.iseli@uniface.com)
  9. diseli said Hello Claudio, Changing the parameter from Occurrence to string should work. In that case v_xml would contain the XML returned for the parameter Loginresult. Kind regards, Daniel  

    Thanks, I suspected it. a little OT, it's in the roadmap of Uniface development to provide the possibility to define and use entity or occurrence variables? Kind Regards Claduio


    Author: Claudio (claudio.palladini@cortislentini.it)
  10. Claudio said
    diseli said Hello Claudio, Changing the parameter from Occurrence to string should work. In that case v_xml would contain the XML returned for the parameter Loginresult. Kind regards, Daniel  
    Thanks, I suspected it. a little OT, it's in the roadmap of Uniface development to provide the possibility to define and use entity or occurrence variables? Kind Regards Claudio  

    Ciao Claudio, Nice to see you solved...about your request for more functionalities: it's already there! ...as reported into the Uniface Library; this is the beginning of the related chapter:  ********** ********** ********** ********** ********** ********** Generating Complex Parameters for Web Services When importing a WSDL, a parameter containing complex data is defined as a string data type. As the developer, you need to provide the complex data as a well-formed XML string. To help in this task, you can use the /gen switch to generate example XML and/or entities. The XML example created by /gen describes what is required for the parameter, so you do not need to be an expert in deciphering WSDL files. However, some knowledge of XML schemas is required. For example, the allowed value content of a schema data type is not described in the XML example. Contents of types derived from those schema types are described, in terms of the schema facets. For more information, see XML Parameter Template. To create the XML strings for web service IN parameters you can take any of the following approaches: Use the XML template purely as documentation for what must be provided. Modify the XML template and use it as a hard-coded string. Use the XML template in combination with Uniface Structs to generate the required parameter. What needs to be generated depends on how the parameter will be inserted into the envelope. For more information, see Complex Nested Parameters.   ********** ********** ********** ********** ********** ********** First times to consume external Web Services is a little bit tricky to use all Uniface available functionalities and a little experience is helping to avoid possible pitfalls.The critical part is to use /gen when importing it to avoid the manual generation of entities; my suggestion is to use a temporary "Application Model" for those entities to avoid mistakes and garbage into existing applmodels. Sometimes is still needed to use string data type taking charge of parsing the received XML into our program but number of times this is happening is decreasing with improvements in new Uniface versions (it is always better to use last Uniface version!); in this last context structs are helping a lot to easily recognize XML streams manually managing received data. Hope it helps. Gianni


    Author: gianni (gianni.sandigliano@unifacesolutions.com)
  11. And here is the link to the text Gianni is referring to.


    Author: Arjen van Vliet (arjen.van.vliet@uniface.com)
  12. Hello, thanks, I've already read that chapter, before my OT. What I mean is the capability to DIRECTLY use entity/occurrence w/o any conversion and between procedures/functions and not only related to WS. Something like this (in Java):

    public MyEntity myFunction(MyEntity c){   MyEntity a;   a = c;   return a; } Kind Regards Claudio


    Author: Claudio (claudio.palladini@cortislentini.it)
  13. Claudio said Hello, thanks, I've already read that chapter, before my OT. What I mean is the capability to DIRECTLY use entity/occurrence w/o any conversion and between procedures/functions and not only related to WS. Something like this (in Java):

    ... Kind Regards Claudio  

    Hi Claudio, Entity and Occurrence parameters can be widely used into Proc Language since U7 (about 20 years!). Uniface Library includes current params/endparams block syntax: ********** ********** ********** ********** ********** ********** params Define the parameter block for an operation, entry, or global Proc. params DataType ParamName : Direction {DataType} FieldName.EntityName{.ModelName} : Direction {DataType} $ComponentVarName$ : Direction {byRef} | {byVal} struct ParamName : Direction entity EntityName{.ModelName} : Direction occurrence EntityName{.ModelName} : Direction xmlstream [DTD:DTDName] ParamName : Direction endparams ********** ********** ********** ********** ********** ********** Another subject are User-Defined functions. Again from current Uniface Library: ********** ********** ********** ********** ********** ********** User-Defined Functions In Uniface, it is possible to create user-defined functions that can be used in the Proc language just as any other function. To define your own function, define an entry with a return type. On the first line after entry, use the returns statement to define the return type. ********** ********** ********** ********** ********** ********** Just click on links provided to go directly to the online version of Uniface Library (Thanks Arjen for the tip!) Hope it helps... Gianni


    Author: gianni (gianni.sandigliano@unifacesolutions.com)
  14. Hi, if you just have to move around an "simple" occurrence or entity it will probably work. The problem with Uniface and web-services is usually complex data-types. C#, Java etc. languages handles these by objects and serialization/deserialization. Uniface have tried to manage these problems by structs. Everyone who has used Uniface structs know that they are quite difficult to program. Especially then, you would really want some intelliSense behaviour into Uniface. Regards RogerW.


    Author: rogerw (roger.wallin@abilita.fi)
  15. Gianni: I've seen it because it referred in the Web Services chapter, my reply was to better explain. However, I don't think it's possible to define a variable that maps an entity.

    rogerw said Hi, if you just have to move around an "simple" occurrence or entity it will probably work. The problem with Uniface and web-services is usually complex data-types. C#, Java etc. languages handles these by objects and serialization/deserialization. Uniface have tried to manage these problems by structs. Everyone who has used Uniface structs know that they are quite difficult to program. Especially then, you would really want some intelliSense behaviour into Uniface. 

    Hi RogerW, bingo: 286 complex type + 100 simple type + xsd defined in data stream = funny and pessimistic coding days... Thanks Regards Claudio


    Author: Claudio (claudio.palladini@cortislentini.it)