• Post Reply Bookmark Topic Watch Topic
  • New Topic

System.NullArgumentException while testing a DII webservice client  RSS feed

 
Mayur Lanjwar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
package com.may.webservice.jaxrpc;

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;
import javax.xml.rpc.encoding.XMLType;

public class HelloClient {

private static String qnameService = "GeoIPService";//"MyHelloService";
private static String qnamePort = "GeoIPServiceSoap";//"HelloIF";

private static String BODY_NAMESPACE_VALUE =
//"http://schemas.xmlsoap.org/soap/envelope/";
"http://www.webservicex.net/geoipservice.asmx";
//"http://www.webservicex.net/";
//"http://www.webservicex.net/geoipservice.asmx?op=GetGeoIP";
//"http://schemas.xmlsoap.org/wsdl/";

private static String ENCODING_STYLE_PROPERTY =
"javax.xml.rpc.encodingstyle.namespace.uri";
private static String URI_ENCODING =
"http://schemas.xmlsoap.org/soap/encoding/";

public static void main(String[] args) {

//System.out.println("Endpoint address = " + args[0]);

try {
ServiceFactory factory =
ServiceFactory.newInstance();
Service service =
factory.createService(
new QName(BODY_NAMESPACE_VALUE,qnameService));

QName port = new QName(BODY_NAMESPACE_VALUE,qnamePort);

Call call = service.createCall();

call.setPortTypeName(port);
call.setOperationName(
new QName(BODY_NAMESPACE_VALUE,"GetGeoIP"));//"sayHello"

call.setTargetEndpointAddress("http://www.webservicex.net/geoipservice.asmx");//?WSDL

call.setProperty(Call.SOAPACTION_USE_PROPERTY,
new Boolean(true));
call.setProperty(Call.SOAPACTION_URI_PROPERTY,
"http://www.webservicex.net/GetGeoIP");

call.setProperty(ENCODING_STYLE_PROPERTY,
URI_ENCODING);
//call.setProperty(Call.OPERATION_STYLE_PROPERTY, "wrapped");

call.addParameter("input", XMLType.XSD_STRING,
ParameterMode.IN);

call.setReturnType(XMLType.XSD_STRING);

Object[] params = new Object[1];

params[0] = "173.194.74.102";

String result = (String)call.invoke(params);
System.out.println(result);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
 
Duraipandian S Java
Greenhorn
Posts: 3
Eclipse IDE Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please paste the exception stack trace also ?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!