<field> is not a string; it is a complex type (struct) with name and error members. I would imagine you would do
FaultField.java: public class FaultField { public String name; public String error; } Your SOAP client: SOAPMappingRegistry smr = new SOAPMappingRegistry(); BeanSerializer deser = new BeanSerializer(); smr.mapTypes(Constants.NS_URI_SOAP_ENC, new QName("http://tempuri.org", "field"), FaultField.class, null, deser); Your SOAP service: emit <field xsi:type="nsx:field" xmlns:nsx="http://tempuri.org"> Or, just stop adding this stuff and handle fault.getDetailEntries() as a Vector of Element. Scott Nichol ----- Original Message ----- From: "Omprakash Bachu" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Cc: "Scott Nichol" <[EMAIL PROTECTED]> Sent: Thursday, October 31, 2002 4:53 PM Subject: RE: how to override code in <faultcode>SOAP-ENV:Server</faultcode> tag > Hi Scott, I'm setting xsi:type in the elements which you suggested. But > still finding null if I System.out.println( fault.getDetailEntries() ) where > as if I see System.out.println(fault) then I can see at client side its > getting received below fault block. This is some thing very similar to, if > I compare with addressbook example getAllListings which gives the entire > XML. But where as fault.getDetailEntries() api is trying to make Vector out > of that detail block and its failing at that point in time. > > Please correct me if I'm wrong, in this case why do we need to set xsi:type > for strings and map to BeanSerializer if they are supported by default. > > ... > <SOAP-ENV:Fault> > <faultcode>SOAP-ENV:Server</faultcode> > <faultstring>Exception from service object: Errors occurred while > processing the message.</faultstring> > <faultactor>/soap/servlet/rpcrouter</faultactor> > <detail> > <field xsi:type="xsd:string"> > <name xsi:type="xsd:string">postDt</name> > <error xsi:type="xsd:string">date is not correct</error> > </field> > </detail> > </SOAP-ENV:Fault> > ... > > thanks in advance > :o)m > > -----Original Message----- > From: Scott Nichol [mailto:snicholnews@;scottnichol.com] > Sent: Wednesday, October 30, 2002 6:06 PM > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: Re: how to override code in > <faultcode>SOAP-ENV:Server</faultcode> tag > > > Fault.getDetailEntries() just returns a Vector of Element unless it > knows how to deserialize the entries. In your case, you would have to > add an xsi:type attribute to the <field> elements you write and map a > deserializer for that type if you want them deserialized. Note that if > you use the BeanSerializer, you will also need xsi:type for the <name> > and <error> elements. > > Scott Nichol > > ----- Original Message ----- > From: "Omprakash Bachu" <[EMAIL PROTECTED]> > To: "Scott Nichol" <[EMAIL PROTECTED]>; > <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Wednesday, October 30, 2002 5:56 PM > Subject: RE: how to override code in > <faultcode>SOAP-ENV:Server</faultcode> tag > > > > Hi Scott, System.out.println(fault), prints as belwo... > > > > ... > > [DetailEntries= > > [(0)=<field><name>postDt</name><error>date is not > correct</error></field>] > > [(1)=<field><name>acctNum</name><error>acctNum is not > > correct</error></field>] > > ] > > ... > > > > It seems that Fault.getDetailEntries() call and its sub calls may > unmarshall > > methods missing this out... > > > > please help me... > > > > thanks in advance > > :o)m > > -----Original Message----- > > From: Scott Nichol [mailto:snicholnews@;scottnichol.com] > > Sent: Wednesday, October 30, 2002 5:44 PM > > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > > Subject: Re: how to override code in > > <faultcode>SOAP-ENV:Server</faultcode> tag > > > > > > What prints if you just do System.out.println(fault)? > > > > Scott Nichol > > ----- Original Message ----- > > From: "Omprakash Bachu" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > > Sent: Wednesday, October 30, 2002 5:29 PM > > Subject: RE: how to override code in > > <faultcode>SOAP-ENV:Server</faultcode> tag > > > > > > > Wow!!! thats a good idea and thanks a lot to Scott and rob. > > > > > > By the way one more question, I'm using the custom fault handler... > > > But in my SOAP Client, if I use fault.getDetailEntries() its not > > getting all > > > the child elements in the vector. > > > > > > For System.out.println("detail vector is..." + > > fault.getDetailEntries()); > > > then my Client out put is > > > > > > [[field: null], [field: null]] > > > > > > > > > > > > > > > Though the SOAP Wire dump is, > > > > > > ... > > > <SOAP-ENV:Fault> > > > <faultcode>SOAP-ENV:Server</faultcode> > > > <faultstring>Exception from service object: Errors occurred while > > processing > > > the message.</faultstring> > > <faultactor>/soap/servlet/rpcrouter</faultactor> > > > <detail> > > > <field> > > > <name>postDt</name> > > > <error>date is not correct</error> > > > </field> > > > <field> > > > <name>acctNum</name> > > > <error>acctNum is not correct</error> > > > </field> > > > </detail> </SOAP-ENV:Fault> > > > ... > > > > > > thanks in advance... > > > :o)m > > > > > > -----Original Message----- > > > From: Robert Dietrick [mailto:rdietrick@;sega.com] > > > Sent: Wednesday, October 30, 2002 5:04 PM > > > To: [EMAIL PROTECTED] > > > Subject: Re: how to override code in > > > <faultcode>SOAP-ENV:Server</faultcode> tag > > > > > > > > > You can pass the fault code to the constructor of the SOAPException. > > > > > > e.g., > > > > > > throw new SOAPException(org.apache.soap.Constants.FAULT_CODE_CLIENT, > > > "something went wrong"); > > > > > > You may want to write a custom FaultHandler, if you want to provide > > more > > > detailed information to the > > > client. > > > > > > > > > Omprakash Bachu wrote: > > > > Hi, from RPC serivce I'm trying to set custom fault code and hence > > will be > > > > available to retrieve by using fault.getFaultCode() API, but it > > seems that > > > > Apache by default sets this as SOAP-ENV:Server, can anyone help me > > how to > > > > override this code? > > > > > > > > Sample: > > > > > > > > <faultcode>SOAP-ENV:Server</faultcode> > > > > <faultstring>I can set custom string, this is ok</faultstring> > > > > > > > > Cheers!!! > > > > Om > > > > > > > > > > > > -- > > > > To unsubscribe, e-mail: > > <mailto:soap-user-unsubscribe@;xml.apache.org> > > > > For additional commands, e-mail: > > <mailto:soap-user-help@;xml.apache.org> > > > > > > > > > > > > > > > > -- > > > To unsubscribe, e-mail: > > <mailto:soap-user-unsubscribe@;xml.apache.org> > > > For additional commands, e-mail: > > <mailto:soap-user-help@;xml.apache.org> > > > > > > > > > -- > > > To unsubscribe, e-mail: > > <mailto:soap-user-unsubscribe@;xml.apache.org> > > > For additional commands, e-mail: > > <mailto:soap-user-help@;xml.apache.org> > > > > > > > > > > > > > -- > To unsubscribe, e-mail: <mailto:soap-user-unsubscribe@;xml.apache.org> > For additional commands, e-mail: <mailto:soap-user-help@;xml.apache.org> > > -- To unsubscribe, e-mail: <mailto:soap-user-unsubscribe@;xml.apache.org> For additional commands, e-mail: <mailto:soap-user-help@;xml.apache.org>