axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Jordahl <tjord...@adobe.com>
Subject RE: No serializer found for class java.util.Locale in registry org.apache.axis.encoding.TypeMappingDelegate@6025e7
Date Mon, 27 Apr 2009 14:19:52 GMT
Do not include Java specific types like this in the function signature of a web service.  Remember,
a client which is NOT Java should be able to use your service.  A better approach would be
to take a string that is a standard name of a locale (i.e. "en_US") that you define as part
of the contract for your service.

Do not think of web services as a form of Java RMI or RPC - you use a web service when you
would like to publish a service that *any* language or script can use, or even someone who
is hand coding XML and POSTing it to the service.  *Objects* are not transmitted over the
network connect, *data* is.

I hope that gets you on the right track.

Tom Jordahl

-----Original Message-----
From: Norio Sasagawa [mailto:n-sasagawa@ka2.so-net.ne.jp]
Sent: Saturday, April 25, 2009 9:53 AM
To: axis-dev@ws.apache.org
Subject: No serializer found for class java.util.Locale in registry org.apache.axis.encoding.TypeMappingDelegate@6025e7

Dear all,

please help me.
i'm using Tomcat V6.0 and Axis 1.4.
i've got a mapping error.
when putting a Loacle parameter, a mapping error occurred.
when omitting a Locale parameter, no error occurred and it works fine.
what should i do ?

Best Regards.


Stack trace are below.

        {http://xml.apache.org/axis/}stackTrace:java.io.IOException: [en]-(No serializer found
for class
java.util.Locale in registry org.apache.axis.encoding.TypeMappingDelegate@6025e7)
        at org.apache.axis.encoding.SerializationContext.serializeActual(SerializationContext.java:1507)
        at org.apache.axis.encoding.SerializationContext.serialize(SerializationContext.java:980)
        at org.apache.axis.encoding.SerializationContext.outputMultiRefs(SerializationContext.java:1055)
        at org.apache.axis.message.SOAPBody.outputImpl(SOAPBody.java:145)
        at org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:478)
        at org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
        at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:315)
        at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:269)
        at org.apache.axis.SOAPPart.saveChanges(SOAPPart.java:530)
        at org.apache.axis.attachments.AttachmentsImpl.getAttachmentCount(AttachmentsImpl.java:554)
        at org.apache.axis.Message.getContentType(Message.java:486)
        at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:343)
        at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)

        at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
        at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
        at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
        at org.apache.axis.client.Call.invoke(Call.java:2767)
        at org.apache.axis.client.Call.invoke(Call.java:2443)
        at org.apache.axis.client.Call.invoke(Call.java:2366)
        at org.apache.axis.client.Call.invoke(Call.java:1812)
        at TestClient.TestClient.main(TestClient.java:81)

        {http://xml.apache.org/axis/}hostname:FM-B05870457267

java.io.IOException: [en]-(No serializer found for class java.util.Locale in registry org.apache.axis.encoding.TypeMappingDelegate@6025e7)
        at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
        at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:317)
        at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:269)
        at org.apache.axis.SOAPPart.saveChanges(SOAPPart.java:530)
        at org.apache.axis.attachments.AttachmentsImpl.getAttachmentCount(AttachmentsImpl.java:554)
        at org.apache.axis.Message.getContentType(Message.java:486)
        at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:343)
        at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)

        at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
        at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
        at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
        at org.apache.axis.client.Call.invoke(Call.java:2767)
        at org.apache.axis.client.Call.invoke(Call.java:2443)
        at org.apache.axis.client.Call.invoke(Call.java:2366)
        at org.apache.axis.client.Call.invoke(Call.java:1812)
        at TestClient.TestClient.main(TestClient.java:81)
Caused by: java.io.IOException: [en]-(No serializer found for class java.util.Locale in registry
org.apache.axis.encoding.TypeMappingDelegate@6025e7)
        at org.apache.axis.encoding.SerializationContext.serializeActual(SerializationContext.java:1507)
        at org.apache.axis.encoding.SerializationContext.serialize(SerializationContext.java:980)
        at org.apache.axis.encoding.SerializationContext.outputMultiRefs(SerializationContext.java:1055)
        at org.apache.axis.message.SOAPBody.outputImpl(SOAPBody.java:145)
        at org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:478)
        at org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
        at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:315)
        ... 16 more
