[vwnc] Soap Fault <detail>

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[vwnc] Soap Fault <detail>

Peter Goessaert
Hello all,

I'm in VW 7.4.1 and I try to raise a Soap exception with some structural information in the <detail> element.

It is trivial to add a string as detail:

SoapServerFault
        faultString: 'Application error';
        detailContents: '<errorcode>1001</errorcode>'
        raise

which gives me

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Body>
      <SOAP-ENV:Fault>
         <faultcode>SOAP-ENV:Server</faultcode>
         <faultstring>Application error</faultstring>
         <detail>
            <string xmlns="http://www.w3.org/2001/XMLSchema">'&lt;errorcode>1001&lt;/errorcode>'</string>
         </detail>
      </SOAP-ENV:Fault>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

But how should I build the detail to get this in the error message:

...
         <detail>
            <errorcode>1001<errorcode>
         </detail>
...

Anyone an idea?

Thanks in advance,

Peter
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Soap Fault <detail>

Kogan, Tamara
Hello Peter,

Soap1.1 doesn't provide any requirements how <detail> elements should be encoded. If you want to add cusrom elements they should be specified on a namespace different than xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/".
 
For example:
<detail>
   <e:errorcode xmlns:e="Some-URI">1001<e:errorcode>
</detail>


The X2O specification that encodes SoapFault object is defined in XMLObjectBinding class>>defaultSoapBindingLocation.
<struct name="faultDetail" >
        <any aspect="contents" form="qualified"/>
</struct>
By default whatever you specify in #detailContents: will be marshaled as a string.

You can create your MySoapServerFault and define X2O binding specification for encoding #detail element.
For example
<struct name="faultDetail">
        <errorcode aspect="errorcode" form="qualified" namespace="mynamespace"/>
</struct>
 MySoapServerFault
         faultString: 'Application error';
         detail: (Struct new
                                errorcode: 1001;
                                yourself)
         raise

HTH,
Tamara Kogan
Smalltalk development,
Cincom Systems
 

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Peter Goessaert
> Sent: Thursday, May 14, 2009 9:18 AM
> To: [hidden email]
> Subject: [vwnc] Soap Fault <detail>
>
> Hello all,
>
> I'm in VW 7.4.1 and I try to raise a Soap exception with some
> structural information in the <detail> element.
>
> It is trivial to add a string as detail:
>
> SoapServerFault
>         faultString: 'Application error';
>         detailContents: '<errorcode>1001</errorcode>'
>         raise
>
> which gives me
>
> <SOAP-ENV:Envelope
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
>    <SOAP-ENV:Body>
>       <SOAP-ENV:Fault>
>          <faultcode>SOAP-ENV:Server</faultcode>
>          <faultstring>Application error</faultstring>
>          <detail>
>             <string
> xmlns="http://www.w3.org/2001/XMLSchema">'&lt;errorcode>1001&l
t;/errorcode>'</string>

>          </detail>
>       </SOAP-ENV:Fault>
>    </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
>
> But how should I build the detail to get this in the error message:
>
> ...
>          <detail>
>             <errorcode>1001<errorcode>
>          </detail>
> ...
>
> Anyone an idea?
>
> Thanks in advance,
>
> Peter
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc