Que tal Eliseo, algo que quieras corregir en el mensaje ... Muy buen ejemplo, gracias...
HolaMuy bueno amigo, lo voy a probar, se ve sencillo, claro esta muy bien explicado.Saludos
Excelente Eliseo (Y), pregunta, ¿en vez de usar IIS, puedo trabajar con Apache?.Saludos.
No saben como se puede consumir los webservices de un servidor Glassfish desde delphi 2009?
unit Hola1; interface uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns; const IS_OPTN = $0001; IS_UNQL = $0008; type Hola = interface(IInvokable) ['{B73ACEDC-B21B-A805-777D-C86443A1C94A}'] function hola(const arg0: string): string; stdcall; end; function GetHola(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): Hola; implementation uses SysUtils; function GetHola(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): Hola;const defWSDL = 'http://localhost:8080/HolaService/Hola?wsdl'; defURL = 'http://localhost:8080/HolaService/Hola'; defSvc = 'HolaService'; defPrt = 'HolaPort';var RIO: THTTPRIO;begin Result := nil; if (Addr = '') then begin if UseWSDL then Addr := defWSDL else Addr := defURL; end; if HTTPRIO = nil then RIO := THTTPRIO.Create(nil) else RIO := HTTPRIO; try Result := (RIO as Hola); if UseWSDL then begin RIO.WSDLLocation := Addr; RIO.Service := defSvc; RIO.Port := defPrt; end else RIO.URL := Addr; finally if (Result = nil) and (HTTPRIO = nil) then RIO.Free; end;end; initialization InvRegistry.RegisterInterface(TypeInfo(Hola), 'http://hola/', 'UTF-8'); InvRegistry.RegisterDefaultSOAPAction(TypeInfo(Hola), ''); InvRegistry.RegisterInvokeOptions(TypeInfo(Hola), ioDocument); end.
Request <SOAP-ENV:Envelope 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"><SOAP-ENV:Header/><SOAP-ENV:Body><hola xmlns="http://hola/"><arg0>Daniel</arg0></hola></SOAP-ENV:Body></SOAP-ENV:Envelope> Response <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:holaResponse xmlns:ns2="http://hola/"><return>Hola: null</return></ns2:holaResponse></S:Body></S:Envelope>
package hola;import javax.ejb.Stateless;import javax.jws.WebMethod;import javax.jws.WebService;@WebService@Stateless(name = "Hola")public class Hola { @WebMethod public String hola(String param) { return "Hola: " + param; }}
<?xml version="1.0" encoding="utf-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SOAP-ENV:Body> <yq1:hola xmlns:yq1="http://demo/"> <arg0>Daniel</arg0> </yq1:hola> </SOAP-ENV:Body></SOAP-ENV:Envelope>
<?xml version="1.0" encoding="utf-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SOAP-ENV:Body> <ns2:holaResponse xmlns:ns2="http://demo/"> <return>Hola: Daniel</return> </ns2:holaResponse> </SOAP-ENV:Body></SOAP-ENV:Envelope>
<?xml version="1.0" encoding="UTF-8"?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Header/><S:Body><ns2:hola xmlns:ns2="http://hola/"><arg0>Daniel</arg0></ns2:hola></S:Body></S:Envelope>
<?xml version="1.0" encoding="UTF-8"?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:holaResponse xmlns:ns2="http://hola/"><return>Hola: Daniel</return></ns2:holaResponse></S:Body></S:Envelope>