views:

45

answers:

1

Hi all,

here's a problem I just stumbled into:

I have an php based web service which returns statistical data about customers in the form of WSDL-complex types. The actual complex type consists of

xsd:string
xsd:int
xsd:float

Now, since my web service is sort of an adapter to an existing system I can't realy controll what values are packed into that complex type. I.e. it can - and does - happen that fields defined as xsd:float are simply set to '' by the php application.

This is no problem as long as a php based system consumes the service, but of course typed frameworks - like .NET - choke on casting '' to float and throw nasty exceptions.

Since I can't controll what values reliably what goed into my complex types I'm looking for another way of handling invalid data in my web service.

Did anyone run into this too? I'd appreciate and thoughts and ideas; thanks in advance!

K

+2  A: 

Why don't you use type casting?

xsd:<?=(string) $string?>
xsd:<?=(int) $int?>
xsd:<?=(float) $float?>

This would put things exactly like you want them, or have I misinterpreted the question?

Frankie