Java calls. net webservice,. netwebservice

Source: Internet
Author: User

Java calls. net webservice,. netwebservice

The JAVA code is as follows:

Static void testTextString (){
Try {
String methodSayTo = "test ";
// Define the service
Service service = new Service ();


Call call2 = (Call) service. createCall ();
Call2.setTargetEndpointAddress (new java.net. URL ("http: // localhost: 21972/Service1.asmx"); //. net websevice address
Call2.setUseSOAPAction (true );
Call2.setReturnType (new QName ("http://www.w3.org/2001/XMLSchema", "string "));
// Method 2 for setting the return value type to String
Call2.setOperationName (new QName ("http://192.168.40.133.org/", methodSayTo); // namespace
Call2.setSOAPActionURI ("http://192.168.40.133.org/test"); // namespace + function name
Call2.addParameter (new QName ("http://192.168.40.133.org/", "name"), // The parameter name of. net webservice
XMLType. XSD_STRING, ParameterMode. IN );
String retVal2 = (String) call2
. Invoke (new Object [] {"asp webservice"}); // asp webservice is the string to be passed
System. out. println (retVal2 );


} Catch (Exception e ){
// TODO: handle exception
}
}



Reference: http://blog.csdn.net/xw13106209/article/details/7067495

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.