Hi,
I am trying out my own sample using pojo & my client is using RPCServiceClient
to invoke the webservice.
My client looks like this :
public BookDTO purchaseNewBook(BookDTO bookDTO)
{
RPCServiceClient rpcClient = null;
try
{
rpcClient = new RPCServiceClient();
//serviceClient = new ServiceClient();
//stub = new ExternalBookPurchaseInterfaceStub();
}
catch (AxisFault af)
{
System.out.println("AxisFault encountered while instantiating the
ServiceClient @ ExternalBookPurchaseImpl");
}
Options opts = rpcClient.getOptions();
opts.setTo(new
EndpointReference("http://localhost:7050/DefaultWebApp/services/ExternalBookPurchaseService"));
opts.setAction("urn:purchaseNewBook");
//rpcClient.setOptions(opts);
QName qNamePurchaseNewBook = new QName
("http://dto.pos.com/xsd", "purchaseNewBook");
Object[] opBookDTOArgs = new Object[] { bookDTO };
try
{
rpcClient.invokeRobust(qNamePurchaseNewBook, opBookDTOArgs);
}
catch (AxisFault af)
{
System.out.println("AxisFault while invokeRobust");
af.printStackTrace();
}
return new BookDTO();
}
My POJO object BookDTO is as follows :
public class BookDTO
{
private Long bookId;
private Long categoryId;
private String categoryName;
private Long authorId;
private String authorName;
private Long publisherId;
private String publisherName;
private String bookName;
private String isbn;
private Integer available;
private Long purchaseDate;
private Date createdDate;
private Date updatedDate;
public Long getBookId() {
return bookId;
}
public void setBookId(Long bookId) {
this.bookId = bookId;
}
public Long getCategoryId() {
return categoryId;
}
public void setCategoryId(Long categoryId) {
this.categoryId = categoryId;
}
public String getCategoryName() {
return categoryName;
}
public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}
public Long getAuthorId() {
return authorId;
}
public void setAuthorId(Long authorId) {
this.authorId = authorId;
}
public String getAuthorName() {
return authorName;
}
public void setAuthorName(String authorName) {
this.authorName = authorName;
}
public Long getPublisherId() {
return publisherId;
}
public void setPublisherId(Long publisherId) {
this.publisherId = publisherId;
}
public String getPublisherName() {
return publisherName;
}
public void setPublisherName(String publisherName) {
this.publisherName = publisherName;
}
public String getBookName() {
return bookName;
}
public void setBookName(String bookName) {
this.bookName = bookName;
}
public String getIsbn() {
return isbn;
}
public void setIsbn(String isbn) {
this.isbn = isbn;
}
public Integer getAvailable() {
return available;
}
public void setAvailable(Integer available) {
this.available = available;
}
public Long getPurchaseDate() {
return purchaseDate;
}
public void setPurchaseDate(Long purchaseDate) {
this.purchaseDate = purchaseDate;
}
public Date getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}
public Date getUpdatedDate() {
return updatedDate;
}
public void setUpdatedDate(Date updatedDate) {
this.updatedDate = updatedDate;
}
}
My services.xml :
<service name="ExternalBookPurchaseService" scope="application">
<messageReceivers>
class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
</messageReceivers>
<parameter locked="false"
name="ServiceClass">com.pos.ext.webservice.ExternalBookPurchaseService</parameter>
</service>
(is the <operation> element with actionMapping & outputActionMapping required
here ??)
And while invoking the service i am getting the following exception :
Caused by: org.apache.axiom.om.OMException: java.lang.IllegalArgumentException:
null rcl
at
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:194)
at org.apache.axiom.om.impl.llom.OMNodeImpl.build(OMNodeImpl.java:318)
at
org.apache.axiom.om.impl.llom.OMElementImpl.build(OMElementImpl.java:632)
at
org.apache.axiom.om.impl.llom.OMElementImpl.detach(OMElementImpl.java:599)
at
org.apache.axiom.om.impl.llom.OMNodeImpl.setParent(OMNodeImpl.java:117)
at
org.apache.axiom.om.impl.llom.OMElementImpl.addChild(OMElementImpl.java:249)
at
org.apache.axiom.om.impl.llom.OMElementImpl.addChild(OMElementImpl.java:202)
at
org.apache.axis2.client.ServiceClient.fillSOAPEnvelope(ServiceClient.java:698)
at
org.apache.axis2.client.ServiceClient.sendRobust(ServiceClient.java:450)
at
org.apache.axis2.client.ServiceClient.sendRobust(ServiceClient.java:380)
at
org.apache.axis2.rpc.client.RPCServiceClient.invokeRobust(RPCServiceClient.java:131)
at
com.tavant.pos.ext.webservice.ExternalBookPurchaseImpl.purchaseNewBook(ExternalBookPurchaseImpl.java:91)
at
com.tavant.pos.ext.webservice.ExternalBookPurchaseImpl.purchaseNewBook(ExternalBookPurchaseImpl.java:36)
... 7 more
Caused by: java.lang.IllegalArgumentException: null rcl
at
org.codehaus.jam.internal.reflect.ReflectClassBuilder.<init>(ReflectClassBuilder.java:47)
at
org.codehaus.jam.provider.JamServiceFactoryImpl.createBuilder(JamServiceFactoryImpl.java:173)
at
org.codehaus.jam.provider.JamServiceFactoryImpl.createClassLoader(JamServiceFactoryImpl.java:137)
at
org.codehaus.jam.provider.JamServiceFactoryImpl.createService(JamServiceFactoryImpl.java:78)
at
org.apache.axis2.databinding.utils.BeanUtil.getPullParser(BeanUtil.java:67)
at
org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl.processProperties(ADBXMLStreamReaderImpl.jav
a:948)
at
org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl.next(ADBXMLStreamReaderImpl.java:821)
at
org.apache.axis2.databinding.utils.reader.WrappingXMLStreamReader.next(WrappingXMLStreamReader.java:45)
at
org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl.next(ADBXMLStreamReaderImpl.java:824)
at org.apache.axis2.util.StreamWrapper.next(StreamWrapper.java:68)
at
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:111)
... 19 more
I dont know if i have missed out anything ?
I can provide the WSDL (if needed)... can anyone throw some light on this ?
Thanks in advance,
Shail
Send a FREE SMS to your friend's mobile from Yahoo! Messenger. Get it now
at http://in.messenger.yahoo.com/