Hi Lorenzo,
  I got the custom fault working. Here's my
SOAP messages

Request
---------------------------

<?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>
  <ns1:calculateFibonacci
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
xmlns:ns1="urn:fibonacci">
   <in0 xsi:type="xsd:int">103333</in0>
  </ns1:calculateFibonacci>
 </soapenv:Body>
</soapenv:Envelope>


Response ----------------------
?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></faultstring>
   <detail>
    <ns1:fault href="#id0" xmlns:ns1="urn:fibonacci"/>
    <ns2:exceptionName
xmlns:ns2="http://xml.apache.org/axis/";>fibonacci.ws.MyException</ns2:except
ionName>
   </detail>
  </soapenv:Fault>
  <multiRef id="id0" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
xsi:type="ns3:MyException"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";
xmlns:ns3="urn:fibonacci">
   <errorCode xsi:type="xsd:string">343</errorCode>
   <errorDesc xsi:type="xsd:string">failure here</errorDesc>
  </multiRef>
 </soapenv:Body>
</soapenv:Envelope>


I used the java2wsdl to generate my wsdl but it seems there is a bug and it
doesn't generate exactly as it should. I tweaked ti a bit generated stubs
and skeletons again and its working for me. let me know if you want to see
my code. I am attaching  my test client. I used RPC/Encoded style. But it
should work for others too.

Sunil

----- Original Message -----
From: "Lorenzo Dalla Vecchia" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, January 23, 2005 2:42 AM
Subject: Samples/fault: empty detail item


> Hello.
>
> I'm still struggling to get custom exceptions throws correctly, so I
decided
> to simplify the problem.
> I took the samples.fault example included in Axis and deployed it. I did
not
> change a single line, nor recompiled the classes: just ran AdminClient
over
> the supplied deploy.wsdd.
>
> I then try calling getEmployee without specifying a id, expecting a
> NoSuchEmployeeException (in its SOAP Fault form of course). To keep it
> simple I didn't code a client, just called
> http://localhost:8080/axis/services/Employee?method=getEmployee and here's
> the resulting SOAP message:
>
> <?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.userException</faultcode>
>       <faultstring>samples.faults.NoSuchEmployeeFault</faultstring>
>       <detail />
>     </soapenv:Fault>
>   </soapenv:Body>
> </soapenv:Envelope>
>
> As you can see the <detail> item is empty, while it should contain
exception
> data (like specified in the WSDL returned by Axis ?wsdl query):
>
> <complexType name="NoSuchEmployeeFault">
>   <sequence>
>     <element name="info" nillable="true" type="xsd:string" />
>     <element name="cause" nillable="true" type="xsd:anyType" />
>     <element name="message" nillable="true" type="xsd:string" />
>   </sequence>
> </complexType>
>
> This also happens with all my other web services and I'm starting to
suspect
> it's a configuration problem (since at least the pre-compiled sample with
> provided wsdd should work).
>
> All I did was copying Axis servlet in Tomcat 5.0 jwsdp webapps directory
and
> putting all the jars in axis/lib in my classpath. Should I have done
> something more?
>
> Hope you can help me sorting this out... thanks in advance!
>
> --
> Lorenzo.
>
>
>

Attachment: FibonacciTester.java
Description: Binary data

Reply via email to