You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by S Balaji <ij...@yahoo.com> on 2009/02/19 19:10:34 UTC
axis cpp client - exception handling and showing correct message ?
Hi All,
Question : How do I do the exception handling in axis cpp client so that correct relevant message is printed out ?
Detailed description below :
I am new to Web services. I have a requirement to write C++ client to call a customer's web services. My client code has to run on many platforms : Win32, AIX, Solaris, HP-Itanium, Linux. I am playing with both gSoap and Axis C++ client versions on Windows first.
I am using axis-c-1.6b-Win32-trace-bin binaries on Windows 2000 Advanced Server (my laptop).
My customer's web service is written in Axis for Java.
First I tried simple examples, and they are working fine : Calculator, hello world etc.
But when I try calling my customer's web service (real life) example with axis client as well as with gSoap client, I am unable to get the actual exception string.
Question : How do I do the correct exception handling so that correct relevant message is printed out ?
Bacause I am sending invalid business data, I get HTTP 500. But as you can see in the return HTTP message below, the business exception / fault string is "TruckID EXAMPLE-5 cannot be found" but instead I get "Cannot deserialize" with Axis and "HTTP 500 error" with gSOap.
This post is only regarding Axis, so I am not expecting any replies regarding gSOap.
Below, I have used MacDonalds as an example. They are not my customer :)
Thanks a LOT in advance !!
Below is my client code : ------------------------------------
try
{
CustomerService service;
allocSvcObj.setUsername("username");
allocSvcObj.setPassword("password");
TruckObject * createdTruckId = service.callCustomerMethod( "EXAMPLE-5","BBB" );
}
catch(AxisException& e)
{
printf("Exception : %s\n", e.what());
}
I also tried :
catch( SoapFaultException & e)
{
const char *excpCode = e.getFaultCode();
const char *excpMessage = e.getFaultString();
printf("Got Soap Fault : code : [%d], message : [%s]\n", excpCode, excpMessage);
}
catch( AxisException& e)
{
int iExceptionCode = e.getExceptionCode();
const char *excpMessage = e.getMessage();
printf("Got axis exception : code : [%d], message : [%s]\n", iExceptionCode, excpMessage);
}
Below is my client run result : ------------------------------------
Exception : Cannot deserialize the requested element
if I print e.exceptionCode(), I get 72.
Below is what the customer's http server returned : ------------------------------------
HTTP/1.1 500 Internal Server Error
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=EE7CCB1E9C3F32E1E340387CEFB3C39C; Path=/dm
Content-Type: text/xml;charset=utf-8
Transfer-Encoding: chunked
Date: Thu, 19 Feb 2009 14:35:29 GMT
Connection: close
291
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><soapenv:Fault><faultcode>soapenv:Server.generalException</faultcode><faultstring>E20010 TruckID EXAMPLE-5 cannot be found [R00007]; nested exception is:
com.MacDonalds.common.exceptions.RecordDeletedException: E20010 TruckID EXAMPLE-5 cannot be found [R00007]</faultstring><detail><ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">mp-srv-lin02</ns1:hostname></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>
[ANN]VTD-XML 2.5
Posted by jz...@ximpleware.com.
VTD-XML 2.5 is now released. Please go to
https://sourceforge.net/project/showfiles.php?group_id=110612&package_id=120
172&release_id=661376 to download the latest version.
Changes from Version 2.4 (2/2009)
* Added separate VTD indexing generating and loading (see
http://vtd-xml.sf.net/persistence.html for further info)
* Integrated extended VTD supporting 256 GB doc (In Java only).
* Added duplicateNav() for replicate multiple VTDNav instances sharing XML,
VTD and LC buffer (availabe in Java and C#).
* Various bug fixes and enhancements.
Re: axis cpp client - exception handling and showing correct message ?
Posted by S Balaji <ij...@yahoo.com>.
Thanks Nadir.
Sorry but I am unable to find the correct links to download : I started from : http://ws.apache.org/axis/cpp/index.html - in this link, under "Axis(C++)" on the left, there is a "download" link which takes me to http://ws.apache.org/axis/cpp/download.html. All the drops here (binaries and source) are from Mar 2006. Nothing newer.
On another note, if you go to http://ws.apache.org/axis/cpp/index.html, on the left hand side, the "Releases" and "Source Code" link on the left (just above the "Translation" part on the bottom left of the page, are broken.
Thanks.
- B
--- On Thu, 2/19/09, Nadir Amra <am...@us.ibm.com> wrote:
> From: Nadir Amra <am...@us.ibm.com>
> Subject: Re: axis cpp client - exception handling and showing correct message ?
> To: "Apache AXIS C User List" <ax...@ws.apache.org>
> Cc: axis-c-user@ws.apache.org
> Date: Thursday, February 19, 2009, 4:57 PM
> I would suggest you download the latest code from SVN, build
> it, and try
> that instead of using binaries - the
> axis-c-1.6b-Win32-trace-bin binaries
> are very, very, old and are buggy.
>
> Hopefully, a 1.6 version will be released. Do not know
> when yet.
>
> Nadir Amra
>
>
> S Balaji <ij...@yahoo.com> wrote on 02/19/2009
> 12:10:34 PM:
>
> > [image removed]
> >
> > axis cpp client - exception handling and showing
> correct message ?
> >
> > S Balaji
> >
> > to:
> >
> > axis-c-user
> >
> > 02/19/2009 12:13 PM
> >
> > Please respond to "Apache AXIS C User List"
> >
> >
> >
> >
> > Hi All,
> >
> > Question : How do I do the exception handling in axis
> cpp client so
> > that correct relevant message is printed out ?
> >
> > Detailed description below :
> >
> > I am new to Web services. I have a requirement to
> write C++ client
> > to call a customer's web services. My client code
> has to run on many
> > platforms : Win32, AIX, Solaris, HP-Itanium, Linux. I
> am playing
> > with both gSoap and Axis C++ client versions on
> Windows first.
> >
> > I am using axis-c-1.6b-Win32-trace-bin binaries on
> Windows 2000
> > Advanced Server (my laptop).
> >
> > My customer's web service is written in Axis for
> Java.
> >
> > First I tried simple examples, and they are working
> fine :
> > Calculator, hello world etc.
> >
> > But when I try calling my customer's web service
> (real life) example
> > with axis client as well as with gSoap client, I am
> unable to get
> > the actual exception string.
> >
> > Question : How do I do the correct exception handling
> so that
> > correct relevant message is printed out ?
> >
> > Bacause I am sending invalid business data, I get HTTP
> 500. But as
> > you can see in the return HTTP message below, the
> business exception
> > / fault string is "TruckID EXAMPLE-5 cannot be
> found" but instead I
> > get "Cannot deserialize" with Axis and
> "HTTP 500 error" with gSOap.
> >
> > This post is only regarding Axis, so I am not
> expecting any replies
> > regarding gSOap.
> >
> > Below, I have used MacDonalds as an example. They are
> not my customer :)
>
> >
> > Thanks a LOT in advance !!
> >
> > Below is my client code :
> ------------------------------------
> >
> > try
> > {
> > CustomerService service;
> > allocSvcObj.setUsername("username");
> > allocSvcObj.setPassword("password");
> > TruckObject * createdTruckId =
> service.callCustomerMethod(
> > "EXAMPLE-5","BBB" );
> > }
> > catch(AxisException& e)
> > {
> > printf("Exception : %s\n",
> e.what());
> > }
> >
> > I also tried :
> > catch( SoapFaultException & e)
> > {
> > const char *excpCode = e.getFaultCode();
> > const char *excpMessage = e.getFaultString();
> > printf("Got Soap Fault : code : [%d],
> message : [%s]\n",
> > excpCode, excpMessage);
> > }
> > catch( AxisException& e)
> > {
> > int iExceptionCode = e.getExceptionCode();
> > const char *excpMessage = e.getMessage();
> > printf("Got axis exception : code : [%d],
> message : [%s]\n",
> > iExceptionCode, excpMessage);
> > }
> >
> >
> >
> > Below is my client run result :
> ------------------------------------
> >
> > Exception : Cannot deserialize the requested element
> > if I print e.exceptionCode(), I get 72.
> >
> > Below is what the customer's http server returned
> :
> > ------------------------------------
> >
> >
> > HTTP/1.1 500 Internal Server Error
> > Server: Apache-Coyote/1.1
> > Set-Cookie:
> JSESSIONID=EE7CCB1E9C3F32E1E340387CEFB3C39C; Path=/dm
> > Content-Type: text/xml;charset=utf-8
> > Transfer-Encoding: chunked
> > Date: Thu, 19 Feb 2009 14:35:29 GMT
> > Connection: close
> >
> > 291
> > <?xml version="1.0"
> encoding="UTF-8"?><soapenv:Envelope
> xmlns:soapenv="
> > http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://
> > www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/
> > XMLSchema-instance
> >
> "><soapenv:Body><soapenv:Fault><faultcode>soapenv:Server.generalException</
> > faultcode><faultstring>E20010 TruckID
> EXAMPLE-5 cannot be found
> > [R00007]; nested exception is:
> >
> com.MacDonalds.common.exceptions.RecordDeletedException:
> E20010
> > TruckID EXAMPLE-5 cannot be found [R00007]</
> > faultstring><detail><ns1:hostname
> xmlns:ns1="http://xml.apache.org/axis/
> >
> ">mp-srv-lin02</ns1:hostname></detail></soapenv:Fault></
> > soapenv:Body></soapenv:Envelope>
> >
> >
> >
> >
Re: axis cpp client - exception handling and showing correct message ?
Posted by Nadir Amra <am...@us.ibm.com>.
I would suggest you download the latest code from SVN, build it, and try
that instead of using binaries - the axis-c-1.6b-Win32-trace-bin binaries
are very, very, old and are buggy.
Hopefully, a 1.6 version will be released. Do not know when yet.
Nadir Amra
S Balaji <ij...@yahoo.com> wrote on 02/19/2009 12:10:34 PM:
> [image removed]
>
> axis cpp client - exception handling and showing correct message ?
>
> S Balaji
>
> to:
>
> axis-c-user
>
> 02/19/2009 12:13 PM
>
> Please respond to "Apache AXIS C User List"
>
>
>
>
> Hi All,
>
> Question : How do I do the exception handling in axis cpp client so
> that correct relevant message is printed out ?
>
> Detailed description below :
>
> I am new to Web services. I have a requirement to write C++ client
> to call a customer's web services. My client code has to run on many
> platforms : Win32, AIX, Solaris, HP-Itanium, Linux. I am playing
> with both gSoap and Axis C++ client versions on Windows first.
>
> I am using axis-c-1.6b-Win32-trace-bin binaries on Windows 2000
> Advanced Server (my laptop).
>
> My customer's web service is written in Axis for Java.
>
> First I tried simple examples, and they are working fine :
> Calculator, hello world etc.
>
> But when I try calling my customer's web service (real life) example
> with axis client as well as with gSoap client, I am unable to get
> the actual exception string.
>
> Question : How do I do the correct exception handling so that
> correct relevant message is printed out ?
>
> Bacause I am sending invalid business data, I get HTTP 500. But as
> you can see in the return HTTP message below, the business exception
> / fault string is "TruckID EXAMPLE-5 cannot be found" but instead I
> get "Cannot deserialize" with Axis and "HTTP 500 error" with gSOap.
>
> This post is only regarding Axis, so I am not expecting any replies
> regarding gSOap.
>
> Below, I have used MacDonalds as an example. They are not my customer :)
>
> Thanks a LOT in advance !!
>
> Below is my client code : ------------------------------------
>
> try
> {
> CustomerService service;
> allocSvcObj.setUsername("username");
> allocSvcObj.setPassword("password");
> TruckObject * createdTruckId = service.callCustomerMethod(
> "EXAMPLE-5","BBB" );
> }
> catch(AxisException& e)
> {
> printf("Exception : %s\n", e.what());
> }
>
> I also tried :
> catch( SoapFaultException & e)
> {
> const char *excpCode = e.getFaultCode();
> const char *excpMessage = e.getFaultString();
> printf("Got Soap Fault : code : [%d], message : [%s]\n",
> excpCode, excpMessage);
> }
> catch( AxisException& e)
> {
> int iExceptionCode = e.getExceptionCode();
> const char *excpMessage = e.getMessage();
> printf("Got axis exception : code : [%d], message : [%s]\n",
> iExceptionCode, excpMessage);
> }
>
>
>
> Below is my client run result : ------------------------------------
>
> Exception : Cannot deserialize the requested element
> if I print e.exceptionCode(), I get 72.
>
> Below is what the customer's http server returned :
> ------------------------------------
>
>
> HTTP/1.1 500 Internal Server Error
> Server: Apache-Coyote/1.1
> Set-Cookie: JSESSIONID=EE7CCB1E9C3F32E1E340387CEFB3C39C; Path=/dm
> Content-Type: text/xml;charset=utf-8
> Transfer-Encoding: chunked
> Date: Thu, 19 Feb 2009 14:35:29 GMT
> Connection: close
>
> 291
> <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="
> http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://
> www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/
> XMLSchema-instance
>
"><soapenv:Body><soapenv:Fault><faultcode>soapenv:Server.generalException</
> faultcode><faultstring>E20010 TruckID EXAMPLE-5 cannot be found
> [R00007]; nested exception is:
> com.MacDonalds.common.exceptions.RecordDeletedException: E20010
> TruckID EXAMPLE-5 cannot be found [R00007]</
> faultstring><detail><ns1:hostname xmlns:ns1="http://xml.apache.org/axis/
> ">mp-srv-lin02</ns1:hostname></detail></soapenv:Fault></
> soapenv:Body></soapenv:Envelope>
>
>
>
>