[BTS] Java calls. net webservice

Source: Internet
Author: User
The current project requires java to call. net webservice.

You cannot search too many related resources on the Internet. You have to try it on your own.

After a week of joint debugging, it was finally achieved.

Java Clientimport javax. xml. namespace. QName;
Import javax. xml. rpc. ParameterMode;
Import org. apache. axis. client. Call;
Import org. apache. axis. client. Service;

System. out. println ("test SOAP ");

Service service = new Service ();
Call call = (Call) service. createCall ();

String input = "Yes ";

String endpoint = "http: // 11.11.11.11/CAIE. EAI/UploadExpenseToConstract. asmx ";
Call. setTargetEndpointAddress (new java.net. URL (endpoint ));
Call. setOperationName (new QName ("http://CAIE.EAI.ExpenseConstract.WebServices", "ReturnYourInput "));
Call. addParameter ("input", org. apache. axis. encoding. XMLType. XSD_STRING, ParameterMode. IN );
Call. setReturnType (org. apache. axis. encoding. XMLType. XSD_STRING );
Call. setUseSOAPAction (true );
Call. setSOAPActionURI ("http://CAIE.EAI.ExpenseConstract.WebServices/ReturnYourInput ");
String res = (String) call. invoke (new Object [] {input });
System. out. println ("return value =" + res );
System. out. println ("test SOAP ended ");

. Net WebService

Using System;
Using System. Data;
Using System. Web;
Using System. Collections;
Using System. Web. Services;
Using System. Web. Services. Protocols;
Using System. Web. Services. Description;
Using System. ComponentModel;

Namespace CAIE. EAI. ExpenseConstract. WebServices
{
/// <Summary>
/// Summary of UploadExpenseToConstract
/// </Summary>
[WebService (Namespace = "http://CAIE.EAI.ExpenseConstract.WebServices/")]
[WebServiceBinding (ConformsTo = WsiProfiles. BasicProfile1_1)]
[ToolboxItem (false)]
Public class UploadExpenseToConstract: System. Web. Services. WebService
{

[WebMethod ()]
[SoapRpcMethod (Use = SoapBindingUse. Literal, RequestNamespace = "http://CAIE.EAI.ExpenseConstract.WebServices", ResponseNamespace = "http://CAIE.EAI.ExpenseConstract.WebServices")]
Public string ReturnYourInput (string input)
{
String a = input;
System. IO. File. AppendAllText (@ "c: \ temp. log", "Input =" + input + "\ r \ n ");
Return;
}

}
}

Java calls. net mainly to prepare for the subsequent Java to start the BizTalk process.

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.