You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by "nodep@libero.it" <no...@libero.it> on 2002/10/16 13:59:43 UTC

Help4Problem with custom serializer

Hi all, I've a problem with my custom (de)serializer. I'm using Apache-
soap2.3.1 & TomCat4.01.
 The client code is:
....
URL url = new URL("http://localhost:8080/soap/servlet/rpcrouter");
    
      Call call = new Call();
          
      SOAPMappingRegistry smr = new SOAPMappingRegistry();
      call.setTargetObjectURI("urn:DataFeedService");
      call.setMethodName("sendMessage");
      call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
      call.setSOAPMappingRegistry(smr);
      DataFeedMessageSerializer msgSer = new DataFeedMessageSerializer
();
      
      smr.mapTypes(Constants.NS_URI_SOAP_ENC,
            new QName("urn:DataFeedService", "DataFeedMessage"),
            DataFeedMessage.class, msgSer, msgSer);
      DataFeedMessage msg = new DataFeedMessage();
            
      Vector params = new Vector();
      params.addElement(new Parameter("msg", 
                   DataFeedMessage.class, msg, null));
      
      call.setParams(params);
      
      try {
         Response resp = call.invoke(url, "");
         if(!resp.generatedFault())
         	{
         		Parameter ret = resp.getReturnValue();
         		Object value = ret.getValue();
         		System.out.println("*\n"+value);
         	}
         	else
         	{
         		Fault fault = resp.getFault();
		System.err.println("--------------------------------");
		System.err.println("Attention:  Fault Condition");
		System.err.println("Code: "+ fault.getFaultCode());
		System.err.println("Description: "+ 
fault.getFaultString());
		System.err.println("--------------------------------");
					
         	}
         
      }
      catch (SOAPException e) {
         System.err.println("Caught SOAPException (" +
                         e.getFaultCode() + "): " +
                         e.getMessage());
      }
   }
....

and the Deployement Descriptor is:
<isd:service 
    xmlns:isd="http://xml.apache.org/xml-soap/deployment"
    id="urn:DataFeedService">
  <isd:provider 
     type="java"
     scope="Request"
     methods="sendMessage">
    <isd:java 
       class="DataFeedService" 
       static="false"/>
  </isd:provider>
  
  <isd:faultListener>org.apache.soap.server.DOMFaultListener
  </isd:faultListener>
  <isd:mappings>
    <isd:map  
       encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
       xmlns:x="urn:DataFeedService" qname="x:DataFeedMessage"
       javaType="DataFeedMessage"
	 xml2JavaClassName="DataFeedMessageSerializer"
	 java2XMLClassName="DataFeedMessageSerializer"
       />
  </isd:mappings>    
</isd:service>

Now, when I run the client, my custom serializer send this:

POST /soap/servlet/rpcrouter HTTP/1.0
Host: localhost:8080
Content-Type: text/xml; charset=utf-8
Content-Length: 524
SOAPAction: ""

<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-
ENV="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<ns1:sendMessage xmlns:ns1="urn:DataFeedService" SOAP-
ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<msg xsi:type="ns1:DataFeedMessage">
<?jsx version="1"?>
<DataFeedMessage alias-ID="0"
 n="0"/>

</msg>
</ns1:sendMessage>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

and, as you can see, I used JSX in my custom (de)serializer 
and "DataFeedMessage" is a generic
object (not a Javabean). But the response is:

HTTP/1.1 500 Internal Server Error
Content-Type: text/xml; charset=utf-8
Content-Length: 613
Date: Wed, 16 Oct 2002 12:21:37 GMT
Server: Java Web Services Developer Pack/1.0-ea1 (HTTP/1.1 Connector)
Set-Cookie: JSESSIONID=9D5D04EFBB4F2D38FE2F24808B3C22E7;Path=/soap

<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-
ENV="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring>Deployment error in SOAP service 
&apos;urn:DataFeedService&apos;: class name 
&apos;DataFeedMessageSerializer&apos; could not be resolved as a 
serializer: DataFeedMessageSerializer</faultstring>
<faultactor>/soap/servlet/rpcrouter</faultactor>
</SOAP-ENV:Fault>

</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Maybe I have to change the encoding-style? 
Can you help me?
Thank you in advance!

Stefano Pedon


--
To unsubscribe, e-mail:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>


Re: Help4Problem with custom serializer

Posted by Scott Nichol <sn...@scottnichol.com>.
Either the class DataFeedMessageSerializer cannot be loaded by Tomcat or
it cannot be cast to Serializer.  Assuming is does indeed implement the
Serializer interface, you must put the class file in
%CATALINA_HOME%\webapps\soap\WEB-INF\classes.

