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