You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Bradley Williams <bw...@clientsoft.com> on 2002/01/07 16:36:33 UTC
RE: Return Bean using RPC
Try to return a bean from a java class.
The first example I tried takes in a bean and returns a single string.
All of this works fine, although the documentation on the wsdd is not very
clear on what the wsdd document should look like in the bean mapping.
Next I tried to return the same bean type that was sent in with updated
values.
The result, a call to create wsdl document hangs and never returns a
result. This makes is a little hard to debug as well, with no axis fault to
follow back in the code.
Stuck, any help would be greatly appreciated.
posting code below..
************wsdd document****************
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="TitleQueryService" provider="java:RPC">
<parameter name="className"
value="com.clientsoft.webservice.TitleQueryService"/>
<parameter name="methodName" value="exec"/>
<beanMapping qname="myNS:titleQuery" xmlns:myNS="urn:TitleQueryService"
languageSpecificType="java:com.clientsoft.webservice.TitleQueryBean"/>
</service>
</deployment>
*************TitleQueryService**************
/*
* TitleQuery.java
*
* Created on January 3, 2002, 2:22 PM
*/
package com.clientsoft.webservice;
import java.io.*;
import java.util.* ;
import java.net.URL;
import com.clientsoft.webpack.connector.TaskRequest;
import com.clientsoft.webpack.connector.TaskResponse;
import com.clientsoft.webpack.connector.ConnectorAdapter;
import com.clientsoft.webpack.util.CSUtils;
/**
* @author Bradley G. Williams (bwilliams@clientsoft.com)
*/
public class TitleQueryService {
public TitleQueryBean exec(TitleQueryBean bean) throws Exception {
String taskName = "CBW_TitleQuery";
String domain = "default";
TaskRequest csreq = new TaskRequest();
TaskResponse csresp = null;
//ConnectorAdapter adapter =new ConnectorAdapter(
CSUtils.getConfig() );
ConnectorAdapter adapter =new ConnectorAdapter( new
URL("file:///home/brad/dev/projects/webapps/axis/WEB-INF/classes/config.xml"
) );
csreq.setTaskName(taskName);
csreq.setDomain(domain);
csreq.addParameter( "Title",bean.getTitle() );
csreq.addParameter("Author",bean.getAuthor() );
csresp = adapter.sendTransaction(csreq);
bean.setResult( csresp.getReturnData() );
return bean;
}
public static void main(String args) {
TitleQueryBean bean = new TitleQueryBean();
bean.setAuthor("Bradley G. Williams");
bean.setTitle("Brad's Book");
TitleQueryService service = new TitleQueryService();
try {
service.exec(bean);
} catch(Exception e) {e.printStackTrace();}
}
}
*******End TltleQueryService********
*******TitleQueryBean***************
/*
* TitleQueryBean.java
*
* Created on January 3, 2002, 2:12 PM
*/
package com.clientsoft.webservice;
import java.beans.*;
/**
*
* @author brad
* @version
*/
public class TitleQueryBean extends Object implements java.io.Serializable {
private static final String PROP_TITLE = "title";
private static final String PROP_AUTHOR = "author";
private static final String PROP_RESULT = "result";
private String title = "";
private String author = "";
private String result = "";
/** Creates new TitleQueryBean */
public TitleQueryBean() {}
public String getTitle () { return title; }
public void setTitle (String value) { title = value; }
public String getAuthor () { return author; }
public void setAuthor (String value) { author = value; }
public String getResult() {return result;}
public void setResult (String value) { result = value; }
}
*******End TitleQueryBean ***************