mahnaz0098
یک شنبه 27 اسفند 1391, 22:16 عصر
سلام
من یه کد دلفی دارم برای ارسال پیامک از طریق یه وب سرویس . در کد زیر فقط تابع GetCredit آورده شده .
ولی موقع اجرای کد یه خطا بهم میده.
SendSoap = interface(IInvokable)
['{35F07DE4-77E4-9B43-028F-73006EDFAAD7}']
function GetCredit(const username: string; const password: string): string; stdcall;
end;
function GetCredit_SendSoap(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): SendSoap;
implementation
uses SysUtils;
function GetCredit_SendSoap(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): SendSoap;
const
defWSDL = 'http://panizsms.ir/post/send.asmx?wsdl';
defURL = 'http://panizsms.ir/post/send.asmx';
defSvc = ' Send ';
defPrt = ' SendSoap ';
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 SendSoap);
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(SendSoap), 'http://tempuri.org/', 'utf-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(Sen dSoap),'http://tempuri.org/%operationName%');
InvRegistry.RegisterInvokeOptions(TypeInfo(SendSoa p), ioDocument);
end.
خطا :
Server did not recognize the value of HTTP Header SoapAction http://tempuri.org/GetCredit
چند تا سوال داشتم
اول اینکه علت این خطا چیه؟
دوم اینکه
SendSoap = interface(IInvokable)
['{35F07DE4-77E4-9B43-028F-73006EDFAAD7}']
چه کاری انجام میده و آیا این شماره ها برای هر وب سرویسی منحصر به فرده؟؟ چون من فقط این شماره ها رو از روی یه کد دیگه گرفتم .
سوم اینکه آیا باید به جای http://tempuri.org مقدار دیگری جایگزین شود یا دقیقا همین مقدار در کد قرار داده شود ؟؟
من یه کد دلفی دارم برای ارسال پیامک از طریق یه وب سرویس . در کد زیر فقط تابع GetCredit آورده شده .
ولی موقع اجرای کد یه خطا بهم میده.
SendSoap = interface(IInvokable)
['{35F07DE4-77E4-9B43-028F-73006EDFAAD7}']
function GetCredit(const username: string; const password: string): string; stdcall;
end;
function GetCredit_SendSoap(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): SendSoap;
implementation
uses SysUtils;
function GetCredit_SendSoap(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): SendSoap;
const
defWSDL = 'http://panizsms.ir/post/send.asmx?wsdl';
defURL = 'http://panizsms.ir/post/send.asmx';
defSvc = ' Send ';
defPrt = ' SendSoap ';
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 SendSoap);
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(SendSoap), 'http://tempuri.org/', 'utf-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(Sen dSoap),'http://tempuri.org/%operationName%');
InvRegistry.RegisterInvokeOptions(TypeInfo(SendSoa p), ioDocument);
end.
خطا :
Server did not recognize the value of HTTP Header SoapAction http://tempuri.org/GetCredit
چند تا سوال داشتم
اول اینکه علت این خطا چیه؟
دوم اینکه
SendSoap = interface(IInvokable)
['{35F07DE4-77E4-9B43-028F-73006EDFAAD7}']
چه کاری انجام میده و آیا این شماره ها برای هر وب سرویسی منحصر به فرده؟؟ چون من فقط این شماره ها رو از روی یه کد دیگه گرفتم .
سوم اینکه آیا باید به جای http://tempuri.org مقدار دیگری جایگزین شود یا دقیقا همین مقدار در کد قرار داده شود ؟؟