title: WSDL-Axis2 CodeGen Problem
body: <p>I am having a problem sending a WS Request to a Server. It seems that the Namespace(NS) in one of the ComplexTypes of an operation types is causing an <code>xsi:type</code> to be spewed as part of the generated SOAP Request.</p>
  
  <p>Please see below for WSDL Sample:</p>
  
  <p><code>
  &lt;xs:complexType name="SubscribeAppendantProductRequest"&gt;<br>
  &lt;xs:complexContent&gt;<br>
  &lt;xs:extension base="business:Common"&gt;<br>
  &lt;xs:sequence&gt;<br>
  &lt;xs:element maxOccurs="unbounded" name="Product"&gt;<br>
  &lt;xs:complexType&gt;<br>
  &lt;xs:complexContent&gt;<br>
  &lt;xs:extension base="business:Product"&gt;<br>
  &lt;xs:sequence&gt;<br>
  &lt;xs:element maxOccurs="unbounded" minOccurs="0" name="Service" type="business:Service" /&gt;<br>
  &lt;xs:element minOccurs="0" name="EffectiveDate" type="xs:string" /&gt;<br>
  &lt;xs:element minOccurs="0" name="ExpireDate" type="xs:string" /&gt;<br>
  &lt;xs:element name="ValidMode" type="business:ValidMode" /&gt;<br>
  &lt;/xs:sequence&gt;<br>
  &lt;/xs:extension&gt;<br>
  &lt;/xs:complexContent&gt;<br>
  &lt;/xs:complexType&gt;<br>
  &lt;/xs:element&gt;<br>
  &lt;xs:element minOccurs="0" name="HandlingChargeFlag" type="xs:int" /&gt;<br>
  &lt;xs:element minOccurs="0" name="CustID" type="xs:string" /&gt;<br>
  &lt;/xs:sequence&gt;<br>
  &lt;/xs:extension&gt;<br>
  &lt;/xs:complexContent&gt;<br>
  &lt;/xs:complexType&gt;
  </code></p>
  
  <p>See below for the the code generating the request on the Axis2 Operation/Stub:</p>
  
  <p><code>
  SubscribeAppendantProductRequest sub_req = new  SubscribeAppendantProductRequest();<br>
  Product_type2 subscribedToProduct = new Product_type2();<br>
  subscribedToProduct.setId(productKey);<br>
  subscribedToProduct.setValidMode(ValidMode.value1);<br>
  Product_type2 []subscribedProductList = new Product_type2[1];<br>
  subscribedProductList[0]=subscribedToProduct;<br>
  sub_req.addProduct(subscribedToProduct);<br>
  sub_req.setProduct(subscribedProductList);<br>
  sub_req.setSubscriberNo(subscriber);<br>
  return sub_req;
  </code></p>
  
  <p>Everytime I send a request, i get the following error message :</p>
  
  <blockquote>
    <p>Interface parameter fault:There has 1 XML Validation Errors: Invalid xsi:type qname: 'ns2:Product_type2' in element SubscribeAppendantProductRequest  </p>
  </blockquote>
  
  <p>See below for generated SOAP Request:    </p>
  
  <p><code>&lt;?xml version='1.0' encoding='UTF-8'?&gt;<br>
  &lt;soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"&gt;<br>
  &lt;soapenv:Body&gt;<br>
  &lt;ns3:SubscribeAppendantProductRequestMsg xmlns:ns3="http://www.huawei.com/bme/cbsinterface/cbs/businessmgrmsg"&gt;<br>
  &lt;RequestHeader&gt;<br>
  &lt;ns1:CommandId xmlns:ns1="http://www.huawei.com/bme/cbsinterface/common"&gt;SubscribeAppendantProduct&lt;/ns1:CommandId&gt;<br>
  &lt;ns1:Version xmlns:ns1="http://www.huawei.com/bme/cbsinterface/common"&gt;1.0&lt;/ns1:Version&gt;<br>
  &lt;ns1:TransactionId xmlns:ns1="http://www.huawei.com/bme/cbsinterface/common"&gt;trans001&lt;/ns1:TransactionId&gt;<br>
  &lt;ns1:SequenceId xmlns:ns1="http://www.huawei.com/bme/cbsinterface/common"&gt;2002396871686&lt;/ns1:SequenceId&gt;<br>
  &lt;ns1:RequestType xmlns:ns1="http://www.huawei.com/bme/cbsinterface/common"&gt;Event&lt;/ns1:RequestType&gt;<br>
  &lt;ns1:SerialNo xmlns:ns1="http://www.huawei.com/bme/cbsinterface/common"&gt;2002396871686&lt;/ns1:SerialNo&gt;<br>
  &lt;/RequestHeader&gt;<br>
  &lt;SubscribeAppendantProductRequest xmlns:ns2="http://www.huawei.com/bme/cbsinterface/cbs/businessmgr" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:SubscribeAppendantProductRequest"&gt;<br>
  &lt;ns2:SubscriberNo&gt;8090547759&lt;/ns2:SubscriberNo&gt;<br>
  &lt;ns2:Product xsi:type="ns2:Product_type2"&gt;<br>
  &lt;ns2:Id&gt;121390&lt;/ns2:Id&gt;<br>
  &lt;ns2:ValidMode&gt;4050000&lt;/ns2:ValidMode&gt;<br>
  &lt;/ns2:Product&gt;<br>
  &lt;/SubscribeAppendantProductRequest&gt;<br>
  &lt;/ns3:SubscribeAppendantProductRequestMsg&gt;<br>
  &lt;/soapenv:Body&gt;<br>
  &lt;/soapenv:Envelope&gt;
  </code></p>
  
  <p>I believe the problem is with the base extension of the Product complex type. </p>
  
  <p>Funnily enough, I had run a similar program on a different operation type with similar characteristics which worked OK. See below for WSDL Sample of Functional Operation:</p>
  
  <p><code>
  &lt;xs:complexType name="UnSubscribeAppendantProductRequest"&gt;<br>
  &lt;xs:complexContent&gt;<br>
  &lt;xs:extension base="business:Common"&gt;<br>
  &lt;xs:sequence&gt;<br>
  &lt;xs:element maxOccurs="unbounded" name="Product"&gt;<br>
  &lt;xs:complexType&gt;<br>
  &lt;xs:sequence&gt;<br>
  &lt;xs:element name="ProductID" type="xs:string" /&gt;<br>
  &lt;xs:element minOccurs="0" name="ProductOrderKey" type="xs:string" /&gt;<br>
  &lt;xs:element name="ValidMode" type="xs:string" /&gt;<br>
  &lt;xs:element minOccurs="0" name="ExpireDate" type="xs:string" /&gt;<br>
  &lt;xs:element maxOccurs="unbounded" minOccurs="0" name="Service"&gt;<br>
  &lt;xs:complexType&gt;<br>
  &lt;xs:sequence&gt;<br>
  &lt;xs:element name="Id" type="xs:string" /&gt;<br>
  &lt;xs:element maxOccurs="unbounded" name="SimpleProperty" type="business:SimpleProperty" /&gt;<br>
  &lt;/xs:sequence&gt;<br>
  &lt;/xs:complexType&gt;<br>
  &lt;/xs:element&gt;<br>
  &lt;/xs:sequence&gt;<br>
  &lt;/xs:complexType&gt;<br>
  &lt;/xs:element&gt;<br>
  &lt;xs:element minOccurs="0" name="CustID" type="xs:string" /&gt;<br>
  &lt;/xs:sequence&gt;<br>
  &lt;/xs:extension&gt;<br>
  &lt;/xs:complexContent&gt;<br>
  &lt;/xs:complexType&gt;
  </code></p>
  
  <p>When I did a compare , it seems that they both use the <code>Product</code> complex Type but it seems that the faulty uses <code>Product</code> complex type as an extension.</p>
  
  <p>Does anyone have experience with this? Any possible solutions? Would things be different if I used a different Data Binding ( from ADB that is)?</p>