[Fedora-users] accessing fedora with xml-rpc???

1 view
Skip to first unread message

saju

unread,
Jul 28, 2004, 10:08:58 AM7/28/04
to fedora...@comm.nsdl.org
I am new to soap,xml-rpc and webservices. I am trying
to access the fedora server through 'axis' - here is
the source code

import java.net.MalformedURLException;
import java.net.URL;
import java.rmi.RemoteException;
import org.apache.axis.client.*;
import
org.apache.axis.encoding.ser.BeanDeserializerFactory;
import
org.apache.axis.encoding.ser.BeanSerializerFactory;

import javax.xml.namespace.*;
import javax.xml.rpc.ServiceException;

import fedora.server.types.gen.*;
/**
* @author Administrator
*
* TODO To change the template for this generated type
comment go to
* Window - Preferences - Java - Code Style - Code
Templates
*/
public class FedoraClientTest {

public static void main(String[] args) {
String endpoint =
"http://localhost:8080/fedora/access/soap";
String qname =
"http://www.fedora.info/definitions/1/0/api/";
String qtypename=
"http://www.fedora.info/definitions/1/0/types";
Service service = new Service();
Call call = null;

try
{
call = (Call) service.createCall();
}
catch(ServiceException ex)
{
System.out.println(ex.getMessage());
}

try
{
call.setTargetEndpointAddress(new URL(endpoint));
}
catch (MalformedURLException e)
{
// TODO Auto-generated catch block
System.out.println(e.getMessage());
e.printStackTrace();
}

call.setOperationName(new
QName(qname,"describeRepository"));
call.registerTypeMapping(RepositoryInfo.class,
new javax.xml.namespace.QName(qtypename),
new
BeanSerializerFactory(RepositoryInfo.class,new
QName(qtypename,"RepositoryInfo")),
new
BeanDeserializerFactory(RepositoryInfo.class,new
QName(qtypename,"RepositoryInfo"))
);
call.setReturnClass(RepositoryInfo.class/*new
QName(qtypename,"RepositoryInfo")*/);
System.out.println("Invoking ...");

try
{
RepositoryInfo rinfo = (RepositoryInfo)
call.invoke(new Object[]{});
System.out.println("Success !!!");
}
catch (RemoteException e)
{
// TODO Auto-generated catch block
System.out.println(e.getMessage());
e.printStackTrace();
}


}
}


i am getting an exception, that is, the
deserialization for the type 'RepositoryInfo' not
found.

here is the details.--->

Invoking the the call...
- Exception:
org.xml.sax.SAXException: Deserializing parameter
'response': could not find deserializer for type
{http://www.fedora.info/definitions/1/0/types/}RepositoryInfo
at
org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:264)
at
org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:883)
at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:158)
at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:681)
at
org.apache.axis.message.RPCElement.deserialize(RPCElement.java:244)
at
org.apache.axis.message.RPCElement.getParams(RPCElement.java:268)
at org.apache.axis.client.Call.invoke(Call.java:1862)
at org.apache.axis.client.Call.invoke(Call.java:1768)
at org.apache.axis.client.Call.invoke(Call.java:1306)
at
com.azilon.FedoraClientTest.main(FedoraClientTest.java:66)
; nested exception is:
org.xml.sax.SAXException: Deserializing parameter
'response': could not find deserializer for type
{http://www.fedora.info/definitions/1/0/types/}RepositoryInfo
AxisFault
faultCode:
{http://xml.apache.org/axis/}Server.userException
faultString: org.xml.sax.SAXException: Deserializing
parameter 'response': could not find deserializer for
type
{http://www.fedora.info/definitions/1/0/types/}RepositoryInfo
faultActor: null
faultDetail:
stackTrace: org.xml.sax.SAXException: Deserializing
parameter 'response': could not find deserializer for
type
{http://www.fedora.info/definitions/1/0/types/}RepositoryInfo
at
org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:264)
at
org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:883)
at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:158)
at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:681)
at
org.apache.axis.message.RPCElement.deserialize(RPCElement.java:244)
at
org.apache.axis.message.RPCElement.getParams(RPCElement.java:268)
at org.apache.axis.client.Call.invoke(Call.java:1862)
at org.apache.axis.client.Call.invoke(Call.java:1768)
at org.apache.axis.client.Call.invoke(Call.java:1306)
at
com.azilon.FedoraClientTest.main(FedoraClientTest.java:66)


org.xml.sax.SAXException: Deserializing parameter
'response': could not find deserializer for type
{http://www.fedora.info/definitions/1/0/types/}RepositoryInfo
at
org.apache.axis.AxisFault.makeFault(AxisFault.java:115)
at org.apache.axis.client.Call.invoke(Call.java:1865)
at org.apache.axis.client.Call.invoke(Call.java:1768)
at org.apache.axis.client.Call.invoke(Call.java:1306)
at
com.azilon.FedoraClientTest.main(FedoraClientTest.java:66)
Caused by: org.xml.sax.SAXException: Deserializing
parameter 'response': could not find deserializer for
type
{http://www.fedora.info/definitions/1/0/types/}RepositoryInfo
at
org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:264)
at
org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:883)
at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:158)
at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:681)
at
org.apache.axis.message.RPCElement.deserialize(RPCElement.java:244)
at
org.apache.axis.message.RPCElement.getParams(RPCElement.java:268)
at org.apache.axis.client.Call.invoke(Call.java:1862)


should I register the RepositoryInfo type on the
client side??? then how ???




__________________________________
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail

Reply all
Reply to author
Forward
0 new messages