Hi Everybody !
I'm using Apache Axis to invoke web service from internet. I can access a web service wherein no input parameters are required , but whenever I have to pass input parameters, I can't invoke it. Can somebody help me to figure out the problem. Here is my code below:

import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;

public class myClient {
	public static void main (String[] args){
		try{			
			String endpoint = "http://www.webservicex.net/country.asmx?wsdl";
					   
			Service service = new Service();
			Call call = (Call)service.createCall();
			call.removeAllParameters();
			
			call.setTargetEndpointAddress( new java.net.URL(endpoint));
			call.setOperationName(new QName("http://www.webserviceX.NET/GetCountryByCountryCode", "GetCountryByCountryCode"));
						
			call.setProperty(javax.xml.rpc.Call.SOAPACTION_USE_PROPERTY, new Boolean(true));
			call.setProperty(javax.xml.rpc.Call.SOAPACTION_URI_PROPERTY, "http://www.webserviceX.NET/GetCountryByCountryCode");
						 
			call.addParameter("CountryCode", XMLType.XSD_STRING, ParameterMode.IN);
			call.setReturnTypeAsHeader(XMLType.XSD_STRING);			
			 			 
			Object[] inParams = new Object[]{"us"};
			
			String result = (String)call.invoke(inParams);								   
			System.out.println(result);  
			
		}catch(Exception e){
			System.err.println(e.toString());
		}
	}
}

Here is the error response from server:

System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Data.SqlClient.SqlException: Procedure or function 'GetCountryByCountryCode' expects parameter '@CountryCode', which was not supplied.
at WebServicex.country.GetCountryByCountryCode(String CountryCode)
--- End of inner exception stack trace ---

how can I solve it ? any help for me !

someone help me !

I have the sane error, and I am still working on it :(

@Ivan_15

I think you're better off creating a new question and tag it with Java to receive more help for your own specific problem. I'll add this though:

Apache Axis received its last update in 2006. Before trying to solve an issue with parameters I strongly suggest you update to Axis2. You can use the following migration guide to help you make the switch. There's really no point in trying to fix an error that's occuring in code that's been discontinued for over 10 years. Migrating might even solve your problem all on its own.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.