File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Web Service : Axis as server and C# as client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Web Service : Axis as server and C# as client" Watch "Web Service : Axis as server and C# as client" New topic
Author

Web Service : Axis as server and C# as client

Susilo Saja
Ranch Hand

Joined: May 27, 2003
Posts: 91
Hi, I am making web service server and client.
I use Apache-Axis (Java) as the server, and C# (using Visual Studio) as the client.

The Axis Code :
============

package gov.pbb.pos.webservice;

public class CPosService {
....
public String getDetails(CQuery _oQuery)
{
....
}
....
}

public class CQuery implements java.io.Serializable {
....
private gov.pbb.pos.dao.CNop _nop;
public gov.pbb.pos.dao.CNop getNop() {
return this._nop;
}
public void setNop(gov.pbb.pos.dao.CNop nop) {
this._nop = nop;
}
....
}

C# Client :
============

I am using Visual Studio, add web reference to the wsdl with name "posServer".

posServer.CQuery query = new posServer.CQuery();
posServer.CNop nop = new posServer.CNop();
query.nop = nop;
//calling the service
posServer.CPosServiceService pos = new posServer.CPosServiceService();
string result = pos.getDetails(query); //error in this line

The error is :
org.xml.sax.SAXException: Bad types (class gov.pbb.pos.webservice.CQuery -> class gov.pbb.pos.dao.CNop)

While the stack trace in axis are :
org.xml.sax.SAXException:
Bad types (class gov.pbb.pos.webservice.CQuery -> class gov.pbb.pos.dao.CNop)
at org.apache.axis.AxisFault.makeFault(AxisFault.java:120)
at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:280)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)
.....
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Originally posted by Susilo Saja:

While the stack trace in axis are :
org.xml.sax.SAXException:
Bad types (class gov.pbb.pos.webservice.CQuery -> class gov.pbb.pos.dao.CNop)
at org.apache.axis.AxisFault.makeFault(AxisFault.java:120)
at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:280)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)
.....

This is mostly because of the typemapping or beanmapping error in the deployment of ws at axis side. check this thread as well http://www.coderanch.com/t/220443/Web-Services/java/org-xml-sax-SAXException-Bad


Spritle Software Blogs
Susilo Saja
Ranch Hand

Joined: May 27, 2003
Posts: 91
This is Axis Deployment (WSDD) file, anything wrong ?

<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="Pos" provider="java:RPC">
<parameter name="className" value="gov.pbb.pos.webservice.CPosService"/>
<parameter name="allowedMethods" value="*"/>
</service>
<beanMapping qname="myNS:CObjekPajak" xmlns:myNS="urn:BeanService" languageSpecificType="java:gov.pbb.pos.dao.CObjekPajak"/>
<beanMapping qname="myNS:CNop" xmlns:myNS="urn:BeanService" languageSpecificType="java:gov.pbb.pos.dao.CNop"/>
<beanMapping qname="myNS:CAddress" xmlns:myNS="urn:BeanService" languageSpecificType="java:gov.pbb.pos.dao.CAddress"/>
<beanMapping qname="myNS:CQuery" xmlns:myNS="urn:BeanService" languageSpecificType="java:gov.pbb.pos.webservice.CQuery"/>
</deployment>
Susilo Saja
Ranch Hand

Joined: May 27, 2003
Posts: 91
This is my CNop file :

/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 0.9.5.3</a>, using an XML
* Schema.
* $Id: CNop.java,v 1.2 2004/11/22 03:09:24 dpitaloka Exp $
*/

package gov.pbb.pos.dao;

//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/

import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;

