In your service, declare that a specific method throws an exception and a
fault entry will be created for you.
Real world example:
public String getAssetHostname(int assetId) throws AssetNotFoundException {
}
and the associated WSDL:
<wsdl:message name="AssetNotFoundException">
<wsdl:part name="fault" type="tns1:AssetNotFoundException"/>
</wsdl:message>
<wsdl:message name="getAssetHostnameRequest">
<wsdl:part name="assetId" type="xsd:int"/>
</wsdl:message>
<wsdl:message name="getAssetByHostnameResponse">
<wsdl:part name="getAssetByHostnameReturn" type="tns2:Asset"/>
</wsdl:message>
<wsdl:operation name="getAssetHostname" parameterOrder="assetId">
<wsdl:input message="impl:getAssetHostnameRequest" name
="getAssetHostnameRequest"/>
<wsdl:output message="impl:getAssetHostnameResponse" name
="getAssetHostnameResponse"/>
<wsdl:fault message="impl:AssetNotFoundException" name
="AssetNotFoundException"/>
</wsdl:operation>
HTH,
Ian
Ian D. Stewart
Open Systems Engineer II
Enterprise Midrange - Bank One Infrastructure & Operations
[EMAIL PROTECTED]
(614) 213-6100
"Cory Wilkerson" <[EMAIL PROTECTED]> on 08/06/2003 02:10:57 PM
Please respond to [EMAIL PROTECTED]
To: <[EMAIL PROTECTED]>
cc:
Subject: RPC & Faults
Good afternoon,
According to the WSDL specification, faults are defined as follows for a
request/response operation:
-------------------------------------
<wsdl:definitions .... >
<wsdl:portType .... > *
<wsdl:operation name="nmtoken" parameterOrder="nmtokens">
<wsdl:output name="nmtoken"? message="qname"/>
<wsdl:input name="nmtoken"? message="qname"/>
<wsdl:fault name="nmtoken" message="qname"/>*
</wsdl:operation>
</wsdl:portType >
</wsdl:definitions>
-------------------------------------
So, I'm assuming that I can specify my own type of fault and feed it to the
wsdl:fault element, ie:
-------------------------------------
<complexType name="corysfault">
<sequence>
<element name="someInfo" type="xsd:string"/>
<element name="moreInfo" type="xsd:string"/>
</sequence>
</complexType>
-------------------------------------
My question is this -- where do I need to start in order to pull this off
via an rpc/encoded service where Axis is handling all the
marshalling/unmarshalling of soap encoded messages into java types? Is
there a facility to return an unchecked Axis exception that's constructed
according the schema I've defined above? I'm imagining some sort of object
that I pass to some Axis utility to throw an exception perhaps?
-------------------------------------
CorysFault {
private String someInfo;
private String moreInfo;
public CorysFault() {
}
public get/set someInfo
public get/set moreInfo
}
-------------------------------------
Seems like this would be quite easy to pull off if I was using the message
provider, but alas, I'm not.
Thanks in advance for any input,
Cory
This transmission may contain information that is privileged, confidential and/or
exempt from disclosure under applicable law. If you are not the intended recipient,
you are hereby notified that any disclosure, copying, distribution, or use of the
information contained herein (including any reliance thereon) is STRICTLY PROHIBITED.
If you received this transmission in error, please immediately contact the sender and
destroy the material in its entirety, whether in electronic or hard copy format. Thank
you.