aspose file tools*
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


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Error while Calling createService in DII Client" Watch "Error while Calling createService in DII Client" New topic
Author

Error while Calling createService in DII Client

Naveen Sivashankar
Greenhorn

Joined: Aug 26, 2004
Posts: 2
Hi,
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>(XSDDateTimeDateEncoder.java:195)
at com.sun.xml.rpc.encoding.soap.StandardSOAPTypeMappings.<init>(StandardSOAPTypeMappings.java:563)
at com.sun.xml.rpc.encoding.StandardTypeMappings.getSoap(StandardTypeMappings.java:32)
at com.sun.xml.rpc.client.BasicService.createSoapMappings(BasicService.java:228)
at com.sun.xml.rpc.client.BasicService.createStandardTypeMappingRegistry(BasicService.java:200)
at com.sun.xml.rpc.client.BasicService.<init>(BasicService.java:79)
at com.sun.xml.rpc.client.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:53)
at com.dot.SampleJavaClient.main(SampleJavaClient.java:22)
Exception in thread "main"

My Code is shown below
package com.dot;

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 = "http://dynamic.org/wsdl";
private static String ENCODING_STYLE_PROPERTY = "javax.xml.rpc.encodingstyle.namespace.uri";
private static String NS_XSD = "http://www.w3.org/2001/XMLSchema";
private static String URI_ENCODING = "http://schemas.xmlsoap.org/soap/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.setTargetEndpointAddress(endpoint);
call.setProperty(Call.SOAPACTION_USE_PROPERTY, new Boolean(true));
call.setProperty(Call.SOAPACTION_URI_PROPERTY, "");
call.setProperty(ENCODING_STYLE_PROPERTY, URI_ENCODING);
QName QNAME_TYPE_STRING = new QName(NS_XSD, "string");
QName QNAME_TYPE_INTEGER = new QName(URI_ENCODING, "int");
call.setReturnType(QNAME_TYPE_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);
System.out.println(result);
} catch (Exception ex){
ex.printStackTrace();
}
}
}
Danny Teng
Greenhorn

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
Greenhorn

Joined: Aug 26, 2004
Posts: 2
Thanks a Lot, But now I am getting the following Error
unexpected encoding style: expected=http://schemas.xmlsoap.org/soap/encoding/, actual=
at com.sun.xml.rpc.encoding.SOAPDeserializationContext.verifyEncodingStyle(SOAPDeserializationContext.java:168)
at com.sun.xml.rpc.encoding.ObjectSerializerBase.deserialize(ObjectSerializerBase.java:175)
at com.sun.xml.rpc.encoding.ReferenceableSerializerImpl.deserialize(ReferenceableSerializerImpl.java:155)
at com.sun.xml.rpc.client.dii.CallInvokerImpl._readFirstBodyElement(CallInvokerImpl.java:305)
at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:215)
at com.sun.xml.rpc.client.dii.CallInvokerImpl.doInvoke(CallInvokerImpl.java:80)
at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:489)
at com.dot.SampleJavaClient.main(SampleJavaClient.java:42)

Any Idea??
Danny Teng
Greenhorn

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 = "http://schemas.xmlsoap.org/soap/encoding/";

Try to remove the last slash so it will become:
private static String URI_ENCODING = "http://schemas.xmlsoap.org/soap/encoding";

I hope it might work - cross fingers
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error while Calling createService in DII Client