Default namespaces, MS CRM 2011 and JAXWS
I posted a very similar question back in 2010 and never found a solution (see http://www.java.net/node/702532 )
It's come back to haunt me again. At the risk of this getting way too long, here's some XML generated by jaxws for a certain request to a Microsoft CRM 2011 server (I've formatted it a bit):
<?xml version='1.0' encoding='UTF-8'?>
Here's the same request as created by a C# client consuming the same service as a web reference.
<?xml version="1.0" encoding="utf-8"?>
The second one works. The first one doesn't. And it entirely comes down to the way the namespace is applied to the "Execute" element. If it is declared as the default namespace for that element, the request is processed. If not (say, it's declared and applied as a prefix) then it fails, MS CRM apparently just not seeing the request element at all. I can tweak that first piece of XML and add the necessary default NS decl to "Execute" and it works. That's all it takes.
This is clearly a bug in the MS CRM web service implementation (or its XML parsing). But there's not much I can do about that - all I know is the CIO wants this integration working again (*sigh*).
I've been poring over the source for JAXB and JAXWS for a few days, I've messed about a bit with the NamespacePrefixMapper property, and I can't find any way to customise this particular piece of XML serialisation behaviour. I can see glimpses of promise in the code here any there (although not under the "v2" package) but I can't work out how to get to them.
Can folks tell me if I should just give up trying to change the XML output to suit microsoft and just submit my requests to MS CRM as constructed XML strings? At this point, I'm just after whatever gets things working the quickest, and hang the elegance.
As an aside, I'm a bit baffled that MS can get away with this. It's obviously not a new problem, and I thought there were "plug fests" where integration between toolkits got tested. Yet their web service simply doesn't accept valid XML requests. How?