Scott Nichol

----- Original Message -----
From: <no...@libero.it>
To: "soap-user" <so...@xml.apache.org>
Sent: Wednesday, October 16, 2002 7:59 AM
Subject: Help4Problem with custom serializer


Hi all, I've a problem with my custom (de)serializer. I'm using Apache-
soap2.3.1 & TomCat4.01.
 The client code is:
....
URL url = new URL("http://localhost:8080/soap/servlet/rpcrouter");

      Call call = new Call();

      SOAPMappingRegistry smr = new SOAPMappingRegistry();
      call.setTargetObjectURI("urn:DataFeedService");
      call.setMethodName("sendMessage");
      call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
      call.setSOAPMappingRegistry(smr);
      DataFeedMessageSerializer msgSer = new DataFeedMessageSerializer
();

      smr.mapTypes(Constants.NS_URI_SOAP_ENC,
            new QName("urn:DataFeedService", "DataFeedMessage"),
            DataFeedMessage.class, msgSer, msgSer);
      DataFeedMessage msg = new DataFeedMessage();

      Vector params = new Vector();
      params.addElement(new Parameter("msg",
                   DataFeedMessage.class, msg, null));

      call.setParams(params);

      try {
         Response resp = call.invoke(url, "");
         if(!resp.generatedFault())
         {
         Parameter ret = resp.getReturnValue();
         Object value = ret.getValue();
         System.out.println("*\n"+value);
         }
         else
         {
         Fault fault = resp.getFault();
System.err.println("--------------------------------");
System.err.println("Attention:  Fault Condition");
System.err.println("Code: "+ fault.getFaultCode());
System.err.println("Description: "+
fault.getFaultString());
System.err.println("--------------------------------");

         }

      }
      catch (SOAPException e) {
         System.err.println("Caught SOAPException (" +
                         e.getFaultCode() + "): " +
                         e.getMessage());
      }
   }
....

and the Deployement Descriptor is:
<isd:service
    xmlns:isd="http://xml.apache.org/xml-soap/deployment"
    id="urn:DataFeedService">
  <isd:provider
     type="java"
     scope="Request"
     methods="sendMessage">
    <isd:java
       class="DataFeedService"
       static="false"/>
  </isd:provider>

  <isd:faultListener>org.apache.soap.server.DOMFaultListener
  </isd:faultListener>
  <isd:mappings>
    <isd:map
       encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
       xmlns:x="urn:DataFeedService" qname="x:DataFeedMessage"
       javaType="DataFeedMessage"
xml2JavaClassName="DataFeedMessageSerializer"
java2XMLClassName="DataFeedMessageSerializer"
       />
  </isd:mappings>
</isd:service>

Now, when I run the client, my custom serializer send this:

POST /soap/servlet/rpcrouter HTTP/1.0
Host: localhost:8080
Content-Type: text/xml; charset=utf-8
Content-Length: 524
SOAPAction: ""

<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-
ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<ns1:sendMessage xmlns:ns1="urn:DataFeedService" SOAP-
ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<msg xsi:type="ns1:DataFeedMessage">
<?jsx version="1"?>
<DataFeedMessage alias-ID="0"
 n="0"/>

</msg>
</ns1:sendMessage>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

and, as you can see, I used JSX in my custom (de)serializer
and "DataFeedMessage" is a generic
object (not a Javabean). But the response is:

HTTP/1.1 500 Internal Server Error
Content-Type: text/xml; charset=utf-8
Content-Length: 613
Date: Wed, 16 Oct 2002 12:21:37 GMT
Server: Java Web Services Developer Pack/1.0-ea1 (HTTP/1.1 Connector)
Set-Cookie: JSESSIONID=9D5D04EFBB4F2D38FE2F24808B3C22E7;Path=/soap

<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-
ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring>Deployment error in SOAP service
&apos;urn:DataFeedService&apos;: class name
&apos;DataFeedMessageSerializer&apos; could not be resolved as a
serializer: DataFeedMessageSerializer</faultstring>
<faultactor>/soap/servlet/rpcrouter</faultactor>
</SOAP-ENV:Fault>

</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Maybe I have to change the encoding-style?
Can you help me?
Thank you in advance!

Stefano Pedon


--
To unsubscribe, e-mail:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>




--
To unsubscribe, e-mail:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>


Re: Help4Problem with custom serializer

