c# JSON return format WEB SERVICEhttps:///article/
Here I use axis to create a class package. First, download the compressed package of axis, then unzip it, and put axis under the webapp. If it can be run, it will be OK.
The webservice created by C# can directly add ?wsdl to access, and then use axis to generate the class:
java -classpath ".;;;;;;;;" .WSDL2Java -o "E:\cjjer" http://s:9999/?wsdl
In the directory E:\cjjer, a series of java files are generated.
Then compile these java files. Note that since this does not produce soapheader requests, you need to modify the java file yourself:
Open * this file and locate it
SOAPHeaderElement head = new SOAPHeaderElement(new PrefixedQName(new ("/webs/", "ReqHeader")));
(null);
try{
("userName").addTextNode("cjjer");
("password").addTextNode("000000");
(true);
}catch(Exception e){
(" soapheader Exception == ");
();
}
_call.addHeader(head);
return _call;
In this way, a SoapHeader will be added. If the prompt class cannot be found, please import .*;
Finally, write the request code:
If no exception occurs, it will be OK. If an exception occurs, it will be handled by yourself.
Compilation:
javac -cp "E:\tomcat6\webapps\axis\WEB-INF\lib\;E:\tomcat6\webapps\axis\WEB-INF\lib\;E:\tomcat6\webapps\axis\WEB-INF\lib\;E:\tomcat6\webapps\axis\WEB-INF\lib\;E:\tomcat6\webapps\axis\WEB-INF\lib\;E:\tomcat6\webapps\axis\WEB-INF\lib\;E:\tomcat6\webapps\axis\WEB-INF\lib\;E:\tomcat6\webapps\axis\WEB-INF\lib\;" com/cjjer/www/webs/*.java -Xlint:unchecked
Run the test:
Here I use axis to create a class package. First, download the compressed package of axis, then unzip it, and put axis under the webapp. If it can be run, it will be OK.
The webservice created by C# can directly add ?wsdl to access, and then use axis to generate the class:
java -classpath ".;;;;;;;;" .WSDL2Java -o "E:\cjjer" http://s:9999/?wsdl
Then compile these java files. Note that since this does not produce soapheader requests, you need to modify the java file yourself:
Open * this file and locate it
protected createCall() throws
This method is written before returningSOAPHeaderElement head = new SOAPHeaderElement(new PrefixedQName(new ("/webs/", "ReqHeader")));
(null);
try{
("userName").addTextNode("cjjer");
("password").addTextNode("000000");
(true);
}catch(Exception e){
(" soapheader Exception == ");
();
}
_call.addHeader(head);
return _call;
In this way, a SoapHeader will be added. If the prompt class cannot be found, please import .*;
Finally, write the request code:
import .*;
import .*;
import .*;
import .*;
import .*;
import ;
import .*;
import .*;
public class TestNet {
// main method
public static void main(String args[]) {
("I'm going to come in, gaga");
try{
String endpoint= "http://s:9999/";
cjjerLocator locator = new cjjerLocator();//
(true);
cjjerSoap service = ();//Get the service object
Member objM= (1);
(());
}
catch (Exception e) {
();
}
}
}
import .*;
import .*;
import .*;
import .*;
import ;
import .*;
import .*;
public class TestNet {
// main method
public static void main(String args[]) {
("I'm going to come in, gaga");
try{
String endpoint= "http://s:9999/";
cjjerLocator locator = new cjjerLocator();//
(true);
cjjerSoap service = ();//Get the service object
Member objM= (1);
(());
}
catch (Exception e) {
();
}
}
}
If no exception occurs, it will be OK. If an exception occurs, it will be handled by yourself.
Compilation:
javac -cp "E:\tomcat6\webapps\axis\WEB-INF\lib\;E:\tomcat6\webapps\axis\WEB-INF\lib\;E:\tomcat6\webapps\axis\WEB-INF\lib\;E:\tomcat6\webapps\axis\WEB-INF\lib\;E:\tomcat6\webapps\axis\WEB-INF\lib\;E:\tomcat6\webapps\axis\WEB-INF\lib\;E:\tomcat6\webapps\axis\WEB-INF\lib\;E:\tomcat6\webapps\axis\WEB-INF\lib\;" com/cjjer/www/webs/*.java -Xlint:unchecked
Run the test:
java -cp "E:\tomcat6\webapps\axis\WEB-INF\lib\;E:\tomcat6\webapps\axis\WEB-INF\lib\;E:\tomcat6\webapps\axis\WEB-INF\lib\;E:\tomcat6\webapps\axis\WEB-INF\lib\;E:\tomcat6\webapps\axis\WEB-INF\lib\;E:\tomcat6\webapps\axis\WEB-INF\lib\;E:\tomcat6\webapps\axis\WEB-INF\lib\;E:\tomcat6\webapps\axis\WEB-INF\lib\;" TestNet