Today, we tested. NET 2.0's WebService and found a major problem. The parameter cannot be obtained. The parameter is always null. Of course, use. Net to call
No problem, and the Web Test page is normal. Both Delphi7 and Java call results are the same. Is it a. NET 2.0 bug?
Test results show that all value type parameters are default values, and all reference types are null.
WebServiceCodeAs follows:
[Webmethod]
Public String echostring (string ARGs)
{
Return ARGs;
}
[Webmethod]
Public String echoint (INT ARGs)
{
Return args. tostring ();
}
Code called by Delphi
Procedure tform1.button3click (Sender: tobject );
VaR
SS: servicesoap;
Hello: widestring;
Begin
Try
Httprio1.wsdllocation: = edtaddress. text;
Httprio1.service: = edit3.text;
Httprio1.port: = edit4.text;
SS: = (httprio1 as servicesoap );
Hello: = 'hello ';
Memo1.lines. Add (ss. echoint (234 ));
Except
On E: exception do
Showmessage (E. Message );
End;
End;
Bytes ---------------------------------------------------------------------------------------------------
-----------------------------------------------
The Web services generated by vs2003 are constantly found. Delphi does not have any problems when calling them, and even delphi2006 cannot work properly.
Call the. NET 2.0 web service.
Finally, after unremitting efforts, we finally found a way to add a line in the WebServices declarative unit generated by Delphi.
Invregistry. registerinvokeoptions (typeinfo (servicesoap), iodocument );
For example:
Unit Service;
Interface
Uses invokeregistry, soaphttpclient, types, xsbuiltins;
Type
Servicesoap = interface (iinvokable)
['{77573149-9c57-fa51-f11f-efd527c91bd9}']
Function helloworld (const ASDF: widestring): widestring; stdcall;
End;
Implementation
Type
Servicesoapimpl = Class (tinvokableclass, servicesoap)
Public
{Servicesoap}
Function helloworld (const ASDF: widestring): widestring; stdcall;
End;
Function servicesoapimpl. helloworld (const ASDF: widestring): widestring;
Begin
{Todo-implement method helloworld}
End;
Initialization
Invregistry. registerinterface (typeinfo (servicesoap), 'HTTP: // tempuri.org/', 'utf-8 ');
Invregistry. registerinvokableclass (servicesoapimpl );
Invregistry. registerdefaultsoapaction (typeinfo (servicesoap), 'HTTP: // tempuri.org/helloworld ');
Invregistry. registerinvokeoptions (typeinfo (servicesoap), iodocument); // this line
End.
Now the problem is fixed.However, after my tests, I found that the problem still persists.
Solved,
Add the soaprpcserviceattribute attribute to the class attribute of the WebService written in vs2005.
For example:
[Soaprpcservice (routingstyle = soapserviceroutingstyle. soapaction)]