• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Error while Calling createService in DII Client

Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.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){
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic