• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Web Service : Axis as server and C# as client

 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)
.....
 
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 https://coderanch.com/t/220443/Web-Services/java/org-xml-sax-SAXException-Bad
 
Susilo Saja
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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()

}
reply
    Bookmark Topic Watch Topic
  • New Topic