title: Why would same SOAP request work in one Flex project and not another?
body: <p>This is a pretty odd situation I have here. I have used a piece of code to interact with a backend SOAP service for several months - it works fine. I tried it out in a different project (first as an swc library and then just by cutting and pasting) and it just doesnt work.</p>
  
  <p>If I try the exact same code in the original flex project, connecting to the same backend service, everything works fine. In the new project, I can call operations that take simple document-literal wrappers as params (they have no real parameters) - but if the operation has a complex parameter inside the document literal wrapper - fail on this new project. Here is a sample that would fail:</p>
  
  <pre><code>var service:WebService = new WebService();
  service.wsdl = wsdlURL;
  var operation:AbstractOperation = service.getOperation( "addNewUser" );
  
  var param:XML = &lt;AddNewUserRequest/&gt;
  param.setNamespace( myNameSpace );
  
  param.user.username( username );
  param.user.email( email );
  
  operation.send( param );
  </code></pre>
  
  <p>And here is a sample that would work in the new project:</p>
  
  <pre><code>var service:WebService = new WebService();
  service.wsdl = wsdlURL;
  var operation:AbstractOperation = service.getOperation( "getUsers" );
  
  var param:XML = &lt;GetUsersRequest/&gt;
  param.setNamespace( myNameSpace );
  
  operation.send( param );
  </code></pre>
  
  <p>Here are some things that I have done to try an track this one down:</p>
  
  <p>-Examined the posts in firebug from both projects and can not see a difference (meaning that the code appears to generate the exact same SOAP request in both projects (as one expects)
  -I have verified that the requests should work using SOAPui to directly query the web service</p>
  
  <p>The back end service is an Apache CXF webservice and here is a sample of the error it generates:</p>
  
  <blockquote>
    <p>org.apache.cxf.interceptor.Fault: Found element {<a href="http://www.w3.org/2001/XMLSchema" rel="nofollow noreferrer">http://www.w3.org/2001/XMLSchema</a>}user but could not find matching RPC/Literal part</p>
  </blockquote>
  
  <p>Everything I know leads me to believe that user should be in the <a href="http://www.w3.org/2001/XMLSchema" rel="nofollow noreferrer">http://www.w3.org/2001/XMLSchema</a> namespace - and honestly - I believe the key here is that the code works in one project but not in the other. Could it be an XML setting? One of the static ones like ignoreWhitespace? I have played with changing those around - with no luck.</p>
  
  <p>Any ideas at all? This is driving me crazy!!!</p>
  
  <p>UPDATE:</p>
  
  <p>I have narrowed it down to this: the new project creates a header like this:</p>
  
  <pre><code>&lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
  </code></pre>
  
  <p>and the one that works creates this:</p>
  
  <pre><code>&lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
  </code></pre>
  
  <p>Why the difference on the exact same version of flex &amp; flex builder? The one that works is obviously correct (xmlns:xsd="http://www.w3.org/2001/XMLSchema") - the web service is correct to reject a request that puts everything in the request in the xsd namespace.</p>