You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Barak Bar Orion <ba...@gmail.com> on 2006/01/02 09:04:10 UTC

User defined fault help

I am using axis to write a web server that will be access mostly from .Net
clients.
Therefore I write the wsdl manually use wsdl2java to produce the java
classes for my value objects the stub and the skeleton.
I am trying to define a fault for each of my server errors in such why that
my server will throw the faults to the .Net client.
I didn't found an example of such thing in the sample dir.

This is what I did (not working)

WSDL:
<definitions
<types>
       <schema ...
           <element name=3D"APIException">
               <complexType>
                   <all>
                       <element name=3D"errorCode" type=3D"long"/>
                       <element name=3D"description" type=3D"string"
nillable=3D"true"/>
                   </all>
               </complexType>
           </element>
 </schema>
</types>

   <message name=3D"APIExceptionMessage">
       <part name=3D"fault" element=3D"s:APIException"/>
   </message>

  <portType name=3D"myPort">
       <operation name=3D"linkAssetToCategory">
           <input message=3D"tns:linkAssetToCategoryRequest"/>
           <output message=3D"tns:linkAssetToCategoryResponse"/>
           <fault name=3D"APIException" message=3D"tns:APIExceptionMessage=
"/>
       </operation>
 </portType>

   <binding ....
       <operation name=3D"linkAssetToCategory">
           <soap:operation
soapAction=3D"http://soapinterop.org/"/<http://soapinterop.org/%22/>
>
           <input>
               <soap:body use=3D"encoded" namespace=3D"http://soapinterop.=
org/"
                          encodingStyle=3D"
http://schemas.xmlsoap.org/soap/encoding/"/<http://schemas.xmlsoap.org/soap/encoding/%22/>
>
           </input>
           <output>
               <soap:body use=3D"encoded" namespace=3D"http://soapinterop.=
org/"
                          encodingStyle=3D"
http://schemas.xmlsoap.org/soap/encoding/"/<http://schemas.xmlsoap.org/soap/encoding/%22/>
>
           </output>
           <fault name=3D"APIException">
               <soap:fault encodingStyle=3D"
http://schemas.xmlsoap.org/soap/encoding/"<http://schemas.xmlsoap.org/soap/encoding/%22>
                           namespace=3D"s:APIException" use=3D"encoded"
name=3D"APIException"/>
           </fault>
       </operation>
</binding>
</definitions>


deploy.wsdd:

<deployment ...
 <service ...
   <typeMapping
               xmlns:ns=3D"http://soap.dalet.com/"
               qname=3D"ns:APIException"
               type=3D"java:com.dalet.soap.APIException"
               serializer=3D"
org.apache.axis.encoding.ser.ArraySerializerFactory"
               deserializer=3D"
org.apache.axis.encoding.ser.ArrayDeserializerFactory"
               encodingStyle=3D"http://schemas.xmlsoap.org/soap/encoding/"
               />
       <operation name=3D"linkAssetToCategory" returnQName=3D"return"
returnType=3D"dalet:ArrayOflong"
                  xmlns:dalet=3D"http://soap.dalet.com/"
                   xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema">
           <part name=3D"assetId" type=3D"xsd:long"/>
           <part name=3D"categoryId" type=3D"xsd:long"/>
           fault class=3D"com.dalet.soap.APIException" />
       </operation>

When I deploy this one I got axis error because the deployment of
linkAssetToCategory does not match the wsdl definition.
However I could not understand what is wrong.


--
Barak Bar Orion