[UPHPU] Alternative ways to accomplish the same thing
Scott Hill
llihttocs at gmail.com
Tue Feb 20 14:03:44 MST 2007
Recently I was retrieving information from a web service. Because of
invalid data sent in the request, the web service returned an exception. I
believe the web service was written in java because the execption is huge
(that's as far as I'm going on that subject). Below is an example of part
of the faultstring value that is returned.
Call to ItmsMaintenanceWS failedjavax.ejb.EJBTransactionRolledbackException:
com.tess.common.exception.TessRuntimeException: There was an error
validating the card. [INVALID CARD]
at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:89)
at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java
:196)
I only needed the text found in the []'s to display the error to the user.
I was in a hurry and use the following code to get what I needed.
$firsttext = explode('[',$response->faultstring);
$secondtext = explode(']',$firsttext[1]);
echo $secondpart[0];
This works but I was wondering how someone else might extract the text. I
know there are many ways to accomplish this and I was interested in seeing
if anyone else had a different way of doing this.
Thanks,
--
Scott Hill
"May you solve interesting problems" - Author Unknown
"A fanatic is one who can't change his mind and won't change the subject." -
Sir Winston Churchill
More information about the UPHPU
mailing list