Exception in thread "main" AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode:
 faultString: [en]-(No serializer found for class java.util.Locale in registry org.apache.axis.encoding.TypeMappingDelegate@6025e7)
 faultActor:
 faultNode:
 faultDetail:
        {http://xml.apache.org/axis/}stackTrace:java.io.IOException: [en]-(No serializer found
for class
java.util.Locale in registry org.apache.axis.encoding.TypeMappingDelegate@6025e7)
        at org.apache.axis.encoding.SerializationContext.serializeActual(SerializationContext.java:1507)
        at org.apache.axis.encoding.SerializationContext.serialize(SerializationContext.java:980)
        at org.apache.axis.encoding.SerializationContext.outputMultiRefs(SerializationContext.java:1055)
        at org.apache.axis.message.SOAPBody.outputImpl(SOAPBody.java:145)
        at org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:478)
        at org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
        at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:315)
        at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:269)
        at org.apache.axis.SOAPPart.saveChanges(SOAPPart.java:530)
        at org.apache.axis.SOAPPart.getContentLength(SOAPPart.java:229)
        at org.apache.axis.Message.getContentLength(Message.java:510)
        at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:371)
        at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)

        at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
        at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
        at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
        at org.apache.axis.client.Call.invoke(Call.java:2767)
        at org.apache.axis.client.Call.invoke(Call.java:2443)
        at org.apache.axis.client.Call.invoke(Call.java:2366)
        at org.apache.axis.client.Call.invoke(Call.java:1812)
        at TestClient.TestClient.main(TestClient.java:81)

        {http://xml.apache.org/axis/}hostname:FM-B05870457267

java.io.IOException: [en]-(No serializer found for class java.util.Locale in registry org.apache.axis.encoding.TypeMappingDelegate@6025e7)
        at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
        at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:317)
        at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:269)
        at org.apache.axis.SOAPPart.saveChanges(SOAPPart.java:530)
        at org.apache.axis.SOAPPart.getContentLength(SOAPPart.java:229)
        at org.apache.axis.Message.getContentLength(Message.java:510)
        at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:371)
        at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)

        at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
        at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
        at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
        at org.apache.axis.client.Call.invoke(Call.java:2767)
        at org.apache.axis.client.Call.invoke(Call.java:2443)
        at org.apache.axis.client.Call.invoke(Call.java:2366)
        at org.apache.axis.client.Call.invoke(Call.java:1812)
        at TestClient.TestClient.main(TestClient.java:81)
Caused by: java.io.IOException:  [en]-(No serializer found for class java.util.Locale in registry
org.apache.axis.encoding.TypeMappingDelegate@6025e7)
        at org.apache.axis.encoding.SerializationContext.serializeActual(SerializationContext.java:1507)
        at org.apache.axis.encoding.SerializationContext.serialize(SerializationContext.java:980)
        at org.apache.axis.encoding.SerializationContext.outputMultiRefs(SerializationContext.java:1055)
        at org.apache.axis.message.SOAPBody.outputImpl(SOAPBody.java:145)
        at org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:478)
        at org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
        at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:315)
        ... 16 more

-----<.jws>-----
import java.lang.Object;
import java.util.Locale;
public class TestTest2Locale {
    public String TestTestShowName(String inputString, Locale locale) {
      Locale localeWork = locale.getDefault();
      return("Norio Sasagawa" + localeWork);
    }
    public String TestTestEchoName(String inputString, Locale locale) {
      Locale localeWork = locale.getDefault();
      return(inputString + localeWork);
    }
}

