Axis1.4 simple example of calling Asp. Net service, axis1.4asp.net
Axis stands for Apache EXtensible Interaction System. there are many versions. The final version of axis1.x is 1.4, and then it comes to axis2.x. version x differs greatly (of course 2. version x is much more efficient ).
Here to access the QQ number status as an example, webservice address: http://webservice.webxml.com.cn/webservices/qqOnlineWebService.asmx? In the browser, you can see the relevant request header information, function name, parameters, and so on.
Jar packages required for Java projects (put in the lib directory ):
Classes to be referenced:
Import javax. xml. namespace. QName;
Import javax. xml. rpc. ServiceException;
Import org. apache. axis. client. Call;
Import org. apache. axis. client. Service;
Finally, the call code is as follows:
1 try {2 3 String endpoint = "http://webservice.webxml.com.cn/webservices/qqOnlineWebService.asmx? Wsdl "; 4 5 // create a service call (Call) 6 Service = new service (); 7 call Call call = (Call) Service. createCall (); 8 9 // set the url of the service to 10 call. setTargetEndpointAddress (new java.net. URL (endpoint); 11 12 // interface function 13 call. setOperationName (new QName ("http://WebXml.com.cn/", "qqCheckOnline"); 14 call. setSOAPActionURI ("http://WebXml.com.cn/qqCheckOnline"); 15 16 // interface parameter 17 call. addParameter (new QName ("http://WebXml.com.cn/", "qqCode"), org. apache. axis. encoding. XMLType. XSD_STRING, javax. xml. rpc. parameterMode. IN); 18 19 // set the return type 20 call. setReturnType (org. apache. axis. encoding. XMLType. XSD_STRING); 21 22 String ret = (String) call. invoke (new Object [] {"997717740"}); 23 24 System. out. println ("status:" + ret); 25 26} 27 28 catch (Exception e) {29 BeanCtx. p (e. toString (); 30}
An error occurred while calling a static variable on both pages of aspnet.
Code ..!!
Since it is static, you do not need an instance. You can call it directly.
What are the mistakes? To be specific.
--------------------
It has nothing to do with your static variables ..
You should have encountered an error in other operations.
You can add if (). Open it if the connection is not opened.
. Net calls java webservice. the java version is axis14.
It is difficult to locate these problems. Are you using WSDL for interconnection? If yes, open the proxy class and check the structure.