title: SOAP client, dynamically changing server, unexplained error
body: <p>I'm trying to implement a SOAP client that access many servers.  However, the servers don't use <em>identical</em> WSDL.  They differ in the binding name and service name, such as:</p>
  
  <pre><code>namespace="http://www.standards.org/"
  
  &lt;wsdl:service name="vendorA_ep"&gt;
      &lt;wsdl:port name="vendorA_svc_pt" binding="tns:InventoryBinding"&gt;
          &lt;soap:address location="http://vendorA.com/InventoryService/inventory_ep"/&gt;
      &lt;/wsdl:port&gt;
  &lt;/wsdl:service&gt;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>namespace="http://www.standards.org/WSDL/"
  
  &lt;wsdl:service name="vendorB_InvSvc"&gt;
      &lt;wsdl:port name="vendorB_InvSvcBinding" binding="tns:InventorySvcBinding"&gt;
          &lt;soap:address location="http://vendorB.com/InventoryService/customerInventory.svc"/&gt;
      &lt;/wsdl:port&gt;
  &lt;/wsdl:service&gt;
  </code></pre>
  
  <p>Per various suggestions, I've used the WSDL of vendorA to create a client through JAX-WS, then modified it to use a locally-based WSDL:</p>
  
  <pre><code>public VendorA_Service() {
      URL url = VendorA_Service.class.getResource("/META-INF/wsdl/standards.wsdl");
      QName service = new QName("http://www.standards.org", "vendorA_ep");
      super(url, service);
  }
  </code></pre>
  
  <p>(yes, the META-INF works, as long as it is hidden within the WEB-INF/classes directory)</p>
  
  <p>I then call it in my client:</p>
  
  <pre><code>InventoryService_Service endPoint = new InventoryService_Service();
  InventoryService inventoryService = endPoint.getInventoryServiceBinding();
  Reply reply = inventoryService.getInventoryLevels(request);
  </code></pre>
  
  <p>All is well.  Now I want to switch to data from vendorB:</p>
  
  <pre><code>InventoryService_Service endPoint = new InventoryService_Service();
  InventoryService inventoryService = endPoint.getInventoryServiceBinding();
  
  BindingProvider bp = (BindingProvider) inventoryService;
  // Below is the trouble line!
  bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://vendorB.com/InventoryService/customerInventory.svc");
  
  Reply reply = inventoryService.getInventoryLevels(request);
  </code></pre>
  
  <p>At executing getInventoryLevels() I'm treated to this error message:</p>
  
  <pre><code>javax.xml.ws.soap.SOAPFaultException: The &lt;from&gt; value is invalid.
  The result of from-spec is null.
  Either the from node value or the xpath query in the from node value was invalid.
  According to BPEL4WS spec 1.1 section 14.3, the from node value should not be empty. Verify the from node value at line number 79 in the BPEL source.
  </code></pre>
  
  <p>I've no clue why the different endpoint yields an obscure error message.  I think that I'm missing some secret super-sauce but don't know what it is.</p>
  
  <p>TIA,
  Jerome.</p>