PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → [WD22] An element of 'xsdEntity' type cannot be converted to the 'enumeration' type
[WD22] An element of 'xsdEntity' type cannot be converted to the 'enumeration' type
Iniciado por José BRANDÃO, 07,jul. 2017 12:16 - 3 respuestas
Miembro registrado
16 mensajes
Publicado el 07,julio 2017 - 12:16
Hello,

Im getting this error while trying to send a structure with an enumeration to a test webservice

Full Error:
WL call:
Process of 'Click Button1' (WebService.Button1), line 24, thread 0

What happened?
The following error was returned by the service:
Code: 'Client'
Message: Un élément de type 'xsdEntité' ne peut pas être converti vers le type 'énumération'.

Error code: 40066
Level: non-fatal error

System error message:
Details: Que s'est-il passé ?
Un élément de type 'xsdEntité' ne peut pas être converti vers le type 'énumération'.

Code erreur : 1021
Niveau : erreur fatale

Dump de l'erreur du module 'wd220vm.dll' (22.0.262.1).
Identifiant des informations détaillées (.err) : 1021
Informations de débogage :
UEL = 109
Dump of the error of 'wd220xml.dll' module (22.0.27.0).
Additional Information:
EIT_PILEWL :
Click Button1 (WebService.Button1), line 24
EIT_DATEHEURE : 07/07/2017 11:05:10
EIT_TYPE_WDFILE : <2>
EIT_IDCODE : <18>



Here is all my code:

Project code:
EErpAvailabilityStatus is Enumeration
unbekannt
verfuegbar
nichtverfuegbar
teilvefuergbar
alternativlagerverfuegbar
nochnichtangefragt
END


Button code:
cGetArticleInformation is OMA.GetArticleInformation
cGetArticleInformationResponse is OMA.GetArticleInformationResponse

cGetArticleInformation.user.CustomerId="123"
cGetArticleInformation.user.UserName="123"
cGetArticleInformation.user.PassWord="123"
cGetArticleInformation.user.SID="1"

Artigo is OMA.Item

Artigo.WholesalerArtNr="123"
Artigo.EinspNr="456"
Artigo.EinspArtNr="789"
Artigo.AvailState = EErpAvailabilityStatus.nochnichtangefragt
ArrayAdd(cGetArticleInformation.items.Item.Item,Artigo)

Artigo.WholesalerArtNr="321"
Artigo.EinspNr="654"
Artigo.EinspArtNr="987"
Artigo.AvailState = EErpAvailabilityStatus.nichtverfuegbar
ArrayAdd(cGetArticleInformation.items.Item.Item,Artigo)


cGetArticleInformationResponse=OMA.GetArticleInformation(cGetArticleInformation)

IF ErrorOccurred()=True THEN
Error(ErrorInfo(errFullDetails))
RETURN
END

Info(cGetArticleInformationResponse.GetArticleInformationResult.ErrorMessage..Value)
Info(cGetArticleInformationResponse.GetArticleInformationResult.ErrorCode..Value)
Info(cGetArticleInformationResponse.GetArticleInformationResult.ErrorId..Value)


Used WSDL located here: http://golfinhosoft.webdev-test.com/OMA_WEB/awws/OMA.awws…

Any help is greatly appreciated
Mensaje modificado, 07,julio 2017 - 12:24
Publicado el 10,julio 2017 - 16:58
Hello,

Try this:
EErpAvailabilityStatus is Enumération
unbekannt = "unbekannt"
verfuegbar = "verfuegbar"
nichtverfuegbar = "nichtverfuegbar"
teilvefuergbar = "teilvefuergbar"
alternativlagerverfuegbar = "alternativlagerverfuegbar"
nochnichtangefragt = "nochnichtangefragt"
END


and than

anItem is OMA.Item

anItem.AvailState = EErpAvailabilityStatus.nochnichtangefragt..Value


anItem.AvailState // expects a String but you pass a enumeration


Hope it helps!
Miembro registrado
16 mensajes
Publicado el 10,julio 2017 - 19:11
Thanks for the reply.

Here's what i tried:
- Changing enumeration on the client project
- Changing enumeration on the server project
- Changing enumeration on the client and server project
- Using the webservice with php

None of these worked, could it be something wrong on the server?
I would change that wsdl to work with strings instead of enumeration but the problem is that i need to respect that structure


Server project code:

Project code:
//now
EErpAvailabilityStatus is Enumeration
unbekannt = "unbekannt"
verfuegbar = "verfuegbar"
nichtverfuegbar = "nichtverfuegbar"
teilvefuergbar = "teilvefuergbar"
alternativlagerverfuegbar = "alternativlagerverfuegbar"
nochnichtangefragt = "nochnichtangefragt"
END

//before
//EErpAvailabilityStatus is Enumeration
// unbekannt
// verfuegbar
// nichtverfuegbar
// teilvefuergbar
// alternativlagerverfuegbar
// nochnichtangefragt
//END


Procedure code:
Procedure GetArticleInformation(Parameters is GetArticleInformation)

//data processing here

//return a sucessful message
stGbi is GetBackItems
stGbi.ErrorCode = 0
stGbi.ErrorId = 1
stGbi.ErrorMessage = "Sucess"

stResult is GetArticleInformationResponse
stResult.GetArticleInformationResult.ErrorCode=stGbi.ErrorCode
stResult.GetArticleInformationResult.ErrorId=stGbi.ErrorId
stResult.GetArticleInformationResult.ErrorMessage=stGbi.ErrorMessage
stResult.GetArticleInformationResult.Items=stGbi.Items
RESULT stResult
Publicado el 11,julio 2017 - 11:23
The thing is, the enumeration is an enumeration in code, but while it is send, it's a string
<s:simpleType name="EErpAvailabilityStatus">
<s:restriction base="s:string">
<s:enumeration value="unbekannt"/>
<s:enumeration value="verfuegbar"/>
<s:enumeration value="nichtverfuegbar"/>
<s:enumeration value="teilvefuergbar"/>
<s:enumeration value="alternativlagerverfuegbar"/>
<s:enumeration value="nochnichtangefragt"/>
</s:restriction>
</s:simpleType>


So, when you program, you can use the enumeration, but when you receive it, you need to convert it back to the enumeration.

Procedure GetArticleInformation(Parameters is GetArticleInformation)

eState is EErpAvailabilityStatus

// This is pseudocode
// You will need to iterate through the array
sEnum is string = Parameters.items.Item.Item.AvailState

IF NOT EnumerationCheckValue(EErpAvailabilityStatus , sEnum) THEN
RETURN
END

eState = EnumerationFromValue(EErpAvailabilityStatus , sEnum)


That should get you the right enumeration to work with.