-----<.wsdl>-----
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://DefaultNamespace" xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://DefaultNamespace" xmlns:intf="http://DefaultNamespace"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT) / [en]-(WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT))-->

   <wsdl:message name="TestTestShowNameRequest">

      <wsdl:part name="in0" type="soapenc:string"/>

      <wsdl:part name="in1" type="xsd:anyType"/>

   </wsdl:message>

   <wsdl:message name="TestTestShowNameResponse">

      <wsdl:part name="TestTestShowNameReturn" type="soapenc:string"/>

   </wsdl:message>

   <wsdl:message name="TestTestEchoNameResponse">

      <wsdl:part name="TestTestEchoNameReturn" type="soapenc:string"/>

   </wsdl:message>

   <wsdl:message name="TestTestEchoNameRequest">

      <wsdl:part name="in0" type="soapenc:string"/>

      <wsdl:part name="in1" type="xsd:anyType"/>

   </wsdl:message>

   <wsdl:portType name="TestTest2Locale">

      <wsdl:operation name="TestTestShowName" parameterOrder="in0 in1">

         <wsdl:input message="impl:TestTestShowNameRequest" name="TestTestShowNameRequest"/>

         <wsdl:output message="impl:TestTestShowNameResponse" name="TestTestShowNameResponse"/>

      </wsdl:operation>

      <wsdl:operation name="TestTestEchoName" parameterOrder="in0 in1">

         <wsdl:input message="impl:TestTestEchoNameRequest" name="TestTestEchoNameRequest"/>

         <wsdl:output message="impl:TestTestEchoNameResponse" name="TestTestEchoNameResponse"/>

      </wsdl:operation>

   </wsdl:portType>

   <wsdl:binding name="TestTest2Locale.javaSoapBinding" type="impl:TestTest2Locale">

      <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>

      <wsdl:operation name="TestTestShowName">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="TestTestShowNameRequest">

            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://DefaultNamespace" use="encoded"/>

         </wsdl:input>

         <wsdl:output name="TestTestShowNameResponse">

            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://DefaultNamespace" use="encoded"/>

         </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="TestTestEchoName">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="TestTestEchoNameRequest">

            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://DefaultNamespace" use="encoded"/>

         </wsdl:input>

         <wsdl:output name="TestTestEchoNameResponse">

            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://DefaultNamespace" use="encoded"/>

         </wsdl:output>

      </wsdl:operation>

   </wsdl:binding>

   <wsdl:service name="TestTest2LocaleService">

      <wsdl:port binding="impl:TestTest2Locale.javaSoapBinding" name="TestTest2Locale.java">

         <wsdlsoap:address location="http://localhost:8080/axis/TestTest2Locale.java"/>

      </wsdl:port>

   </wsdl:service>

</wsdl:definitions>


-----<client test code>-----
package TestClient ;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import org.apache.axis.utils.Options;

import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;

import java.util.Locale;
import java.io.Serializable;

public class TestClient implements Serializable
{
   public static void main(String [] args) throws Exception {
       Options options = new Options(args);

       String endpoint = "http://localhost:" + options.getPort() +
                         "/axis/TestTest2Locale.jws";

       args = options.getRemainingArgs();

       if (args == null || args.length > 2) {
           System.err.println("Usage: TestClient <TestTestShowName|TestTestEchoName>
arg1-1 ");
           return;
       }

       String method = args[0];
       if (!(method.equals("TestTestShowName") || method.equals("TestTestEchoName"))) {
           System.err.println("Usage: TestClient <TestTestShowName|TestTestEchoName>
arg1-2 ");
           return;
       }

       String sTring = new String(args[1]);
       Locale localeString = new Locale("jp");

       Service  service = new Service();
       Call     call    = (Call) service.createCall();

       call.setTargetEndpointAddress( new java.net.URL(endpoint) );
       call.setOperationName( new QName( endpoint, method ));
       call.addParameter( "in0", XMLType.XSD_STRING, ParameterMode.IN );
       call.addParameter( "in1", XMLType.XSD_ANYTYPE, ParameterMode.IN );
       call.setReturnType( XMLType.XSD_STRING );

       System.err.println("endpoint:" + endpoint);
       System.err.println("method  :" + method);
       System.err.println("sTring  :" + sTring);
       System.err.println("locale  :" + localeString);


       String ret = (String) call.invoke( new Object [] { sTring, localeString });
       System.out.println("Name : " + ret);
   }
}


Mime
View raw message