Hi All,

I developed an adb client using the method given in the axis2 docs and it is
getting compiled alright.
The problem i am facing is i get "Web Services Failed" exception when i run
the client..
I am using C web service and Java Client. After tracking the server logs i
found that this error occurs after the server tries to deserailize the input
parameters sent by the client. i monitores the soap messages using the
TCPMon tool. I used a working C client and the Java Client for the same
webservice.

The C client sends SOAP message -

POST /axis/Calculator HTTP/1.1
Host: 127.0.0.1:8080
Content-Type: text/xml; charset=UTF-8
SOAPAction: "Calculator#add"
Content-Length: 403

<?xml version='1.0' encoding='utf-8' ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance";>
<SOAP-ENV:Body>
<ns1:add xmlns:ns1="http://localhost/axis/Calculator";>
<in0 xsi:type="xsd:int">2</in0>
<in1 xsi:type="xsd:int">4</in1>
</ns1:add>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

The Java Client sends this SOAP message -

POST /axis/Calculator HTTP/1.1
Content-Type: text/xml; charset=UTF-8
SOAPAction: "Calculator#add"
User-Agent: Axis2
Host: 127.0.0.1:8080
Content-Length: 250

<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
<soapenv:Body>
<ns1:add xmlns:ns1="http://localhost/axis/Calculator";>
<in0>2</in0>
<in1>3</in1>
</ns1:add>
</soapenv:Body>
</soapenv:Envelope>

There are differences in the soapenv tag - xmlns:xsi and xmlns:xsd are
missing.
Also the input parameters are being sent differently.
I changed these things using TCPMon and resent the message and it worked
fine...
So now i know that the Java Client is not sending the request in the right
format but dunno how to resolve this problem.

Could you Help?? Please its very urgent!!!
Thanks a lot!

Cheers,
Sneha




On 9/6/07, Charitha Kankanamge <[EMAIL PROTECTED]> wrote:
>
> Sneha,
> What is the axis version you are using? If you are new to java web
> services, I would recommend you to use Axis2. Please have a look at
> Axis2 user documentation (http://ws.apache.org/axis2/1_3/toc.html) and
> the following references to have a basic understanding on Axis2 web
> services.
>
> [1] http://wso2.org/library/95
> [2]
>
> http://today.java.net/pub/a/today/2006/12/13/invoking-web-services-using-apache-axis2.html
> [3] If you are using Eclipse IDE for Java development, have a look at
> http://wso2.org/library/1719
>
> Let us know if you cannot get it working with the help of the above
> documents.
>
> regards
> Charitha
>
> sneha jain wrote:
>
> > Hi Charitha,
> >
> > I did try those methods but me being new to webservices and java as
> > well messed up the whole thing..
> > Right now m tryin to build a simple client which doesnt use stubs -
> >
> > the client code is -
> >
> > package samples.userguide.example1;
> >
> > import org.apache.axis.client.Call;
> > import org.apache.axis.client.Service;
> >
> > import javax.xml.namespace.QName;
> > import java.lang.*;
> >
> > public class Calculator
> > {
> >    public static void main(String [] args) {
> >        try {
> >            String endpoint =
> >                     "http://localhost:8080/axis/Calculator";;
> >
> >            Integer i1 = new Integer(2);
> >            Integer i2 = new Integer(3);
> >
> >            Service  service = new Service();
> >            Call     call    = (Call) service.createCall ();
> >
> >            call.setTargetEndpointAddress( new java.net.URL(endpoint) );
> >            call.setOperationName("add");
> >            call.addParameter( "in0",org.apache.axis.Constants.XSD_INT,
> > javax.xml.rpc.ParameterMode.IN <http://javax.xml.rpc.ParameterMode.IN>
> );
> >            call.addParameter(
> > "in1",org.apache.axis.Constants.XSD_INT,javax.xml.rpc.ParameterMode.IN
> > <http://javax.xml.rpc.ParameterMode.IN> );
> >            call.setReturnType( org.apache.axis.Constants.XSD_INT );
> >            // Call to addParameter/setReturnType as described in
> > user-guide.html
> >            //call.addParameter("testParam",
> >            //                  org.apache.axis.Constants.XSD_STRING,
> >            //                  javax.xml.rpc.ParameterMode.IN
> > <http://javax.xml.rpc.ParameterMode.IN>);
> >            //call.setReturnType(org.apache.axis.Constants.XSD_STRING );
> >
> >            Integer ret = (Integer) call.invoke( new Object[] { i1, i2 }
> );
> >
> >            System.out.println("Result:" + ret);
> >        } catch (Exception e) {
> >            System.err.println(e.toString ());
> >            e.printStackTrace();
> >        }
> >    }
> > }
> >
> > m getting error - Exception in thread "main"
> > java.lang.NoClassDefFoundError: Calculator
> >
> > m not able to resolve this!!
> > On 9/6/07, *Charitha Kankanamge* <[EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]>> wrote:
> >
> >     Hi Sneha,
> >     Did you try [1], [2] in Apache Axis2 web page? It includes a lot of
> >     information on creating web service clients.
> >
> >     [1]http://ws.apache.org/axis2/1_3/quickstartguide.html#clientadb
> >     [2]http://ws.apache.org/axis2/1_3/userguide-
> >     creatingclients.html#choosingclient
> >
> >     regards
> >     Charitha
> >
> >     sneha jain wrote:
> >
> >     > Hi,
> >     >
> >     > I am trying to create a Java Client to talk to a C Calculator web
> >     > service ..
> >     > I am totally new to webservices. I have seen many methods to
> create
> >     > clients on the site..
> >     > I tried many methods too but was not successful.
> >     > Can you please suggest me how do i go about it?
> >     >
> >     > Cheers,
> >     > Sneha
> >
> >
> >
> >
> >
> ---------------------------------------------------------------------
> >     To unsubscribe, e-mail: [EMAIL PROTECTED]
> >     <mailto:[EMAIL PROTECTED]>
> >     For additional commands, e-mail: [EMAIL PROTECTED]
> >     <mailto:[EMAIL PROTECTED]>
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to