You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by raybristol <ra...@gmail.com> on 2007/12/12 13:38:03 UTC

simple type mapping problem, but can't solve it, help :-(

I have did a simple web service using axis, which i think it is very good as
I can pretty much reuse my business/data access class and just need to
create a wsdd file, anyway, it's working I think, but I got problem when I
try to create a client test class.

                      
However the webservice is working with flex, so the mapping in wsdd
configuration file is correct: 
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
    xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
  <service name="MyService" provider="java:RPC">
    <parameter name="className" value="apto.umbrella.image.WSBatchManager"/>
    <parameter name="allowedMethods" value="*"/>
    <parameter name="enableRemoteAdmin" value="true"/>
    <beanMapping qname="myNS:Batch" xmlns:myNS="urn:BeanService"
languageSpecificType="java:apto.umbrella.image.Batch"/>
  </service>
</deployment>



But I just don't know how to config that QName object in a java class, the
mapping is correct in wsdd file, otherwise my flex program won't get the
data, however I also want to use a java class to call the service:

   Service service = new Service();
	            Call call = (Call)service.createCall();
	            URL url = new
URL("http://localhost:8080/axis/services/MyService");
	            call.setTargetEndpointAddress(url);

	            QName qname = new QName("myNS:MyService","Batch");

	            call.setOperationName(new QName("","getBatchById")); 

	            call.registerTypeMapping(Batch.class, qname,
	            new
org.apache.axis.encoding.ser.BeanSerializerFactory(Batch.class, qname), 
	            new
org.apache.axis.encoding.ser.BeanDeserializerFactory(Batch.class, qname)); 

	            Batch e = (Batch)call.invoke(new Object[]{new Integer(10)}); 
	            
	            System.out.println("Object = " + e.getBatchId());
	            System.out.println("Number Returned : " + e.getIDWithPrefix());


I got a exception when I try to run above code: org.xml.sax.SAXException:
Deserializing parameter 'getBatchByIdReturn':  could not find deserializer
for type {urn:BeanService}Batch

Can anyone point out where the error is, I am thinking is I didn't set the
QName property... 
-- 
View this message in context: http://www.nabble.com/simple-type-mapping-problem%2C-but-can%27t-solve-it%2C-help-%3A-%28-tp14294340p14294340.html
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: simple type mapping problem, but can't solve it, help :-(

Posted by raybristol <ra...@gmail.com>.
sort it!

 Service service = new Service();
	            Call call = (Call)service.createCall();
	            URL url = new
URL("http://localhost:8080/axis/services/MyService");
	            call.setTargetEndpointAddress(url);

	            QName qname = new QName("urn:BeanService","Batch");

	            call.registerTypeMapping(Batch.class, qname,
	            new
org.apache.axis.encoding.ser.BeanSerializerFactory(Batch.class, qname), 
	            new
org.apache.axis.encoding.ser.BeanDeserializerFactory(Batch.class, qname)); 
	            
	            call.setOperationName( new QName("", "getBatchById") );
	            //call.addParameter( "arg1", qname, ParameterMode.IN );
	            Batch e = (Batch)call.invoke(new Object[]{new Integer(10)}); 
	            
	            System.out.println("Object = " + e.getBatchId());
	            System.out.println("Number Returned : " + e.getIDWithPrefix());




raybristol wrote:
> 
> I have did a simple web service using axis, which i think it is very good
> as I can pretty much reuse my business/data access class and just need to
> create a wsdd file, anyway, it's working I think, but I got problem when I
> try to create a client test class.
> 
>                       
> However the webservice is working with flex, so the mapping in wsdd
> configuration file is correct: 
> <deployment xmlns="http://xml.apache.org/axis/wsdd/"
>     xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
>   <service name="MyService" provider="java:RPC">
>     <parameter name="className"
> value="apto.umbrella.image.WSBatchManager"/>
>     <parameter name="allowedMethods" value="*"/>
>     <parameter name="enableRemoteAdmin" value="true"/>
>     <beanMapping qname="myNS:Batch" xmlns:myNS="urn:BeanService"
> languageSpecificType="java:apto.umbrella.image.Batch"/>
>   </service>
> </deployment>
> 
> 
> 
> But I just don't know how to config that QName object in a java class, the
> mapping is correct in wsdd file, otherwise my flex program won't get the
> data, however I also want to use a java class to call the service:
> 
>    Service service = new Service();
> 	            Call call = (Call)service.createCall();
> 	            URL url = new
> URL("http://localhost:8080/axis/services/MyService");
> 	            call.setTargetEndpointAddress(url);
> 
> 	            QName qname = new QName("myNS:MyService","Batch");
> 
> 	            call.setOperationName(new QName("","getBatchById")); 
> 
> 	            call.registerTypeMapping(Batch.class, qname,
> 	            new
> org.apache.axis.encoding.ser.BeanSerializerFactory(Batch.class, qname), 
> 	            new
> org.apache.axis.encoding.ser.BeanDeserializerFactory(Batch.class, qname)); 
> 
> 	            Batch e = (Batch)call.invoke(new Object[]{new Integer(10)}); 
> 	            
> 	            System.out.println("Object = " + e.getBatchId());
> 	            System.out.println("Number Returned : " +
> e.getIDWithPrefix());
> 
> 
> I got a exception when I try to run above code: org.xml.sax.SAXException:
> Deserializing parameter 'getBatchByIdReturn':  could not find deserializer
> for type {urn:BeanService}Batch
> 
> Can anyone point out where the error is, I am thinking is I didn't set the
> QName property... 
> 

-- 
View this message in context: http://www.nabble.com/simple-type-mapping-problem%2C-but-can%27t-solve-it%2C-help-%3A-%28-tp14294340p14296860.html
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org