Webservices

1,880 views
Skip to first unread message

Fermin Barboza

unread,
Aug 8, 2012, 10:51:22 AM8/8/12
to harbou...@googlegroups.com
[Esp]

Hola, tengo dos sistemas, uno de escritorio, hecho por mi en Clipper y ahora migrado a Harbour 3.0 y otro sistema web, hecho por terceros, con GENEXUS con código Java (creo que es un punto que no viene al caso)

Dada la necesidad de exportar datos desde mi sistema al otro, los desarrolladores del sistema web generaron un módulo que permite usar Webservices para intercambiar datos con otros sistemas hechos en cualquier lenguaje.

Entiendo que los Webservices son instancias de intercambio de datos accediendo a una URL y pasándo parámetros con los datos a agregar en un sistema desde otro (en este caso en particular)

Lo que no tengo ni idea es como trabajar con Webservices desde Harbour

Como me hablaban de archivos .xml, yo supuse que iba a tener que generar dichos archivos y que serían importados desde el sistema web, pero no es así, ya que en ningún momento hay que generar archivo de intercambio alguno.

Espero haber sido claro con la explicación.

Alguien me puede dar una mano ?

Fermín


[Eng Google]

Hello, I have two systems, one desktop, made by me in Clipper and now migrated to Harbour (version 3.0) and a web system, made by third parties via GENEXUS Java code (I think it is a point not relevant)

Given the need to export data from my system to another web system developers generated a module that allows use Webservices to exchange data with other systems made ​​in any language.

I understand that Webservices are instances of data sharing, accessing a URL and passing parameters to add the data in one system from another system (in this particular case)

What I have no idea how to work with Webservices from Harbour

As I spoke xml file, I assumed I would have to generate those files and would be imported from the web system, but not, since at no time have to generate any swap file.

I hope I was clear with the explanation.

Someone can give me a hand?

Fermín

SD

unread,
Aug 8, 2012, 11:40:52 AM8/8/12
to harbou...@googlegroups.com
The following note is not a solution, but thought could be kept in this thread for a reference:

For transferring data from one application/system to another, XML format could be the choicest (debatable?!) method.
Now-a-days standard systems incorporates "Export/Import" of master/transaction data modules in XML format. Spreadsheet (MS-Excel) is also used but XML could be the standard format.

And WCF (Windows Communication Foundation) could be used to communicate (for the data) from one location (HQ/Head Office) to another location (Branch/es).

Claudia Neumann

unread,
Aug 8, 2012, 12:30:22 PM8/8/12
to harbou...@googlegroups.com, Fermin Barboza
Hi Fermin,

you can access webservices with hbcurl und libcurl. You need to know how you can
communicate with the webservice. SOAP is for instance a commonly used protocoll
that I accomplished with harbour and hbcurl.

You can find an example in /contrib/hbcurl/tests/. In June I posted on the
developer list how I compiled hbcurl statically in Windows.

HTH

Claudia

Pritpal Bedi

unread,
Aug 8, 2012, 2:47:00 PM8/8/12
to harbou...@googlegroups.com, Fermin Barboza
Hi Claudio


you can access webservices with hbcurl und libcurl. You need to know how you can
communicate with the webservice. SOAP is for instance a commonly used protocoll
that I accomplished with harbour and hbcurl.


Better would be you provide a sample 
code how you did it to avoid guessing 
on the part of one who asked this question.

Pritpal Bedi 

Claudia Neumann

unread,
Aug 8, 2012, 5:25:59 PM8/8/12
to harbou...@googlegroups.com, Pritpal Bedi, Fermin Barboza
Hi Pritpal,

here a SOAP example. I can communicate with a mono webservice either locally
(localhost) or over the network:

------------------------------
#include "hbcurl.ch"
#include "common.ch"
#include "fileio.ch"


function fHttpExecute(cxml)
local endpointUrl,curlHandle,curlErr
local aHeader,chpmserv,cc1

cc1 := ""

cservice := "InformationsService"
caction := "LiefereKernversion"
chpmserv := "localhost"
endpointUrl = "http://"+chpmserv+":22220/"+cservice+".asmx"

aHeader := {}
AADD(aHeader,"Accept-Encoding: gzip,deflate" )
AADD(aHeader,"Content-Type: application/soap+xml;charset=UTF-8")
AADD(aHeader,'action="http://some-website.de/'+caction+'"')

curlHandle := curl_easy_init()

if !empty(curlHandle)

/* Specify the Header data */
curl_easy_setopt(curlHandle,HB_CURLOPT_HTTPHEADER,aHeader)

