Posted: Fri Sep 05, 2008 8:49 pm
Rafa,
Muchas gracias!
Muchas gracias!
www.FiveTechSoft.com
https://forums.fivetechsupport.com/
Antonio Linares wrote:Rafa,
Muchas gracias!
Code: Select all | Expand
*--// Para WebService Saludar (Regresa el clásico Hola Mundo)
cLink:='http://localhost/saludar.asmx/Saludar?WSDL'
*--// Para WebService CaF (Convierte de Celsius a Fahrenheit, devuelve un valor Double)
cLink:='http://localhost/saludar.asmx/CaF?valor=45'
*--// Para WebService FaC (Convierte de Fahrenheit a Celsius, devuelve un valor Double)
cLink:='http://localhost/saludar.asmx/FaC?valor=120'
cTipVar:='string'
do case
case 'WSDL'$cLink; cTipVar:='string'
case 'CaF' $cLink; cTipVar:='double'
case 'FaC' $cLink; cTipVar:='double'
endc
*--// Consumiendo Web Service a traves del metodo HTTP GET
objXML:=CreateObject("Microsoft.XMLDOM")
objXML:async:=.F. // El analizador no devolverá el control a su código hasta que el documento se haya cargado
if objXML:Load( cLink )
? objXML:getElementsByTagName( cTipVar ):item(0):text
else
? 'Error ' +str(oBjXML:ParseError:ErrorCode)+CRLF+;
'Descripción '+oBjXML:ParseError:Reason +CRLF+;
'Línea ' +str(oBjXML:ParseError:Line) +CRLF+;
'URL ' +oBjXML:ParseError:Url +CRLF+;
'Fuente ' +oBjXML:ParseError:srcText
endi
Code: Select all | Expand
<%@ WebService Language="C#" Class="HolaMundoWebS" %>
using System.Web.Services;
[WebService(
Namespace="http://localhost/",
Description="Hola, Mundo al estilo Web Service")]
public class HolaMundoWebS {
[WebMethod(Description="Devuelve la cadena Hola, Mundo")]
public string Saludar() {
return "Hola, Mundo";
}
[WebMethod(Description="Convierte de Fahrenheit a Celsius, devuelve un valor Double")]
public double FaC(double valor)
{ const double fc = (5.0 / 9.0);
return ((valor - 32) * fc);
}
[WebMethod(Description="Convierte de Celsius a Fahrenheit, devuelve un valor Double")]
public double CaF(double valor)
{ const double fc = (5.0 / 9.0);
return (valor / fc + 32);
}
}
Code: Select all | Expand
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
Web Site Administration Tool to configure settings for your application. Use
the Web site->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings/>
<connectionStrings/>
<system.web>
<customErrors mode="Off"/>
<webServices>
<protocols>
<add name="HttpGet"/>
<remove name="HttpPost"/>
<add name="HttpSoap"/>
<add name="Documentation"/>
</protocols>
</webServices>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="false"/>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
<authentication mode="Windows"/>
-->
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm"/>
<error statusCode="404" redirect="FileNotFound.htm"/>
</customErrors>
-->
</system.web>
</configuration>