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.