/**
* Class CNop.
*
* @version $Revision: 1.2 $ $Date: 2004/11/22 03:09:24 $
*/
public class CNop implements java.io.Serializable {


//--------------------------/
//- Class/Member Variables -/
//--------------------------/

/**
* Field _kdPropinsi
*/
private java.lang.String _kdPropinsi = "%%";

/**
* Field _kdDati2
*/
private java.lang.String _kdDati2 = "%%";

/**
* Field _kdKecamatan
*/
private java.lang.String _kdKecamatan = "%%";

/**
* Field _kdKelurahan
*/
private java.lang.String _kdKelurahan = "%%";

/**
* Field _kdBlok
*/
private java.lang.String _kdBlok = "%%";

/**
* Field _noUrut
*/
private java.lang.String _noUrut = "%%";

/**
* Field _kdJnsOp
*/
private java.lang.String _kdJnsOp = "%%";


//----------------/
//- Constructors -/
//----------------/

public CNop() {
super();
setKdPropinsi("%%");
setKdDati2("%%");
setKdKecamatan("%%");
setKdKelurahan("%%");
setKdBlok("%%");
setNoUrut("%%");
setKdJnsOp("%%");
} //-- gov.pbb.pos.dao.CNop()


//-----------/
//- Methods -/
//-----------/

/**
* Returns the value of field 'kdBlok'.
*
* @return the value of field 'kdBlok'.
*/
public java.lang.String getKdBlok()
{
return this._kdBlok;
} //-- java.lang.String getKdBlok()

/**
* Returns the value of field 'kdDati2'.
*
* @return the value of field 'kdDati2'.
*/
public java.lang.String getKdDati2()
{
return this._kdDati2;
} //-- java.lang.String getKdDati2()

/**
* Returns the value of field 'kdJnsOp'.
*
* @return the value of field 'kdJnsOp'.
*/
public java.lang.String getKdJnsOp()
{
return this._kdJnsOp;
} //-- java.lang.String getKdJnsOp()

/**
* Returns the value of field 'kdKecamatan'.
*
* @return the value of field 'kdKecamatan'.
*/
public java.lang.String getKdKecamatan()
{
return this._kdKecamatan;
} //-- java.lang.String getKdKecamatan()

/**
* Returns the value of field 'kdKelurahan'.
*
* @return the value of field 'kdKelurahan'.
*/
public java.lang.String getKdKelurahan()
{
return this._kdKelurahan;
} //-- java.lang.String getKdKelurahan()

/**
* Returns the value of field 'kdPropinsi'.
*
* @return the value of field 'kdPropinsi'.
*/
public java.lang.String getKdPropinsi()
{
return this._kdPropinsi;
} //-- java.lang.String getKdPropinsi()

/**
* Returns the value of field 'noUrut'.
*
* @return the value of field 'noUrut'.
*/
public java.lang.String getNoUrut()
{
return this._noUrut;
} //-- java.lang.String getNoUrut()

/**
* Method isValid
*/
public boolean isValid()
{
try {
validate();
}
catch (org.exolab.castor.xml.ValidationException vex) {
return false;
}
return true;
} //-- boolean isValid()

/**
* Method marshal
*
* @param out
*/
public void marshal(java.io.Writer out)
throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
{

Marshaller.marshal(this, out);
} //-- void marshal(java.io.Writer)

/**
* Method marshal
*
* @param handler
*/
public void marshal(org.xml.sax.ContentHandler handler)
throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
{

Marshaller.marshal(this, handler);
} //-- void marshal(org.xml.sax.ContentHandler)

/**
* Sets the value of field 'kdBlok'.
*
* @param kdBlok the value of field 'kdBlok'.
*/
public void setKdBlok(java.lang.String kdBlok)
{
this._kdBlok = kdBlok;
} //-- void setKdBlok(java.lang.String)

/**
* Sets the value of field 'kdDati2'.
*
* @param kdDati2 the value of field 'kdDati2'.
*/
public void setKdDati2(java.lang.String kdDati2)
{
this._kdDati2 = kdDati2;
} //-- void setKdDati2(java.lang.String)

/**
* Sets the value of field 'kdJnsOp'.
*
* @param kdJnsOp the value of field 'kdJnsOp'.
*/
public void setKdJnsOp(java.lang.String kdJnsOp)
{
this._kdJnsOp = kdJnsOp;
} //-- void setKdJnsOp(java.lang.String)

/**
* Sets the value of field 'kdKecamatan'.
*
* @param kdKecamatan the value of field 'kdKecamatan'.
*/
public void setKdKecamatan(java.lang.String kdKecamatan)
{
this._kdKecamatan = kdKecamatan;
} //-- void setKdKecamatan(java.lang.String)

/**
* Sets the value of field 'kdKelurahan'.
*
* @param kdKelurahan the value of field 'kdKelurahan'.
*/
public void setKdKelurahan(java.lang.String kdKelurahan)
{
this._kdKelurahan = kdKelurahan;
} //-- void setKdKelurahan(java.lang.String)

/**
* Sets the value of field 'kdPropinsi'.
*
* @param kdPropinsi the value of field 'kdPropinsi'.
*/
public void setKdPropinsi(java.lang.String kdPropinsi)
{
this._kdPropinsi = kdPropinsi;
} //-- void setKdPropinsi(java.lang.String)

/**
* Sets the value of field 'noUrut'.
*
* @param noUrut the value of field 'noUrut'.
*/
public void setNoUrut(java.lang.String noUrut)
{
this._noUrut = noUrut;
} //-- void setNoUrut(java.lang.String)

/**
* Method unmarshal
*
* @param reader
*/
public static java.lang.Object unmarshal(java.io.Reader reader)
throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
{
return (gov.pbb.pos.dao.CNop) Unmarshaller.unmarshal(gov.pbb.pos.dao.CNop.class, reader);
} //-- java.lang.Object unmarshal(java.io.Reader)

/**
* Method validate
*/
public void validate()
throws org.exolab.castor.xml.ValidationException
{
org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
validator.validate(this);
} //-- void validate()

}
 
Don't get me started about those stupid light bulbs.
 
subject: Web Service : Axis as server and C# as client
 
Similar Threads
Need help with Apache Client
Need help with Apache Client
Getting error in deserialization of object on client side
Error while running client code on axis webservice
Getting an exception org.xml.sax.SAXException: Bad types