
Dear Sir, My code is :-
For webService:-
import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebService;
@WebService public class PaymentInfo {
@WebMethod
public String updatePaymentDetails(@WebParam String[] parms)
{
System.out.println("Length of Array = " + parms.length);
return "abcd";
}
}
and for client is:-
import javax.xml.namespace.QName; import javax.xml.rpc.Call; import javax.xml.rpc.ParameterMode; import javax.xml.rpc.Service; import javax.xml.rpc.ServiceFactory;
public class PaymentInfoTestClient {
public static void main(String[] args) {
try {
String NS_XSD = "http://www.w3.org/2001/XMLSchema";
ServiceFactory factory = ServiceFactory.newInstance();
Service service = factory.createService(new QName("http://lhcc.rdmindia.com/", "ATOMService"));
String ENCODING_STYLE_PROPERTY = "javax.xml.rpc.encodingstyle.namespace.uri";
String URI_ENCODING = "http://schemas.xmlsoap.org/soap/encoding/";
Call call = service.createCall(new QName("http://lhcc.rdmindia.com/", "ATOMPort"));
call.setTargetEndpointAddress("http://localhost:8081/lhcc?wsdl");
call.setOperationName(new QName("http://lhcc.rdmindia.com/","updatePaymentDetails"));
QName QNAME_TYPE_STRING = new QName(NS_XSD, "string");
call.setReturnType(QNAME_TYPE_STRING);
call.setProperty(Call.SOAPACTION_USE_PROPERTY, new Boolean(true));
call.setProperty(Call.SOAPACTION_URI_PROPERTY, "");
call.setProperty(ENCODING_STYLE_PROPERTY, URI_ENCODING);
call.setReturnType(QNAME_TYPE_STRING);
call.addParameter("arg0", QNAME_TYPE_STRING,ParameterMode.IN);
String arg0 = new String("123");
String arg1 = new String("40502820");
String arg2 = new String("0715");
String arg3 = new String("21APR2011");
String arg4 = new String("PNR123");
String arg5 = new String("500");
String arg6 = new String("xyz");
String[] parms = {arg0, arg1, arg2, arg3, arg4,arg5, arg6};
String result = (String)call.invoke(parms);
System.out.println(result);
} catch (Exception e) {
e.printStackTrace();
}
}
}
................................................................................. I am passing params (array of string type) its length is 7 , but it is printing only 1, could you please suggest me for this.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.