/* Set the endpoint to send the POST to */
curl_easy_setopt(curlHandle, HB_CURLOPT_URL, endpointUrl)

/* Setup response data */
curl_easy_setopt( curlHandle, HB_CURLOPT_DOWNLOAD )
curl_easy_setopt( curlHandle, HB_CURLOPT_DL_BUFF_SETUP )

/* Specify the POST data */
curl_easy_setopt(curlHandle, HB_CURLOPT_POST, 1)
curl_easy_setopt(curlHandle, HB_CURLOPT_POSTFIELDS, cxml)

/* Do everything */
curlErr := curl_easy_perform(curlHandle)

/* Report any errors */
if empty(curlErr)
/* store response in variable */
cc1 := curl_easy_dl_buff_get( curlHandle )
else
? curl_easy_strerror(curlErr)
endif
else
? "No handle"
endif

if !empty(curlHandle)
/* Clean-up libcurl */
curl_global_cleanup( curlHandle )
else
? "Error"
endif

if empty(cc1)
? "Error"
endif

return cc1
-------------------------

You need to know the exact endpointUrl, the service and action. This information
is contained in the WSDL files. Sometimes it can be hard to get the header lines
in aHeader right so that the webservice accepts the message.

CU

Claudia

Pritpal Bedi

unread,
Aug 8, 2012, 6:38:41 PM8/8/12
to harbou...@googlegroups.com, Pritpal Bedi, Fermin Barboza
Hi
Thank you very much.
It will help our fellow developers in a great way.
It is a extremely useful piece of code.

Pritpal Bedi
a student of software analysis & concepts

 

Contabilididad, Computadoras y Programas

unread,
Aug 9, 2012, 5:44:34 PM8/9/12
to harbou...@googlegroups.com
Fermin...

En mi caso, para poder migrar datos desde un sistema a otro, sea el caso:
1.- Escritorio a Escritorio
2.- Escritorio a Web
3.- Web a Escritorio

Sea cual sea el caso:

Definimos una estructura de datos para tabular los mismos desde el origen al destino.
Para eso generamos archivos planos con estructura ya definida y el sistema destino lee dicha estructura y la tabula según sus necesidades.

He migrado datos desde sistemas clipper a sistemas ERP y viceversa.

Para cualquier duda me escribes a cyp...@gmail.com

Cordiales saludos
Rubens H. Salazar Ayala
M.M.P. - Gerente General
CYPBOL SRL. - Contabilidad, Computadoras y Programas
Movil: 591-72637645 <> 591-70887830
http://cypbol.galeon.com
Santa Cruz de la Sierra - Bolivia - America del Sur


2012/8/8 Pritpal Bedi <bedipr...@gmail.com>

 

--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users



--

Clippero

unread,
Aug 10, 2012, 9:33:58 AM8/10/12
to harbou...@googlegroups.com
Hola Rubens, gracias por tu interés.

En mi caso particular tengo que exportar datos de mi sistema de escritorio a un sistema web

Son datos de comprobantes (Facturas contado, crédito, etc.)

El tema es que yo pensaba que lo iba a hacer escribiendo un .xml que después el sistema web usaría.

Pero no es así, se trata de implementar Webservices, algo con lo que yo nunca había trabajado.

Por lo poco que pude leer y entender en el trabajo con Webservices se involucran los .xml pero no se escriben de mi lado, se generan a partir de lo que se llama una colección de datos, además hay que conectarse al sistema, van y vienen objetos, etc. etc.
Algo bastante mas complejo que escribir un .xml
Mañana sábado vamos a juntarnos con un amigo que domina el tema para ver que podemos hacer ya sea desde Harbour o desde PHP (también me sirve hacerlo con código PHP ya que lo puedo correr desde dentro de Harbour)
Si me complico mucho con el tema, vuelvo a la lista a pedir ayuda, pero ya con un poco mas de conocimiento sobre el asunto, ahora estoy muy verde, incluso para entender algunos ejemplos que me han dado.

Clippero

unread,
Aug 13, 2012, 7:57:59 AM8/13/12
to harbou...@googlegroups.com, Pritpal Bedi, Fermin Barboza
[Esp]

Hola Claudia, te cuento que estuve investigando un poco mas sobre los Webservices y estuve estudiando con alguien que sabe bastante mas que yo del tema.
Además estuve viendo un poco de códigos tanto de Harbour como de PHP, Java y .net que hacen lo que se llama "Consumir un Webservice"

Dado mis conocimientos me parece que lo mejor para mi sería intentar hacer algo con Harbour o con PHP