Posted by Scott Nichol <sn...@scottnichol.com>.
Either the class DataFeedMessageSerializer cannot be loaded by Tomcat or
it cannot be cast to Serializer.  Assuming is does indeed implement the
Serializer interface, you must put the class file in
%CATALINA_HOME%\webapps\soap\WEB-INF\classes.

Scott Nichol

----- Original Message -----
From: <no...@libero.it>
To: "soap-user" <so...@xml.apache.org>
Sent: Wednesday, October 16, 2002 7:59 AM
Subject: Help4Problem with custom serializer


Hi all, I've a problem with my custom (de)serializer. I'm using Apache-
soap2.3.1 & TomCat4.01.
 The client code is:
....
URL url = new URL("http://localhost:8080/soap/servlet/rpcrouter");

      Call call = new Call();

      SOAPMappingRegistry smr = new SOAPMappingRegistry();
      call.setTargetObjectURI("urn:DataFeedService");
      call.setMethodName("sendMessage");
      call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
      call.setSOAPMappingRegistry(smr);
      DataFeedMessageSerializer msgSer = new DataFeedMessageSerializer
();

      smr.mapTypes(Constants.NS_URI_SOAP_ENC,
            new QName("urn:DataFeedService", "DataFeedMessage"),
            DataFeedMessage.class, msgSer, msgSer);
      DataFeedMessage msg = new DataFeedMessage();

      Vector params = new Vector();
      params.addElement(new Parameter("msg",
                   DataFeedMessage.class, msg, null));

      call.setParams(params);

      try {
         Response resp = call.invoke(url, "");
         if(!resp.generatedFault())
         {
         Parameter ret = resp.getReturnValue();
         Object value = ret.getValue();
         System.out.println("*\n"+value);
         }
         else
         {
         Fault fault = resp.getFault();
System.err.println("--------------------------------");
System.err.println("Attention:  Fault Condition");
System.err.println("Code: "+ fault.getFaultCode());
System.err.println("Description: "+
fault.getFaultString());
System.err.println("--------------------------------");

         }

      }
      catch (SOAPException e) {
         System.err.println("Caught SOAPException (" +
                         e.getFaultCode() + "): " +
                         e.getMessage());
      }
   }
....

and the Deployement Descriptor is:
<isd:service
    xmlns:isd="http://xml.apache.org/xml-soap/deployment"
    id="urn:DataFeedService">
  <isd:provider
     type="java"
     scope="Request"
     methods="sendMessage">
    <isd:java
       class="DataFeedService"
       static="false"/>
  </isd:provider>

  <isd:faultListener>org.apache.soap.server.DOMFaultListener
  </isd:faultListener>
  <isd:mappings>
    <isd:map
       encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
       xmlns:x="urn:DataFeedService" qname="x:DataFeedMessage"
       javaType="DataFeedMessage"
xml2JavaClassName="DataFeedMessageSerializer"
java2XMLClassName="DataFeedMessageSerializer"
       />
  </isd:mappings>
</isd:service>

Now, when I run the client, my custom serializer send this:

POST /soap/servlet/rpcrouter HTTP/1.0
Host: localhost:8080
Content-Type: text/xml; charset=utf-8
Content-Length: 524
SOAPAction: ""

<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-
ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<ns1:sendMessage xmlns:ns1="urn:DataFeedService" SOAP-
ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<msg xsi:type="ns1:DataFeedMessage">
<?jsx version="1"?>
<DataFeedMessage alias-ID="0"
 n="0"/>

</msg>
</ns1:sendMessage>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

and, as you can see, I used JSX in my custom (de)serializer
and "DataFeedMessage" is a generic
object (not a Javabean). But the response is:

HTTP/1.1 500 Internal Server Error
Content-Type: text/xml; charset=utf-8
Content-Length: 613
Date: Wed, 16 Oct 2002 12:21:37 GMT
Server: Java Web Services Developer Pack/1.0-ea1 (HTTP/1.1 Connector)
Set-Cookie: JSESSIONID=9D5D04EFBB4F2D38FE2F24808B3C22E7;Path=/soap

<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-
ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring>Deployment error in SOAP service
&apos;urn:DataFeedService&apos;: class name
&apos;DataFeedMessageSerializer&apos; could not be resolved as a
serializer: DataFeedMessageSerializer</faultstring>
<faultactor>/soap/servlet/rpcrouter</faultactor>
</SOAP-ENV:Fault>

</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Maybe I have to change the encoding-style?
Can you help me?
Thank you in advance!

Stefano Pedon


--
To unsubscribe, e-mail:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>