Meaningless Drivel is fun!
The moose likes Web Services and the fly likes Error while Calling createService in DII Client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Error while Calling createService in DII Client" Watch "Error while Calling createService in DII Client" New topic

Error while Calling createService in DII Client

Naveen Sivashankar

Joined: Aug 26, 2004
Posts: 2
I get the following Error when trying to call a wsdl file using a DII client. Please help me out

java.lang.NoSuchMethodError: java.util.Locale: method <init>(Ljava/lang/String V not found
at com.sun.xml.rpc.encoding.simpletype.XSDDateTimeDateEncoder.<clinit>(
at com.sun.xml.rpc.encoding.soap.StandardSOAPTypeMappings.<init>(
at com.sun.xml.rpc.encoding.StandardTypeMappings.getSoap(
at com.sun.xml.rpc.client.BasicService.createSoapMappings(
at com.sun.xml.rpc.client.BasicService.createStandardTypeMappingRegistry(
at com.sun.xml.rpc.client.BasicService.<init>(
at com.sun.xml.rpc.client.ServiceFactoryImpl.createService(
Exception in thread "main"

My Code is shown below

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 SampleJavaClient {
private static String endpoint = "http://localhost:9085/WEBPROJECT/wsdl/com/ejb/SubManager.wsdl";
private static String qnameService = "SubManagerService";
private static String qnamePort = "SubManager";

private static String BODY_NAMESPACE_VALUE = "";
private static String ENCODING_STYLE_PROPERTY = "javax.xml.rpc.encodingstyle.namespace.uri";
private static String NS_XSD = "";
private static String URI_ENCODING = "";

public static void main(String [] args){
try {
ServiceFactory factory = ServiceFactory.newInstance();
System.out.println("Before Calling createService");
Service service = factory.createService(new QName(qnameService));
System.out.println("After Calling createService");
QName port = new QName(qnamePort);
Call call = service.createCall(port);
call.setProperty(Call.SOAPACTION_USE_PROPERTY, new Boolean(true));
call.setProperty(Call.SOAPACTION_URI_PROPERTY, "");
QName QNAME_TYPE_STRING = new QName(NS_XSD, "string");
call.setOperationName(new QName(BODY_NAMESPACE_VALUE, "getSubsciption"));
call.addParameter("index",QNAME_TYPE_INTEGER, ParameterMode.IN);
Integer [] params = {new Integer(1)};
String result =(String)call.invoke(params);
} catch (Exception ex){
Danny Teng

Joined: Aug 26, 2004
Posts: 2
Hi Naveen,

Your code:
private static String endpoint= "http://localhost:9085/WEBPROJECT/wsdl/com/ejb/SubManager.wsdl";

My advise:
The endpoint should point to your service location instead of pointing to your WSDL. You can find your service location from your WSDL (on your WSDL service element, you will find a port element, and address element). Good luck
Naveen Sivashankar

Joined: Aug 26, 2004
Posts: 2
Thanks a Lot, But now I am getting the following Error
unexpected encoding style: expected=, actual=
at com.sun.xml.rpc.encoding.SOAPDeserializationContext.verifyEncodingStyle(
at com.sun.xml.rpc.encoding.ObjectSerializerBase.deserialize(
at com.sun.xml.rpc.encoding.ReferenceableSerializerImpl.deserialize(
at com.sun.xml.rpc.client.dii.CallInvokerImpl._readFirstBodyElement(
at com.sun.xml.rpc.client.StreamingSender._send(
at com.sun.xml.rpc.client.dii.CallInvokerImpl.doInvoke(
at com.sun.xml.rpc.client.dii.BasicCall.invoke(

Any Idea??
Danny Teng

Joined: Aug 26, 2004
Posts: 2
Hi Naveen,

I am not sure about this one, but I kinda remember to have similar problem like this.

On your code:
private static String URI_ENCODING = "";

Try to remove the last slash so it will become:
private static String URI_ENCODING = "";

I hope it might work - cross fingers
I agree. Here's the link:
subject: Error while Calling createService in DII Client
It's not a secret anymore!