Con respecto al código que me enviaste (ahora lo entiendo bastante mas) no me queda claro quien o como se genera el cxml que se pasa como parámetro a la función fHttpExecute()
Por lo que entendí cxml es un archivo .xml con los datos que el Webservice interpretará y devolverá una respuesta.
En dicho archivo irían los datos de mi base de datos y los cuales quiero exportar al sistema web con el que me quiero comunicar.
La pregunta es, a cxml lo tengo que armar yo ?
De qué manera ?

Desde ya mil gracias.

[Eng Google]

Hi Claudia, I tell you that I researched a bit more about the Webservices and I studied with someone who knows a lot more than I of the subject.
Also I watched a little of both codes Harbour as PHP, Java and. Net who do what is called "Consuming a Webservice"

Since my knowledge I think the best thing for me would try to do something with Harbour or PHP

With regard to the code you sent me (now I understand quite more) I am not clear who or as cxml is generated that is passed as parameter to the function fHttpExecute ()
From what I understood cxml is a. Xml data to interpret the Webservice and return a response.
In that file would fill in my database and which want to export to the web system that I want to communicate.
The question is, I have to assemble cxml me?
In what way?

Of course many thanks.


Fermín

rafa thefull

unread,
Aug 13, 2012, 11:19:00 AM8/13/12
to harbou...@googlegroups.com
Hi Claudi,

How transform this example using SOAP3.0 from Microsoft at libcurl ?

oSoapClient := CreateObject( "MSSOAP.SoapClient30" )
oSoapClient:msSoapInit(
"http://www.dataaccess.com/webservicesserver/textcasing.wso?WSDL" )

? oSoapClient:InvertStringCase( "lower UPPER" )

I don't know make xml
"InvertStringCase" is the action and "lower UPPER" is XML

You have any idea ?

Thanks!
Regards


El 08/08/2012 23:25, Claudia Neumann escribi�:

Claudia Neumann

unread,
Aug 13, 2012, 1:52:25 PM8/13/12
to harbou...@googlegroups.com, Clippero, Pritpal Bedi
Hi Fermin,

in your first message you said you had programmed a file which contained the
XML-Code you thought right. So I think you should send this XML-Code.

As I said before it can be hard to get the message header alright. In my case
one webservice didn't tolerate CRLF in the message header although this should
not make a difference with SOAP.

You should have received a WSDL file for the webservice. In my case I used
soapUI (http://www.soapui.org/) to generate a functional XML-Code from the WSDL
file and to test it with the webservice. Once you have a functional example XML-
code, you can easily transform it to harbour output. Perhaps you can use hbxml.
I didn't.

HTH

Claudia
> > AADD(aHeader,'action="http://some-website.de/'+caction+<http://some-websi
> > te.de/%27+caction+>'"')

Claudia Neumann

unread,
Aug 13, 2012, 2:05:30 PM8/13/12
to harbou...@googlegroups.com, rafa thefull
Hi Rafe,

is this code Microsoft.NET code?

It does not matter, what Microsoft tells you your code should look like, but
what the webservice accepts. The webservice is not limited to Microsoft code!
SOAP webservices can also be accessed by Linux.

Take the WSDL file and use soapUI (http://www.soapui.org/) to let it generate a
working XML file and a working header code. Take that code and make the XML-code
in Harbour, send the XML-code with the header code with hbcurl. If it doesn't
work ask the webservice programmer what the code should look like and why your
code is not accepted. If they come again with some Microsoft .NET code they
don't know what they are doing ;-).

HTH

Claudia


Am Montag August 13 2012 schrieb rafa thefull:
> Hi Claudi,
>
> How transform this example using SOAP3.0 from Microsoft at libcurl ?
>
> oSoapClient := CreateObject( "MSSOAP.SoapClient30" )
> oSoapClient:msSoapInit(
> "http://www.dataaccess.com/webservicesserver/textcasing.wso?WSDL" )
>
> ? oSoapClient:InvertStringCase( "lower UPPER" )
>
> I don't know make xml
> "InvertStringCase" is the action and "lower UPPER" is XML
>
> You have any idea ?
>
> Thanks!
> Regards
>

rafa thefull

unread,
Aug 14, 2012, 6:24:37 AM8/14/12
to Claudia Neumann, harbou...@googlegroups.com
Hi Claudia

My XML real is

cXml := <PETICION id="GET_CARDEX_HOTEL"><LPARAMS><PARAM id="CODIGOHOT"
tipo="string" valor="001"/><PARAM id="CONTADOR" tipo="int"
valor="1"/></LPARAMS></PETICION>


Well, the problem using CURL for WebServices, is make envelope SOAP;

Example ;

strxml := [ <soapenv:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:pms="http://pmstocrs.example.com/"> ]
strxml += [ <soapenv:Header/> ]
strxml += [ <soapenv:Body> ]
strxml += [ <pms:RunAction
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> ]
strxml += [ <xmlstr xsi:type="xsd:string"> ]
strxml += " <![CDATA[ "
strxml += [ <PETICION id="GET_CARDEX_HOTEL"><LPARAMS><PARAM
id="CODIGOHOT" tipo="string" valor="001"/><PARAM id="CONTADOR"
tipo="int" valor="1"/></LPARAMS></PETICION> ]
strxml += " ]]> "
strxml += [ </xmlstr> ]
strxml += [ </pms:RunAction> ]
strxml += [ </soapenv:Body> ]
strxml += [</soapenv:Envelope> ]

caction := "RunAction"
endpointUrl := "http://pmstocrs.example.com/test.php"

aHeader := {}
AADD(aHeader,"Accept-Encoding: gzip,deflate" )
AADD(aHeader,"Content-Type: text/xml")
AADD(aHeader,"SOAPAction: "+caction)
AADD(aHeader,"Content-length: "+ Str( len( strXml )) )


This example works, but the answer is also as Envelope;

cc1 := curl_easy_dl_buff_get( curlHandle )

Response CURL
-------------------------------------------------------------------------
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:si="http://soapinterop.org/xsd">
<SOAP-ENV:Body>
<ns1:RunActionResponse xmlns:ns1="http://pmstocrs.example.com/">
<return xsi:type="xsd:string">&lt;LCARDEX
contador="0">&lt;/LCARDEX></return>
</ns1:RunActionResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
-------------------------------------------------------------------------

Now, i have patch message SOAP, very hard.

Using Soap client, for example , Microsoft;
oSoapClient := CreateObject( "MSSOAP.SoapClient" )
oSoapClient:msSoapInit( http://pmstocrs.example.com/test.php?wsdl )
cc1 := oSoapClient:RunAction( cXML )

cc1 content ONLY xml response , NOT response CURL.

The major problemn, is not have ClientSOAP in Harbour.

The major problemn use SOAP from Microsoft, is the NOT SUPPORT by
Microsoft, i have install SDK in all computers using Webservices.


Regards.
Rafa Carmona

Claudia Neumann

unread,
Aug 14, 2012, 6:54:18 AM8/14/12
to harbou...@googlegroups.com, rafa thefull
Hi Rafe,

something is wrong with your XML string: in SOAP you don't use [ or ].
"![CDATA[" has nothing to do with http://www.w3.org/2001/XMLSchema. Your are
sending wrong data.

CU

Claudia

rafa thefull

unread,
Aug 14, 2012, 7:13:45 AM8/14/12
to Claudia Neumann, harbou...@googlegroups.com
El 14/08/2012 12:54, Claudia Neumann escribi�:
> Hi Rafe,
>
> something is wrong with your XML string: in SOAP you don't use [ or ].
> "![CDATA[" has nothing to do with http://www.w3.org/2001/XMLSchema. Your are
> sending wrong data.
>

No, that's right, it works exactly the same in SoapUI, I put the request
/ response with using CDATA SoapIU.

------------------------------------------------------------
Request with CDATA usign SoapUI;
------------------------------------------------------------
<Soapenv: Envelope xmlns: xsi =
"http://www.w3.org/2001/XMLSchema-instance" xmlns: xsd =
"http://www.w3.org/2001/XMLSchema" xmlns: soapenv = "http :/ /
schemas.xmlsoap.org / soap / envelope / "xmlns: pms ="
http://pmstocrs.example.com/ ">
<soapenv:Header/>
<soapenv:Body>
<pms:RunAction
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<xmlstr xsi:type="xsd:string">
<! [CDATA [
Id="GET_CARDEX_HOTEL"> <PETICION <LPARAMS> <PARAM
id="CODIGOHOT" type="String" valor="425"/> <PARAM id="CONTADOR"
tipo="int" valor="1"/> < / LPARAMS> </ REQUEST>
]]>
</ Xmlstr>
</ Pms: RunAction>
</ Soapenv: Body>
</ Soapenv: Envelope>

------------------------------------------------------------
Response SoapUI
------------------------------------------------------------
<SOAP-ENV: Envelope SOAP-ENV: encodingStyle =
"http://schemas.xmlsoap.org/soap/encoding/" xmlns: SOAP-ENV =
"http://schemas.xmlsoap.org/soap/envelope/" xmlns: xsd =
"http://www.w3.org/2001/XMLSchema" xmlns: xsi =
"http://www.w3.org/2001/XMLSchema-instance" xmlns: SOAP-ENC = "http:/ /
schemas.xmlsoap.org / soap / encoding / "xmlns: si ="
http://soapinterop.org/xsd ">
<SOAP-ENV:Body>
<ns1:RunActionResponse xmlns:ns1="http://pmstocrs.example.com/">
<return xsi:type="xsd:string"> <LCARDEX contador="0"> </
LCARDEX> </ return>
</ Ns1: RunActionResponse>
</ SOAP-ENV: Body>
</ SOAP-ENV: Envelope>

Perfect, no problem. Harbour using CURLS as SoapUI.

But the point is not that the question is to do hard work back through
the response of webservices.

Regards

rafa thefull

unread,
Aug 14, 2012, 7:47:58 AM8/14/12
to harbou...@googlegroups.com
Hi Claudia

I put real example functional, for view diferent using SOAP ActiveX, or
CURL ;

function Example_soap_CURL()
local endpointUrl,curlHandle,curlErr
local aHeader,chpmserv,cc1

Local cXML := [ <soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:web="http://www.dataaccess.com/webservicesserver/">]
cXml += [ <soapenv:Header/> ]
cXml += [ <soapenv:Body> ]
cXml += [ <web:InvertStringCase> ]
cXml += [ <web:sAString>HELLO look my
CharActers!!</web:sAString> ]
cXml += [ </web:InvertStringCase>
]
cXml += [ </soapenv:Body>
]
cXml += [</soapenv:Envelope> ]

cc1 := ""

caction := ""
endpointUrl :=
"http://www.dataaccess.com/webservicesserver/textcasing.wso"

aHeader := {}
AADD(aHeader,"Accept-Encoding: gzip,deflate" )
AADD(aHeader,"Content-Type: text/xml;CHARSET=UTF-8")
AADD(aHeader,"SOAPAction: "+caction)
AADD(aHeader,"Content-length: "+ Str( len( cXml )) )

curlHandle := curl_easy_init()

if !empty(curlHandle)

/* Specify the Header data */
curl_easy_setopt(curlHandle,HB_CURLOPT_HTTPHEADER,aHeader)

/* Set the endpoint to send the POST to */
curl_easy_setopt(curlHandle, HB_CURLOPT_URL, endpointUrl)

/* Setup response data */
curl_easy_setopt( curlHandle, HB_CURLOPT_DOWNLOAD )
curl_easy_setopt( curlHandle, HB_CURLOPT_DL_BUFF_SETUP )

/* Specify the POST data */
curl_easy_setopt(curlHandle, HB_CURLOPT_POST, 1)
curl_easy_setopt(curlHandle, HB_CURLOPT_POSTFIELDS, cxml)

/* Do everything */
curlErr := curl_easy_perform(curlHandle)

/* Report any errors */
if empty(curlErr)
/* store response in variable */
cc1 := curl_easy_dl_buff_get( curlHandle )
Alert( cc1 )
else
Alert( "Error:" + curl_easy_strerror(curlErr) )
endif
else
Alert( "No handle" )
endif

if !empty(curlHandle)
/* Clean-up libcurl */
curl_global_cleanup( curlHandle )
else
Alert( "Error" )
endif

if empty(cc1)
Alert( "Error" )
endif

return cc1


regards

Clippero

unread,
Aug 14, 2012, 8:48:51 AM8/14/12
to harbou...@googlegroups.com
[Esp]

Rafa y Claudia

He seguido de cerca sus publicaciones y agradezco el material que es de mucha ayuda.

En mi caso el ejemplo usando las funciones de la libcurl están bien.

Mi "problema" es que en ningún momento se me indica cómo escribir el archivo .xml que se usará con el WS

Concretamente a mi se me suministró por parte de los desarrolladores del sistema web un .pdf con ciertos datos para que yo pudiera exportarle datos de mi sistema de escritorio a su sistema web.

Con esos datos yo tengo que recorrer mi .dbf (donde tengo los datos a exportar) y lograr exportar mis datos al sistema web, usando el WS de dicho sistema.

Por eso digo en mails anteriores que si bien la función de Claudia me podría servir, no se cómo escribir el .xml que esa función recibe como parámetro.
Hasta donde entiendo dicho .xml tiene que tener el formato adecuado según lo requiere el WS
Por otra parte la idea es hacer todo de forma automática, se hace la factura en mi sistema, se registra y al mismo momento se consume el WS para hacer efectivo el registro de dicha factura en el otro sistema, como si se tratata de un solo sistema.
Esto del WS, no es lo que yo había hecho antes para intercambio de datos con otros sistemas (escribir un .xml para que otro sistema lo use)

Estos son los datos que se me suministraron:

--------------------------------

Dirección

Servicio. http://localhost/sistema/servlet/aimpwsmovimientos
Descripción. http://localhost/sistema/servlet/aimpwsmovimientos?wsdl
 
Método
Execute (Empresa, Contraseña, Lista de Movimientos, Error)
 
Parámetros
Empresa. Alfanumérico por Valor. Código de la Empresa del Sistema, que
el Servicio Web utilizará para determinar en cual de las Empresas se
actualizarán o insertarán los datos.


Contraseña. Alfanumérico por Valor. Clave de la Empresa del Sistema
que el Servicio Web utilizará para determinar el acceso o no a los datos de la

Empresa. MovimientosSDT. Lista de MovimientosSDTMovimeintoItem por Valor.
Lista de Movimientos a insertar por el Servicio Web, en la estructura
MovimientosSDTMovimientoItem.
 
Error. Alfanumérico por Referencia. Mensaje de error informado por el
Servicio Web en caso que alguna validación impida la actualización o inserción
cuando el retorno es vacío el Servicio Web ha ejecutado la actualización o
inserción correctamente.
 
Resultado
 Ok. Numérico. 0 indica que el Método se ejecuto correctamente.

MovimientosSDT. Lista de MovimientosSDTMovimeintoItem por
Referencia. Lista de Movimientos en el cual el Servicio Web retornará el o los
Movimientos resultantes de la selección, en la estructura
MovimientosSDTMovimientoItem.

Estructura (MovimientosSDTMovimientoItem )
-------------------------------------------------------------------------  
Campo  Descripción                             Tipo
-------------------------------------------------------------------------
ID     Identificador del Movimiento.           Numérico (8)
       Obligatorio en todos los Ítems de un
       mismo Movimiento, es de uso
       temporal para identificar el
       Movimiento.
       Los Movimientos de Ventas además
       deben respetar la unicidad de
       Comprobante, Serie y Número.

Tipo   Tipo de Ítem del Movimiento.            Alfanumérico (1) (C/L/F)  
       Obligatorio en todos los Ítems de un
       mismo Movimiento.  
       1. Obligatoriamente un único Item del
       Tipo C – Cabezal por Movimiento. 
       2. Obligatoriamente al menos un Ítem
       del Tipo L – Líneas de Artículo por
       Movimiento. 
       3. Exclusivamente en los
       Comprobantes que posean Formas
       de Pago, al menos un Ítem del Tipo F
       – Forma de Pago por Movimiento.

Y unos cuántos datos mas....

[Eng. Google]

Rafa and Claudia

I have followed closely its publications and appreciate the material that is very helpful.

In my case the example using libcurl functions are Ok.

My "problem" is that at no time telling me how to write. Xml file to use with the WS

Specifically I provided to my by a web system developers. Pdf with some data for me to export data from my desktop system to your web system.

With these data I have to process my. Dbf (where I have to export data) and achieve export my data to the web system using the WS of the system.

So I say in previous mails that while the role of Claudia I would do, not how to write. Xml that function as a parameter.
As far as I understand this. Xml must have the appropriate format as required by WS
Moreover, the idea is to do everything automatically, the invoice is in my system, it is saved and at the same time consuming the WS to implement the registration of that invoice in the other system, as if it were a single system .
WS This is not what I had done before for data exchange with other systems (writing a. Xml to another system in use)

This is the data that I provided:


--------------------------------

URL

Service. http://localhost/sistema/servlet/aimpwsmovimientos
Description. http://localhost/sistema/servlet/aimpwsmovimientos?wsdl
 
Method
Execute (Empresa, Contraseña, Lista de Movimientos, Error)
 
Paráms
Empresa. Alphanumeric by value. Company Code System, which
Web Service used to determine which of the companies are
update or insert data.


Contraseña. Alphanumeric by value. Key System Company
the Web Service used to determine whether or not access data
Company.


MovimientosSDT.
List MovimientosSDTMovimeintoItem for Valor.
Moves List to add the Web Service, the structure
MovimientosSDTMovimientoItem.

 
Error. Alphanumeric by reference. Error message reported by the
Web Service in case some validation to prevent the update or insert
when the return is empty Web Service has run the update or
insert properly.

 
Result
 Ok. Numeric. 0 indicates that the method succeeded.


Struct of (MovimientosSDTMovimientoItem )
-------------------------------------------------------------------------  
Field  Description                             Type
-------------------------------------------------------------------------
ID     ID Movement.                      Numeric (8)

Tipo   Type of Item Movement.            Alphanumeric (1) (C/L/F)  

And some more .... how much data...


Claudia Neumann

unread,
Aug 14, 2012, 10:48:27 AM8/14/12
to harbou...@googlegroups.com, rafa thefull
Hi Rafe,

I think real XML code does not use the square brackets. May be your example
webservice accepts it. The webservices I use don't accept that.

Saludos

Claudia

Am Dienstag August 14 2012 schrieb rafa thefull:

Claudia Neumann

unread,
Aug 14, 2012, 10:51:57 AM8/14/12
to harbou...@googlegroups.com, Clippero
Hi Fermin,

from this information I can not tell how the XML code should look like. The
webservice administrators should provide you either with a WSDL file or an
example SOAP XML file. Otherwise can only try and fail.

Saludos

Claudia

rafa thefull

unread,
Aug 14, 2012, 11:04:03 AM8/14/12
to harbou...@googlegroups.com
Solicita un XML de ejemplo para probar el sistema, seguramente te lo den.
-----------------------------------------
Request a sample XML to test the system, it will surely give.

Regards

rafa thefull

unread,
Aug 14, 2012, 12:01:01 PM8/14/12
to harbou...@googlegroups.com
Hi
if you need help ;
http://soapclient.com/soaptest.html

Regards

Clippero

unread,
Aug 15, 2012, 8:18:06 AM8/15/12
to harbou...@googlegroups.com
Ok. Rafa, thanks for the data very well the link you sent me.

Fermín

Clippero

unread,
Sep 11, 2012, 10:13:25 AM9/11/12
to harbou...@googlegroups.com, Pritpal Bedi, Fermin Barboza
[Eng Google]

Hello Claudia
I am quite advanced in the topic of WebService.
I did a test in SoapUI and could Register an to a customer with the corresponding WS.
Once I tried this I generated the .xml from SoapUI

The question is, how do I continue now ?

It would have to generate a. equal to the that I have .xml generated with SoapUI but from within my source code and make the WS work as it did in the test with SoapUI

So far what I have is a code that you put in a message, using the library libcurl


[Esp]

Hola Claudia
Estoy bastante avanzado en el tema del WebService.
Ya hice una prueba en SoapUI y pude dar de alta a un cliente con el WS correspondiente.
Una vez probado esto me generé el .xml desde SoapUI

La pregunta es, cómo sigo ahora ?

Tendría que generar un archivo .xml igual al que tengo generado con SoapUI pero desde adentro de mi código fuente y lograr que el WS funcione como lo hizo en el test con SoapUI

Hasta ahora lo que tengo es un código que tu pusiste en un mensaje, usando la librería libcurl

Fermín

Claudia Neumann

unread,
Sep 11, 2012, 10:54:47 AM9/11/12
to harbou...@googlegroups.com, Clippero, Pritpal Bedi
Hola Fermin,

I will try to write an example how you can contact one of the free webservices
with SOAP in harbour and curl. Will take some time.

Saludos

Claudia

john s wolter

unread,
Sep 11, 2012, 11:41:30 AM9/11/12
to harbou...@googlegroups.com, Clippero, Pritpal Bedi
Fermin

Por favor, disculpe por las malas habilidades en español.

Muchos nuevos servicios web RESTful ahora está utilizando la API en lugar de "SOAP". "SOAP" requiere mucho trabajo. Aquí está un artículo de Wikipedia, http://bit.ly/RCZg1w. Ruby-on-Rails, http://bit.ly/UHk2vI, es un router URL. Envuelva su base de datos y dentro de un programa Ruby-Object entonces Ruby-on-Rails URLs encaminará a object-métodos.

Su IE, Firefox, Chrome ahora pueden ser fácilmente programado para interactuar con el Javascript server.using. Yendo aún más el programa servidor podría utilizar Node.js, https://es.wikipedia.org/wiki/Node.js

atentamente,
John S Wolter
------------------------
LinkedIn: johnswolter

- Desk: 734-408-1263
- USA, Eastern Standard Time, -5 GMT, -4 GMT DST

Inglés,

Many new Web Services now are using RESTful API instead of "SOAP".  "SOAP" requires too much work.  Here is a Wikipedia article, http://bit.ly/RCZg1w.  Ruby-on-Rails, http://bit.ly/UHk2vI , is a URL router.  Wrap your database & program inside a Ruby-Object then Ruby-on-Rails will route URLs to Object-methods.  

Your IE, Firefox, Chrome can now be easily programmed to interact with the server.using Javascript.  Going further the server program could use Node.js, https://es.wikipedia.org/wiki/Node.js


Fermin Barboza

unread,
Sep 11, 2012, 12:20:23 PM9/11/12
to johns...@wolterworks.com, harbou...@googlegroups.com, Pritpal Bedi
[Esp]

John, gracias por tu aporte, el problema es que el uso de un ws soap no depende de mi, el sistema que tiene el ws no es mio, es de un tercero, yo tengo que dar de alta datos de mi sistema en ese otro y la forma que implementaron los desarrolladores de dicho sistema fué via ws.


[Eng google]

John, thanks for your input, the problem is that the use of a soap ws not up to me, the system has the ws is not mine, is from a third party, I have to Register an my system data in that other and how they implemented that system developers was via ws.


2012/9/11 john s wolter <johns...@wolterworks.com>

Claudia Neumann

unread,
Sep 11, 2012, 5:30:08 PM9/11/12
to harbou...@googlegroups.com, Clippero, Pritpal Bedi
Hi Clippero,

okay, look at the included files. Hope I explained it clearly enough.

Best regards

Claudia


Am Dienstag September 11 2012 schrieb Clippero:
soap-example.zip

Clippero

unread,
Sep 27, 2012, 10:13:25 AM9/27/12
to harbou...@googlegroups.com
[Esp]

Hola Claudia.
Primero que nada estoy muy agradecido por tu ayuda, el código que me enviaste funcionó a la perfección, tanto en tu ejemplo como en la implementación que hice adaptando tu código.

Puedo dar de alta clientes sin problemas en el Webservice que estoy consumiendo.

El único problema que tengo es con el archivo xml que retorna el ws

En "nuestro" código se hace lo siguiente:

canswer := fHttpExecute(cxml)
canswer := strtran(canswer,"><",">"+chr(10)+"<")
memowrit("respuesta.txt",canswer)

El archivo respuesta.txt es ilegible, es un archivo con caracteres no válidos.

En las pruebas con SoapUI puedo ver una respuesta en formato xml y puedo ver los errores o aciertos al consumir el WS, pero corriendo el programita desde Harbour cuando intento ver el respuesta.txt me encuentro con un archivo con caracteres inválidos.

Te adjunto el último archivo respuesta.txt generado por si te sirve de algo.

Desde ya, mil gracias por tu ayuda.


[Eng]

Hi Claudia.
First of all I am very grateful for your help, the code you sent me worked perfectly, in your example as I did in implementing adapting your code.

I can enlist customers without problems Webservice I'm consuming.

The only problem I have is with the xml file that returns the ws

In "our" code does the following:

canswer: = fHttpExecute (cXML)
canswer
: = STRTRAN (canswer, "> <", ">" + chr (10) + "<")
MEMOWRIT
("respuesta.txt" canswer)

File respuesta.txt is illegible, is a file with invalid characters.

In tests with SoapUI I can see a response in XML format and I can see the mistakes or successes to consume the WS, but ran the little program from Harbour when trying to view the respuesta.txt I find a file with invalid characters.

I am attaching the last file generated respuesta.txt if it's something.

Of course, many thanks for your help.

Claudia Neumann

unread,
Sep 27, 2012, 11:42:03 AM9/27/12
to harbou...@googlegroups.com, Clippero
Hola Clippero,

donde es el anexo?

Saludos

Claudia

Clippero

unread,
Oct 2, 2012, 8:10:13 AM10/2/12
to harbou...@googlegroups.com, Clippero
[Eng]

Claudia Hello, good morning, (it rains a lot here)
When ws answer file I changed it to respuesta.zip and only thing I could unzip with WinRar was as follows:

HB_RUN("WinRar e respuesta.zip")

It's not what I like but it works and until something new that works, I'll keep using this method.
Also as I said before my app runs on Win

Now that I was fine with this ws (in large part thanks to you) I will try the other, stock, vouchers, etc.

Once again thanks for everything.

If complicated with something I spoken about the subject already who can give me a hand :-)


Fermín


[Esp]

Hola Claudia, buen día, (acá llueve mucho)
Al archivo de respuesta del ws lo cambié a respuesta.zip y con lo único que pude descomprimirlo fué con WinRar de la siguiente manera:

HB_RUN("WinRar e respuesta.zip")

No es lo que mas me gusta pero funciona y hasta que aparezca algo nuevo que funcione, voy a seguir usando este método.
Además como te comenté antes mi aplicación corre sobre Win

Ahora que me fué bien con este ws (en gran parte gracias a vos) voy a probar con los demás, stock, comprobantes, etc.

Una vez mas gracias por todo.

Si me complico con algo referido a este tema ya se quien me puede dar una mano :-)
Reply all
Reply to author
Forward
0 new messages