Re: Exception werfen (Controller und Webservice)

"Nils Beckmann" <[email protected]> Fri, 23 Feb 2007 09:30:27 +0100
Newsgroups gmane.comp.lang.ruby.german
Message-ID <[email protected]>
--===============0689406673==
Content-Type: multipart/alternative; 
	boundary="----=_Part_45371_4059551.1172219427463"

------=_Part_45371_4059551.1172219427463
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Okay.

Ich nutze soap4r. Rufe =FCber eine Webservice eine Methode im Controller au=
f.
Der Webservice gibt ein String zur=FCck. Sieht wie folgt aus:
 api_method :create,
                   :expects =3D> [{:var =3D> :string},
                                      ....
                                      {:varX =3D :string}],
                    :returns =3D> [:string]

Im Controller wird eine Methode abgearbeite in der eine Exception auftreten
kann.

def methode
     begin
             .
             .
     rescue =3D> exc

     end
end

In dem rescue soll jetzt das Exception handling passieren.
Ich hab es mit Exception.new(exc) versucht.
Das Ergebniss was ich bekommme ist das der R=FCckgabestring vom Webservice =
die
Message von der Exception enth=E4lt. Was ich aber m=F6chte ich das ich eine
soapfault zur=FCck bekomme. Hab leider auch noch nichts gefunden was mir sa=
gt
ob es einen soapfaul =FCberhaupt in Ruby oder Ruby on Rails gibt. Ich wei=
=DF nur
das es bei Java geht.

gru=DF
Nils


Am 22.02.07 schrieb Tim Becker <[email protected]>:
>
> > Kurzgesagt. Habe eine Controller der eine Exception zur=FCck geben soll=
,
> an
> > eine Webservice. =DCber Soap. Es soll also ein soapfault zur=FCck komme=
n.
> > Vielleicht hat ja noch einer eine idee
>
>
> Ich vermute mal, dass Du soap4r verwendest? Was passiert den jetzt,
> wenn Du die Ruby Exception wirfst? Vielleicht kannst Du ein bisschen
> naeher erlaeutern, was Du probierst, was nicht wie erwartet
> funktioniert, usw. Idealerweise mit ein wenig Code.
>
> Gruss,
>    -tim
>
>
>
> >
> > _______________________________________________
> > Ruby-de-talk mailing list
> > [email protected]
> > http://rubyforge.org/mailman/listinfo/ruby-de-talk
> >
> _______________________________________________
> Ruby-de-talk mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/ruby-de-talk
>

------=_Part_45371_4059551.1172219427463
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

<span class=3D"ppt" id=3D"[email protected]">Okay.<br><br>Ic=
h nutze soap4r. Rufe =FCber eine Webservice eine Methode im Controller auf.=
 Der Webservice gibt ein String zur=FCck. Sieht wie folgt aus:<br></span><s=
pan class=3D"ppt" id=3D"[email protected]">
&nbsp;api_method :create, <br>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :expects =3D&gt; [{:var =
=3D&gt; :string},<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp=
; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ....<b=
r>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {:varX =3D :string}],<br>=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :returns =3D&gt; [:string]
<br><br>Im Controller wird eine Methode abgearbeite in der eine Exception a=
uftreten kann.<br><br>def methode<br>&nbsp;&nbsp;&nbsp;&nbsp; begin<br>&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .<br>&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .<b=
r>&nbsp;&nbsp;&nbsp;&nbsp; rescue =3D&gt; exc<br>&nbsp;&nbsp;&nbsp;&nbsp; <=
br>&nbsp;&nbsp;&nbsp;&nbsp; end<br>end<br><br>In dem rescue soll jetzt das =
Exception handling passieren.
<br>Ich hab es mit Exception.new(exc) versucht.<br>Das Ergebniss was ich be=
kommme ist das der R=FCckgabestring vom Webservice die Message von der Exce=
ption enth=E4lt. Was ich aber m=F6chte ich das ich eine soapfault zur=FCck =
bekomme. Hab leider auch noch nichts gefunden was mir sagt ob es einen soap=
faul =FCberhaupt in Ruby oder Ruby on Rails gibt. Ich wei=DF nur das es bei=
 Java geht.
<br><br>gru=DF<br>Nils<br><br></span><br><div><span class=3D"gmail_quote">A=
m 22.02.07 schrieb <b class=3D"gmail_sendername">Tim Becker</b> &lt;<a href=
=3D"mailto:[email protected]">[email protected]</a>&gt;:</span><blockquot=
e class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, 204, 204);=
 margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
&gt; Kurzgesagt. Habe eine Controller der eine Exception zur=FCck geben sol=
l, an<br>&gt; eine Webservice. =DCber Soap. Es soll also ein soapfault zur=
=FCck kommen.<br>&gt; Vielleicht hat ja noch einer eine idee<br><br><br>Ich=
 vermute mal, dass Du soap4r verwendest? Was passiert den jetzt,
<br>wenn Du die Ruby Exception wirfst? Vielleicht kannst Du ein bisschen<br=
>naeher erlaeutern, was Du probierst, was nicht wie erwartet<br>funktionier=
t, usw. Idealerweise mit ein wenig Code.<br><br>Gruss,<br>&nbsp;&nbsp; -tim=
<br><br>
<br><br>&gt;<br>&gt; _______________________________________________<br>&gt=
; Ruby-de-talk mailing list<br>&gt; <a href=3D"mailto:Ruby-de-talk@rubyforg=
e.org">[email protected]</a><br>&gt; <a href=3D"http://rubyforge.o=
rg/mailman/listinfo/ruby-de-talk">
http://rubyforge.org/mailman/listinfo/ruby-de-talk</a><br>&gt;<br>_________=
______________________________________<br>Ruby-de-talk mailing list<br><a h=
ref=3D"mailto:[email protected]">[email protected]</a><br=
>
<a href=3D"http://rubyforge.org/mailman/listinfo/ruby-de-talk">http://rubyf=
orge.org/mailman/listinfo/ruby-de-talk</a><br></blockquote></div><br>

------=_Part_45371_4059551.1172219427463--

--===============0689406673==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Ruby-de-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ruby-de-talk
--===============0689406673==--