Welcome! Log In Create A New Profile

Advanced

Problem with Web services

Posted by Jean-Claude Tarby.pcs.crosspost 
Jean-Claude Tarby.pcs.crosspost
Problem with Web services
July 09, 2008 10:53AM
Hi.

I already lost 6 working days, and all my projects are down with that problem... :-(
I must use Web services, but I have a serious problem with non ASCII strings (for example “Jérôme&#8221winking smiley.

Here are two pieces of my code: an extract of the WSDL, and my attempts to use two very simple functions of the Web service:

- The first function is Hello_Name(aName, aLogin, aPwd) which uses 3 strings as parameters and simply returns the “aName” parameter in “Hello my dear aName”. If I send “John”, I receive “Hello my dear John”, BUT if I send “Jérôme”, I receive “Hello my dear J?r?me” and not “Hello my dear Jérôme”. When I test this webservice with Flash or C#, I have no problem with accent; I receive “Hello my dear Jérôme”.

- the second function is voir_users_meeting(aLogin) which uses 1 string as parameter and simply returns ever the same list of names, with one name with accent (“Zoé&#8221winking smiley. Again, with Flash or C#, no problem, but with Windev I receive “Zoé” as “Zoé”.

I tried a lot of solutions, but I suppose not the good one. For example, I tried:
- to call the WS with SOAP.name[], SOAP.type[]…
- to import the WS as a collection of functions (as provided by Windev), and then to call these procedures/functions. This is the solution that I use at the moment.
- to transform the strings before sending (and after receiving) them in or from XML, Unicode, Ansi, OEM, URL, and so on.
- to use ‘fixed strings’, ‘ASCIIZ strings’, ‘UNICODE strings’, and so on, as parameters.

Nothing gives me "Jérôme" or "Zoé" :-(

I really need your help. I hope that somebody has the solution.

JCT
//----------part of the WSDL------------ 
 <?xml version="1.0" encoding="utf-8" ?> 
<wsdl:definitions xmlns:soap="[schemas.xmlsoap.org]; xmlns:tm="[microsoft.com]; xmlns:soapenc="[schemas.xmlsoap.org]; xmlns:mime="[schemas.xmlsoap.org]; xmlns:tns="USTL_LIFL_TRIGONE" xmlns:s="[www.w3.org]; xmlns:soap12="[schemas.xmlsoap.org]; xmlns:http="[schemas.xmlsoap.org]; targetNamespace="USTL_LIFL_TRIGONE" xmlns:wsdl="[schemas.xmlsoap.org]; 
<wsdl:types> 
<s:schema elementFormDefault="qualified" targetNamespace="USTL_LIFL_TRIGONE"> 
<s:element name="Hello_Name"> 
<s:complexType> 
<s:sequence> 
 <s:element minOccurs="0" maxOccurs="1" name="name" type="s:string" /> 
 <s:element minOccurs="0" maxOccurs="1" name="login" type="s:string" /> 
 <s:element minOccurs="0" maxOccurs="1" name="pwd" type="s:string" /> 
 </s:sequence> 
 </s:complexType> 
 </s:element> 
<s:element name="Hello_NameResponse"> 
<s:complexType> 
<s:sequence> 
 <s:element minOccurs="0" maxOccurs="1" name="Hello_NameResult" type="s:string" /> 
 </s:sequence> 
 </s:complexType> 
 </s:element> 
//.................. 
<s:element name="voir_users_meeting"> 
<s:complexType> 
<s:sequence> 
 <s:element minOccurs="0" maxOccurs="1" name="id_meeting" type="s:string" /> 
 </s:sequence> 
 </s:complexType> 
 </s:element> 
<s:element name="voir_users_meetingResponse"> 
<s:complexType> 
<s:sequence> 
 <s:element minOccurs="0" maxOccurs="1" name="voir_users_meetingResult" type="s:string" /> 
 </s:sequence> 
 </s:complexType> 
 </s:element> 
 </s:schema> 
 </wsdl:types>
------------- Windev code for Hello_Name (code in a button)
stResultat is STHello_NameResponse 
stTexteAEnvoyer is string 
// I tried: stTexteAEnvoyer is STHello_Name 
//and also:  stTexteAEnvoyer is string UNICODE
//
//
// I tried:  stTexteAEnvoyer:m_name="Jérôme" 
// and also: stTexteAEnvoyer=AnsiVersUnicode("Jérôme") 
stTexteAEnvoyer="Jérôme" 

stRésultat=Hello_Name(stTexteAEnvoyer, "my_login", "my_password") 
//I tried: stRésultat=Hello_Name(stTexteAEnvoyer:m_name, "mon_login", "mon_password") 

Info(stRésultat:m_Hello_NameResult) 

// I tried also that 
stRésultat:m_Hello_NameResult=XMLToText(stRésultat:m_Hello_NameResult) 
Info(stRésultat:m_Hello_NameResult)

------------Windev code for voir_users_meeting  (code in a button)

//this is just an example of all my attenmpts
stResultat is STvoir_users_meetingResponse 
sTexteAEnvoyer is string 

sTexteAEnvoyer="1234" 

stRésultat=voir_users_meeting(sTexteAEnvoyer) 
stRésultat:m_voir_users_meetingResult=XMLToText(stRésultat:m_voir_users_meetingResult) 
Info(stRésultat:m_voir_users_meetingResult) 

------end of code






Message forwarded from pcsoft.us.windev
kevinw
Re: Problem with Web services
July 10, 2008 11:22AM
I don't know if this will help, but I did a very brief proof of concept reading in such accented data from an XML file, and like you went through several different methods before finding one that worked:

OfficeName = UTF8ToString(XMLExtractString(XMLSource, "OffNam", i),charsetAnsi)

Kevin
"Olivier P.".pcs.crosspost
Re: Problem with Web services
July 10, 2008 02:04PM
Hello,

did you try to contact the Technical Support (even via phone) for that problem ?

Regards,

Olivier


Message forwarded from pcsoft.us.windev
ocakici
Re: Problem with Web services
July 10, 2008 04:33PM
What is the type of data coming back from WebServices? I ran into a similar issue where data was in base64Binary format in XML definition, and I used Uncrypt(sFileContentString,"",cryptNone) to uncrypt it.

Oguz
Jean-Claude Tarby.pcs.crosspost
Re: Problem with Web services
July 11, 2008 12:08PM
If you want, you can test yourself the WS. Send me an email and I'll give you the WSDL URL, login and password.

Here is the code of the button; there is no other code in the project.

stResultat est STHello_NameResponse
sTexteEnvoye is string
sTexteReçu is string

sTexteEnvoye="Jérôme"
stResultat=Hello_Name(sTexteEnvoye,"...", "...")

sTexteReçu=XMLVersTexte(stResultat:m_Hello_NameResult)
Info(sTexteReçu)

sTexteReçu=UTF8ToString(sTexteReçu)
Info(sTexteReçu)

Hou have to test with accent, like "Jérôme" (may be the string will be not correctly displayed here, it is Je'ro^me ) . You should obtain "Hello my dear Jérôme", but I obtain "Hello my dear J?R?me".

JCT

Message forwarded from pcsoft.us.windev
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: