Jre6.0 has added support for WebService and does not need to use open-source class libraries.
Take a lookCode:
@ WebService (name = "testws", servicename = "testws ") public class testws {/*** test the addition method * @ Param x * @ Param y * @ return */@ webmethodpublic int testmethod (int x, int y) {return x + y ;}}
/*** @ Author v. xieping **/public class program {/*** @ Param ARGs */public static void main (string [] ARGs) {endpoint. publish ("http: // 192.168.53.43: 8090/cseventws/testws", new testws (); threadwaitor. keepwait ();}}
Use this method
Http:/// 192.168.53.43: 8090/cseventws/testws
This address can access this WebService.
However, the strange problem is that I am a nusoap class library and cannot be called as before. Three problems were found in the test.
1. WSDL Problems
But use the address Http:/// 192.168.53.43: 8090/cseventws/testws
Or address
Http: // 192.168.53.43: 8090/cseventws/testws? WSDL
When a nusoap object is created, it cannot be considered as a WSDL object. That is to say, both addresses are non-WSDL addresses.
2. namespace Problems
As we all know, the namespace used in development is "http://tempuri.org/", but not here, it becomes http://ws.csevent /.
Available Http: // 192.168.53.43: 8090/cseventws/testws? WSDL
View such address <definitions targetnamespace = "http://ws.csevent/" name = "testws">
3. Parameter Problems
Generally, the parameters of the WSDL address are related to the name. But it is not here.
$ Params = array ('arg0' => 100, 'arg1' => 200 );
This method is defined.
You can useHttp: // 192.168.53.43: 8090/cseventws/testws? View WSDL
<Types> − <XSD: schema> <XSD: Import namespace = "http://ws.csevent/" schemalocation = "http: // 192.168.53.43: 8090/cseventws/testws? XSD = 1 "/> </XSD: schema> </types>
<Types>
− <XSD: schema>
<XSD: Import namespace = "http://ws.csevent /"
Schemalocation = "http: // 192.168.53.43: 8090/cseventws/testws? XSD = 1 "/>
</XSD: schema>
</Types>
Start http: // 192.168.53.43: 8090/cseventws/testws? The parameter name is displayed after XSD = 1.
<Xs: complextype name = "testmethod">
−
<Xs: sequence>
<Xs: element name = "arg0" type = "XS: int"/>
<Xs: element name = "arg1" type = "XS: int"/>
</Xs: sequence>
</Xs: complextype>
The final call is:
Note: The following code uses the slightphp framework. Implements the preliminary packaging of nusoap.
$ Objsoap = new http_soap ();
$ Client = $ objsoap-> getclient ($ this-> URL, false );
$ Params = array ('arg0' => 100, 'arg1' => 200 );
$ R = $ client-> call ('testmethod', $ Params, 'HTTP: // ws. csevent/', '', false, true );
Debug_util: log ($ R, "service. log ");