replace property types of XmlQualifiedName[] with string[]?
I have generated a proxy class running svcutil on a wsdl based of this wsdl.
I had to do some modification for the web service to even work. For example i had to replace all property datatypes of type double[] to string[].
Now my question is:
Is it okay (still valid) to modify my generated proxy file and replace property types of XmlQualifiedName[] with string[]?
The reasons i want to do this is because:
- the response XML looks. a lot better/cleaner when i use a string
- The response xml using XMLQualifiedName does some unwanted "x003A" encoding on the colon.
Example response using XmlQualifiedName[]:
...
<Filter_Capabilities xmlns="http://www.opengis.net/ogc">
<Spatial_Capabilities>
<GeometryOperands>
<q1:GeometryOperand xmlns:q1="http://www.opengis.net/ogc" xmlns="">gml_x003A_Point</q1:GeometryOperand&开发者_如何学JAVAgt;
<q2:GeometryOperand xmlns:q2="http://www.opengis.net/ogc" xmlns="">gml_x003A_LineString</q2:GeometryOperand>
<q3:GeometryOperand xmlns:q3="http://www.opengis.net/ogc" xmlns="">gml_x003A_Polygon</q3:GeometryOperand>
</GeometryOperands>
...
Example response using string[]:
...
<Filter_Capabilities xmlns="http://www.opengis.net/ogc">
<Spatial_Capabilities>
<GeometryOperands>
<GeometryOperand>gml:Point</GeometryOperand>
<GeometryOperand>gml:LineString</GeometryOperand>
<GeometryOperand>gml:Polygon</GeometryOperand>
</GeometryOperands>
...
Ultimately, it's OK for you to change the proxy however you like. The validity of your changes is ultimately determined by whether the client and the service do what you want them to do in all cases with the modified proxy.
I see a few possible problems with this change, however:
If you are using these types for more than just XML -- for example, if you use them to send JSON to the service -- the service will throw an exception. This is NOT a problem for the XmlQualifiedName / string scenario (since WCF's JSON deserializer expects regular JSON-style strings in both cases). It is, however, a problem in the double / string scenario (since WCF's JSON deserializer expects a JSON number for doubles but a JSON string for strings).
If you use these same types for sending back XML requests or responses back to the service, they may throw errors on th service side even in XML / SOAP scenarios. More dangerously, they may populate the service side with incorrect or empty data (for example, empty strings, zeroed numbers, incomplete XML qualified names, etc.). This would be particularly dangerous in polymorphic scenarios, if you start doing similar magic with primitives.
Hope this helps!
精彩评论