Hi All
I really hope you can be of some assistance!
I'm currently working on an XML producing C# component. It uses a WSDL and an XSD (thru MS' xsd.exe and wsdl.exe) to create a proxy by which the XML is sent.
I can produce clean valid XML, but I cannot work out how to get namespaces into the code.
This is my XML:
Code:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
.....
<API>CREATE_ARR_ARRANGEMENT</API>
</MSG_HEADER>
<MSG_BODY>
<CreateArrearsArrangement>
<accountPaymentReference>71335</accountPaymentReference>
<startDate>2006-02-13</startDate>
.....
And FYI this is what the Service provider states I should be sending
Code:
<?xml version="1.0" encoding="UTF-8"?>
......
<ng0:API>CREATE_ARR_ARRANGEMENT</ng0:API>
</ng0:MSG_HEADER>
<ng0:MSG_SOAP_HEADER/>
<ng0:MSG_BODY>
<ng1:CreateArrearsArrangement>
<ng1:accountPaymentReference>71335</ng1:accountPaymentReference>
<ng1:startDate>2006-02-13</ng1:startDate>
.....
Here is some of the XSD code.
Code:
<xs:element name="CreateArrearsArrangement">
<xs:annotation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="accountPaymentReference" type="xs:date">
<xs:annotation>
<xs:documentation>This is the Pay....</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="startDate" type="xs:date">
<xs:annotation>
<xs:documentation>This is the Sta....nt</xs:documentation>
</xs:annotation>
</xs:element>
You can see above there is this:
Code:
<xs:element name="CreateArrearsArrangement">
I have tried setting this to:
Code:
<xs:element name="ng1:CreateArrearsArrangement">
and:
Code:
<xs:element name="ng1:CreateArrearsArrangement" ref="ng1:CreateArrearsArrangement">
but to no avail. I can't use ref on it's own all the time, because for most elements I require the type="" attribute to be set.
Does anyone have experience using namespaces in XSDs? Google for once is just evading being helpful!!