.NET consume SAP web service - c#

I'm trying to figure out how to consume a SAP webservice. I have a .WSDL file which looks for certain info in SAP.
My .WSDL file:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="Customer_Out" targetNamespace="..." xmlns:p1="...." xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:documentation/>
<wsp:UsingPolicy wsdl:required="true"/>
<wsp:Policy wsu:Id="OP_CustomerRead_sync"/>
<wsdl:types>
<xsd:schema targetNamespace="..." xmlns="..." xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="MT_CustomerRead_response" type="DT_CustomerRead_response"/>
<xsd:element name="FMT_Customer">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="standard" type="ExchangeFaultData"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="MT_CustomerRead_request" type="DT_CustomerRead_request"/>
<xsd:complexType name="ExchangeFaultData">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/VersionID">..</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="faultText" type="xsd:string"/>
<xsd:element name="faultUrl" type="xsd:string" minOccurs="0"/>
<xsd:element name="faultDetail" type="ExchangeLogData" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="DT_Customer">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/VersionID">...</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="BpId" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">...</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="Name" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">...</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="AccountGroup" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">...</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="Street" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">...</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="Number" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">...</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="City" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">...</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="Country" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">...</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="Region" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="DT_CustomerRead_request">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/VersionID">...</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="RowLimit" type="xsd:integer"/>
<xsd:element name="BpId" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">...</xsd:appinfo>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="10"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Name" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">...</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="ExternalCustomer" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">...</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="AccountGroup" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">...</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ExchangeLogData">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/VersionID">...</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="severity" type="xsd:string" minOccurs="0"/>
<xsd:element name="text" type="xsd:string"/>
<xsd:element name="url" type="xsd:string" minOccurs="0"/>
<xsd:element name="id" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="DT_CustomerRead_response">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/VersionID">...</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="Customer" type="DT_Customer" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">...</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="Remark" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="MT_CustomerRead_request">
<wsdl:documentation/>
<wsdl:part name="MT_CustomerRead_request" element="p1:MT_CustomerRead_request"/>
</wsdl:message>
<wsdl:message name="MT_CustomerRead_response">
<wsdl:documentation/>
<wsdl:part name="MT_CustomerRead_response" element="p1:MT_CustomerRead_response"/>
</wsdl:message>
<wsdl:message name="FMT_Customer">
<wsdl:documentation/>
<wsdl:part name="FMT_Customer" element="p1:FMT_Customer"/>
</wsdl:message>
<wsdl:portType name="Customer_Out">
<wsdl:documentation/>
<wsdl:operation name="CustomerRead_sync">
<wsdl:documentation/>
<wsp:Policy>
<wsp:PolicyReference URI="#OP_CustomerRead_sync"/>
</wsp:Policy>
<wsdl:input message="p1:MT_CustomerRead_request"/>
<wsdl:output message="p1:MT_CustomerRead_response"/>
<wsdl:fault name="FMT_Customer" message="p1:FMT_Customer"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="Customer_OutBinding" type="p1:Customer_Out">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
<wsdl:operation name="CustomerRead_sync">
<soap:operation soapAction="http://sap.com/xi/WebService/soap1.1" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
<wsdl:input>
<soap:body use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
</wsdl:output>
<wsdl:fault name="FMT_Customer">
<soap:fault use="literal" name="FMT_Customer" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Customer_OutService">
<wsdl:port name="HTTP_Port" binding="p1:Customer_OutBinding">
<soap:address location="..." xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
I've added a Service Reference to my .NET project which references the .WSDL file. This creates a namespace which allows me to make an instance of a couple of classes (9 in total).
I can't seem to find how to pass the request and receive the corresponding response. Should I parse these requests/responses? I'm aware of this tutorial but it doesn't really correspond with the file which I'm dealing with.
A request looks like this:
<man:MT_CustomerRead_request>
<RowLimit>100</RowLimit>
<!--Optional:-->
<!-- <CustomerId>?
<!--Optional:-->
<Name>Dell*</Name>
<!--Optional:-->
<!--Optional:-->
<AccountGroup>ABC</AccountGroup>
</man:MT_CustomerRead_request>
Thanks in advance

I'm just working on this topic and here's an example on how to create a request and call the SAP service in .NET (C#).
// Create the client
SapServiceReference.ECC_WS sapService = new SapServiceReference.ECC_WS();
sapService.Credentials = new NetworkCredential("Account", "Password");
// Prepare the parameters
SapServiceReference._parameters param = new SapServiceReference._parameters();
param.id = 1;
param.action = "R";
// Call SAP service
SapServiceReference._ws_Response response = sapService._someFunction(param);
string result = response.EvDescriptionText.Tdline;

Related

Load Dataset Columns From Xsd using ReadXmlSchema

I've tried to load dataset columns from a schema with ReadXmlSchema method.
It's working but 0 column loads. And I could not see any problem with the xsd file. Here my xsd file:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns3="http://tempuri.org/Ortak_Tip.xsd" xmlns:ns4="http://tempuri.org/Ortak_Risk.xsd" xmlns:ns5="http://tempuri.org/Ek.xsd" xmlns:t="http://tempuri.org/Form.xsd" targetNamespace="http://tempuri.org/Form.xsd" elementFormDefault="qualified">
<xsd:import namespace="http://tempuri.org/Ortak_Tip.xsd" schemaLocation="http://tempuri.org/Ortak_Tip.xsd"/>
<xsd:import namespace="http://tempuri.org/Ortak_Risk.xsd" schemaLocation="http://tempuri.org/Ortak_Risk.xsd"/>
<xsd:import namespace="http://tempuri.org/Ek.xsd" schemaLocation="http://tempuri.org/Ek.xsd"/>
<xsd:element name="Form">
<xsd:complexType>
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<xsd:sequence>
<xsd:element name="Veri">
<xsd:complexType>
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<xsd:sequence>
<xsd:element name="Satir" maxOccurs="unbounded">
<xsd:complexType>
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<xsd:sequence>
<xsd:element name="SiraNo" type="ns3:Sayi15"/>
<xsd:element name="KrediIslemHesapNo" type="ns4:Karakter60"/>
<xsd:element name="MusteriNo" type="ns5:Karakter25"/>
<xsd:element name="VergiNo" type="ns4:Sayi11" nillable="true"/>
<xsd:element name="Adi" type="ns3:Karakter255"/>
<xsd:element name="UlkeKodu" type="ns3:UlkeKodu"/>
<xsd:element name="IslemTuru" type="xsd:boolean"/>
<xsd:element name="TarafKodu" type="ns3:IslemTarafKodu"/>
<xsd:element name="MusteriRiskSinif" type="ns4:MusterininRiskSinifi2"/>
<xsd:element name="IslemTutarAnaparaTLKarsilik" type="ns5:Yuzde14_2"/>
<xsd:element name="IslemTutarFaizTLKarsilik" type="ns5:Yuzde14_2"/>
<xsd:element name="IslemTutarToplamTLKarsilik" type="ns5:Yuzde14_2"/>
<xsd:element name="IslemOrijinalParaKodu" type="ns3:ParaKodu2"/>
<xsd:element name="ParaKoduEndeks" type="ns3:ParaKoduEndeks" nillable="true"/>
<xsd:element name="MKIhracciUnvan" type="ns3:Karakter255"/>
<xsd:element name="MKISINKodu" type="ns3:Karakter12"/>
<xsd:element name="PiyasaFiyatTLKarsilik" type="ns5:Yuzde14_2"/>
<xsd:element name="MKParaKodu" type="ns3:ParaKodu2"/>
<xsd:element name="MKVade" type="xsd:date" nillable="true"/>
<xsd:element name="IslemVade" type="xsd:date"/>
<xsd:element name="Portfoy" type="ns4:Portfoy2"/>
<xsd:element name="BilancoDeger" type="ns5:Yuzde14_2"/>
<xsd:element name="NominalDeger" type="ns5:Yuzde14_2"/>
<xsd:element name="AlacakVolAyarKatsayi" type="ns4:Yuzde5_3" nillable="true"/>
<xsd:element name="KurVolAyarKatsayi" type="ns4:Yuzde5_3" nillable="true"/>
<xsd:element name="TeminatVolAyarKatsayi" type="ns4:Yuzde5_3" nillable="true"/>
<xsd:element name="KarsiTarafRiskAgirlik" type="ns3:Sayi4" nillable="true"/>
<xsd:element name="TeminatRiskAgirlik" type="ns3:Sayi4" nillable="true"/>
<xsd:element name="RAV" type="ns5:Yuzde14_2" nillable="true"/>
<xsd:element name="IslemTHPKodu" type="ns3:Karakter8"/>
<xsd:element name="MKTHPKodu" type="ns3:Karakter8" nillable="true"/>
<xsd:element name="MKSinif" type="ns4:MKIslemSinif"/>
<xsd:element name="IslemSinif" type="ns4:MKIslemSinif"/>
<xsd:element name="EmanetDurumu" type="ns3:Karakter255"/>
<xsd:element name="IlaveTeminat" type="xsd:boolean"/>
<xsd:element name="KRATSonraRAV" type="ns5:Yuzde14_2" nillable="true"/>
<xsd:element name="KarsiTarafDerecelendirmeNotu1" type="ns5:Karakter25" nillable="true"/>
<xsd:element name="KarsiTarafDerecelendirmeNotu2" type="ns5:Karakter25" nillable="true"/>
<xsd:element name="KarsiTarafDerecelendirmeNotu3" type="ns5:Karakter25" nillable="true"/>
<xsd:element name="KarsiTarafDerecelendirmeNotu4" type="ns5:Karakter25" nillable="true"/>
<xsd:element name="MKDerecelendirmeNotu1" type="ns5:Karakter25" nillable="true"/>
<xsd:element name="MKDerecelendirmeNotu2" type="ns5:Karakter25" nillable="true"/>
<xsd:element name="MKDerecelendirmeNotu3" type="ns5:Karakter25" nillable="true"/>
<xsd:element name="MKDerecelendirmeNotu4" type="ns5:Karakter25" nillable="true"/>
</xsd:sequence>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="Gun" type="ns4:Gun" use="required" fixed="1"/>
<xsd:attribute name="Ay" type="ns4:Ay" use="required"/>
<xsd:attribute name="Yil" type="ns3:Sayi4" use="required"/>
<xsd:attribute name="FormKodu" type="ns3:Karakter7" use="required" fixed="RT100AS"/>
<xsd:attribute name="KurulusKodu" type="ns5:Sayi3" use="required"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Could someone please tell me where I'm wrong?
It's working...
That's not believable.
...but 0 column loads.
Now that is believable.
An immediately obvious problem is that the URLs given by the schemaLocations in the xsd:imports of your XSD redirect to www.bing.com. Before anything else, you'll have to resolve this problem.
xsd namespace doesn't like nested tags. Also you need a single root element. Made changes to get xml to read. Not sure if it is what you really need.
code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
namespace ConsoleApplication1
{
class Program
{
const string FILENAME = #"c:\temp\test.xml";
static void Main(string[] args)
{
DataSet ds = new DataSet();
ds.ReadXml(FILENAME, XmlReadMode.ReadSchema);
}
}
}
xml
<?xml version="1.0" encoding="utf-8" ?>
<Root xsd:schema="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001" xmlns:ns3="http://tempuri.org/Ortak_Tip.xsd" xmlns:ns4="http://tempuri.org/Ortak_Risk.xsd" xmlns:ns5="http://tempuri.org/Ek.xsd" xmlns:t="http://tempuri.org/Form.xsd" targetNamespace="http://tempuri.org/Form.xsd" elementFormDefault="qualified">
<xsd:import namespace="http://tempuri.org/Ortak_Tip.xsd" schemaLocation="http://tempuri.org/Ortak_Tip.xsd"/>
<xsd:import namespace="http://tempuri.org/Ortak_Risk.xsd" schemaLocation="http://tempuri.org/Ortak_Risk.xsd"/>
<xsd:import namespace="http://tempuri.org/Ek.xsd" schemaLocation="http://tempuri.org/Ek.xsd"/>
<xsd:element name="Form">
<xsd:complex>
<xsd:complexSequence>
<xsd:restriction base="xsd:anyType">
<xsd:sequence>
<xsd:elementSequence name="Veri">
<xsd:complexContent>
<xsd:complexType>
<xsd:restrictionType base="xsd:anyType">
<xsd:sequenceType>
<xsd:table name="Satir" maxOccurs="unbounded">
<xsd:elementAttribute>
<xsd:complexAttribute>
<xsd:restrictionAttribute base="xsd:anyType">
<xsd:sequenceAttribute>
<xsd:attribute name="SiraNo" type="ns3:Sayi15"/>
<xsd:attribute name="KrediIslemHesapNo" type="ns4:Karakter60"/>
<xsd:attribute name="MusteriNo" type="ns5:Karakter25"/>
<xsd:attribute name="VergiNo" type="ns4:Sayi11" nillable="true"/>
<xsd:attribute name="Adi" type="ns3:Karakter255"/>
<xsd:attribute name="UlkeKodu" type="ns3:UlkeKodu"/>
<xsd:attribute name="IslemTuru" type="xsd:boolean"/>
<xsd:attribute name="TarafKodu" type="ns3:IslemTarafKodu"/>
<xsd:attribute name="MusteriRiskSinif" type="ns4:MusterininRiskSinifi2"/>
<xsd:attribute name="IslemTutarAnaparaTLKarsilik" type="ns5:Yuzde14_2"/>
<xsd:attribute name="IslemTutarFaizTLKarsilik" type="ns5:Yuzde14_2"/>
<xsd:attribute name="IslemTutarToplamTLKarsilik" type="ns5:Yuzde14_2"/>
<xsd:attribute name="IslemOrijinalParaKodu" type="ns3:ParaKodu2"/>
<xsd:attribute name="ParaKoduEndeks" type="ns3:ParaKoduEndeks" nillable="true"/>
<xsd:attribute name="MKIhracciUnvan" type="ns3:Karakter255"/>
<xsd:attribute name="MKISINKodu" type="ns3:Karakter12"/>
<xsd:attribute name="PiyasaFiyatTLKarsilik" type="ns5:Yuzde14_2"/>
<xsd:attribute name="MKParaKodu" type="ns3:ParaKodu2"/>
<xsd:attribute name="MKVade" type="xsd:date" nillable="true"/>
<xsd:attribute name="IslemVade" type="xsd:date"/>
<xsd:attribute name="Portfoy" type="ns4:Portfoy2"/>
<xsd:attribute name="BilancoDeger" type="ns5:Yuzde14_2"/>
<xsd:attribute name="NominalDeger" type="ns5:Yuzde14_2"/>
<xsd:attribute name="AlacakVolAyarKatsayi" type="ns4:Yuzde5_3" nillable="true"/>
<xsd:attribute name="KurVolAyarKatsayi" type="ns4:Yuzde5_3" nillable="true"/>
<xsd:attribute name="TeminatVolAyarKatsayi" type="ns4:Yuzde5_3" nillable="true"/>
<xsd:attribute name="KarsiTarafRiskAgirlik" type="ns3:Sayi4" nillable="true"/>
<xsd:attribute name="TeminatRiskAgirlik" type="ns3:Sayi4" nillable="true"/>
<xsd:attribute name="RAV" type="ns5:Yuzde14_2" nillable="true"/>
<xsd:attribute name="IslemTHPKodu" type="ns3:Karakter8"/>
<xsd:attribute name="MKTHPKodu" type="ns3:Karakter8" nillable="true"/>
<xsd:attribute name="MKSinif" type="ns4:MKIslemSinif"/>
<xsd:attribute name="IslemSinif" type="ns4:MKIslemSinif"/>
<xsd:attribute name="EmanetDurumu" type="ns3:Karakter255"/>
<xsd:attribute name="IlaveTeminat" type="xsd:boolean"/>
<xsd:attribute name="KRATSonraRAV" type="ns5:Yuzde14_2" nillable="true"/>
<xsd:attribute name="KarsiTarafDerecelendirmeNotu1" type="ns5:Karakter25" nillable="true"/>
<xsd:attribute name="KarsiTarafDerecelendirmeNotu2" type="ns5:Karakter25" nillable="true"/>
<xsd:attribute name="KarsiTarafDerecelendirmeNotu3" type="ns5:Karakter25" nillable="true"/>
<xsd:attribute name="KarsiTarafDerecelendirmeNotu4" type="ns5:Karakter25" nillable="true"/>
<xsd:attribute name="MKDerecelendirmeNotu1" type="ns5:Karakter25" nillable="true"/>
<xsd:attribute name="MKDerecelendirmeNotu2" type="ns5:Karakter25" nillable="true"/>
<xsd:attribute name="MKDerecelendirmeNotu3" type="ns5:Karakter25" nillable="true"/>
<xsd:attribute name="MKDerecelendirmeNotu4" type="ns5:Karakter25" nillable="true"/>
</xsd:sequenceAttribute>
</xsd:restrictionAttribute>
</xsd:complexAttribute>
</xsd:elementAttribute>
</xsd:table>
</xsd:sequenceType>
</xsd:restrictionType>
</xsd:complexType>
</xsd:complexContent>
</xsd:elementSequence>
</xsd:sequence>
<xsd:attribute name="Gun" type="ns4:Gun" use="required" fixed="1"/>
<xsd:attribute name="Ay" type="ns4:Ay" use="required"/>
<xsd:attribute name="Yil" type="ns3:Sayi4" use="required"/>
<xsd:attribute name="FormKodu" type="ns3:Karakter7" use="required" fixed="RT100AS"/>
<xsd:attribute name="KurulusKodu" type="ns5:Sayi3" use="required"/>
</xsd:restriction>
</xsd:complexSequence>
</xsd:complex>
</xsd:element>
<!--</xsd:schema>-->
</Root>

How do XML Schema namespaces map to C# class namespaces?

For an XSD document such as this, say I was to create a C# class using some tool like xsd.exe or xsd2code, How do I define the namespace each class belongs to? Or do they all belong to only one namespace?
?xml version="1.0" encoding="UTF-8"?><xsd:schema targetNamespace="http://com.ibm.wbit.comptest.controller"
xmlns:Q1="http://com.ibm.wbit.comptest.controller" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:complexType name="TestResults">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="testSuites" type="Q1:TestSuiteRun"/>
</xsd:sequence>
<xsd:attribute name="testProject" type="xsd:string"/>
</xsd:complexType>
<xsd:complexType name="TestSuiteRun">
<xsd:complexContent>
<xsd:extension base="Q1:TestRun">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="testCases" type="Q1:TestCaseRun">
</xsd:element>
</xsd:sequence>
<xsd:attribute name="tests" type="xsd:int"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="TestCaseRun">
<xsd:complexContent>
<xsd:extension base="Q1:TestRun">
<xsd:sequence>
<xsd:element name="result" type="Q1:Severity"/>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="variations" type="Q1:VariationRun">
</xsd:element>
</xsd:sequence>
<xsd:attribute name="variationCount" type="xsd:int"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="VariationRun">
<xsd:complexContent>
<xsd:extension base="Q1:TestRun">
<xsd:sequence>
<xsd:element name="result" type="Q1:Severity"/>
<xsd:element name="exception" nillable="true" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
This element is used to display the exception of a failure or error.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:simpleType name="Severity">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="pass"/>
<xsd:enumeration value="fail"/>
<xsd:enumeration value="error"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="TestRun">
<xsd:attribute name="name" type="xsd:string"/>
<xsd:attribute name="startTime" type="xsd:dateTime"/>
<xsd:attribute name="endTime" type="xsd:dateTime"/>
<xsd:attribute name="result" type="xsd:string"/>
</xsd:complexType>
</xsd:schema>

How to assign values to method params of Imported WSDL

In a C# 2008 application I am getting the error message "Object reference not set to an instance of an object."
The line of code that is causing this to occur is the following:
insert.forminputdata.freeformcontrols.PrimaryAccID.Value = "24";
I have a method in wsdl which takes the input request as follows.
<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP:Body>
<CreateTransaction xmlns="http://schemas.cordys.com/default">
<ns0:forminputdata xmlns:ns0="http://schemas.cordys.com/1.0/xforms/processapi">
<ns0:freeformcontrols>
<ns0:PrimaryAccID display_name="Primary Acc ID">PARAMETER</ns0:PrimaryAccID>
<ns0:SecondaryAccID display_name="Secondary Acc ID">PARAMETER</ns0:SecondaryAccID>
</ns0:freeformcontrols>
</ns0:forminputdata>
</CreateTransaction>
</SOAP:Body>
The complete wsdl is
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:tns="http://schemas.cordys.com/default" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/" name="ExecuteBPM.ExecuteTransaction" targetNamespace="http://schemas.cordys.com/default" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<xsd:schema xmlns:inst="http://schemas.cordys.com/bpm/instance/1.0" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns1="http://schemas.cordys.com/1.0/xforms/processapi" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://schemas.cordys.com/default" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://schemas.cordys.com/1.0/xforms/processapi" />
<xsd:import namespace="http://schemas.cordys.com/bpm/instance/1.0" />
<xsd:import namespace="http://schemas.cordys.com/1.0/xforms/processapi" />
<xsd:element name="CreateTransaction">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="tns1:forminputdata" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="CreateTransactionResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="data">
<xsd:complexType>
<xsd:all>
<xsd:element name="instance_id">
<xsd:annotation>
<xsd:documentation>This output parameter contains the unique instance identifier for the business-process.</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element minOccurs="0" name="PAGEFLOWDATA">
<xsd:annotation>
<xsd:documentation>This optional output parameter contains the response message from the business-process and this is available only in case of page flow processes.</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:any minOccurs="0" maxOccurs="unbounded" processContents="skip" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:all>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<xsd:schema xmlns:inst="http://schemas.cordys.com/bpm/instance/1.0" xmlns="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://schemas.cordys.com/bpm/instance/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://schemas.cordys.com/1.0/xforms/processapi" />
<xsd:element name="headerInput">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="target" type="xsd:string" />
<xsd:element name="source">
<xsd:complexType>
<xsd:attribute name="type" type="xsd:string" />
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="bpm">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="instance_id" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<xsd:schema xmlns:inst="http://schemas.cordys.com/bpm/instance/1.0" xmlns="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://schemas.cordys.com/1.0/xforms/processapi" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="forminputdata">
<xsd:complexType>
<xsd:all>
<xsd:element name="freeformcontrols">
<xsd:complexType>
<xsd:all>
<xsd:element name="PrimaryAccID">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute default="Primary Acc ID" name="display_name" type="xsd:string" use="optional" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="SecondaryAccID">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute default="Secondary Acc ID" name="display_name" type="xsd:string" use="optional" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
</xsd:all>
</xsd:complexType>
</xsd:element>
</xsd:all>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message xmlns:inst="http://schemas.cordys.com/bpm/instance/1.0" name="CreateTransactionInput">
<wsdl:part name="body" element="tns:CreateTransaction" />
</wsdl:message>
<wsdl:message xmlns:inst="http://schemas.cordys.com/bpm/instance/1.0" name="CreateTransactionOutput">
<wsdl:part name="body" element="tns:CreateTransactionResponse" />
</wsdl:message>
<wsdl:message xmlns:inst="http://schemas.cordys.com/bpm/instance/1.0" name="HeaderOutput">
<wsdl:part name="BPMHeaderOutput" element="inst:bpm" />
</wsdl:message>
<wsdl:portType xmlns:inst="http://schemas.cordys.com/bpm/instance/1.0" name="ExecuteTransaction">
<wsdl:operation name="CreateTransaction">
<wsdl:input message="tns:CreateTransactionInput" />
<wsdl:output message="tns:CreateTransactionOutput" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding xmlns:inst="http://schemas.cordys.com/bpm/instance/1.0" name="ExecuteTransaction" type="tns:ExecuteTransaction">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="CreateTransaction">
<soap:operation soapAction="" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
<soap:header message="tns:HeaderOutput" part="BPMHeaderOutput" use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service xmlns:inst="http://schemas.cordys.com/bpm/instance/1.0" name="ExecuteTransactionService">
<wsdl:port name="ExecuteTransactionPort" binding="tns:ExecuteTransaction">
<soap:address location="http://srv-ind-dvm28aw/cordys/com.eibus.web.soap.Gateway.wcp?organization=o=ewm,cn=cordys,cn=EWM_CU6,o=vanenburg.com&SAMLart=MDFgZEgICDQ+u+3viuskQtM5/APNP1YhIhFVVVo/fvRCxKezFVk1Ltvx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
In the .cs file I am trying to set these params like
using System;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using System.Data;
using System.Xml;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
public Service()
{
}
srv_ind_dvm28aw.ExecuteTransactionService soapClient = new srv_ind_dvm28aw.ExecuteTransactionService();
[WebMethod]
public void Transaction()
{
srv_ind_dvm28aw.CreateTransaction insert = new srv_ind_dvm28aw.CreateTransaction();
srv_ind_dvm28aw.CreateTransactionResponse response = new srv_ind_dvm28aw.CreateTransactionResponse();
try
{
insert.forminputdata.freeformcontrols.PrimaryAccID.Value = "24";
insert.forminputdata.freeformcontrols.SecondaryAccID.Value = "22";
response = soapClient.CreateTransaction(insert);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
}
Without using the set param lines, I could successfully call the method (ie without the following couple of lines)
insert.forminputdata.freeformcontrols.PrimaryAccID.Value = "24";
insert.forminputdata.freeformcontrols.SecondaryAccID.Value = "22";
Is this my way of setting param to the soap method is correct ?Please guide me where I am going wrong.
The exact error throws at insert.forminputdata is null.
You need to initialize the objects. It should be something like this:
insert.forminputdata = new forminputdata();
insert.forminputdata.freeformcontrols = new forminputdataFreeformcontrols();
insert.forminputdata.freeformcontrols.PrimaryAccID = new forminputdataFreeformcontrolsPrimaryAccID();
insert.forminputdata.freeformcontrols.PrimaryAccID.Value = "24";

Manual configuration of service reference

When I add a Service reference in visual studio 2012 it adds these attributes for ordering elements to all my properties to my reference.cs.
[System.Xml.Serialization.XmlArrayAttribute(Order=0)]
However it causes the soap message to not de-serialize correctly.
When I remove them it works.
So I need to know how to generate the reference.cs without the attributes through some config or whatever it takes.
I looked at the Reference.svcmap map but do not see a setting in their for this particular problem.
I tried MSDN but cannot find anything on manual configuration for this type of request.
Note if I add it as a web reference it will not add those attributes but do not want that route as I want the aync processing.
Please help!
Note: server web service is a 3rd party and is an apache axis hosted service.
Here is the wsdl:
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:prews="http://www.coda.com/efinance/schemas/presenter/presenter-11.1/webservice" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="http://www.coda.com/efinance/schemas/presenter/presenter-11.1/webservice">
<types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:com="http://www.coda.com/efinance/schemas/common" xmlns:pre="http://www.coda.com/efinance/schemas/presenter" targetNamespace="http://www.coda.com/efinance/schemas/presenter/presenter-11.1/webservice" attributeFormDefault="unqualified" elementFormDefault="qualified">
<xsd:import namespace="http://www.coda.com/efinance/schemas/common" schemaLocation="http://sfdcoda1/coda/wsdl/finance/common/common.xsd"/>
<xsd:import namespace="http://www.coda.com/efinance/schemas/presenter" schemaLocation="http://sfdcoda1/coda/wsdl/finance/presenter/presenter.xsd"/>
<xsd:element name="AddRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Companies" minOccurs="0" type="com:Companies"/>
<xsd:element name="Presenter" type="pre:Presenter">
<xsd:annotation>
<xsd:documentation>
Contains the information for the presenter master you want to create.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ListRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Filter" type="pre:PresenterListFilter">
<xsd:annotation>
<xsd:documentation>
A filter that selects the presenter masters to be listed.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="GetResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="CmpCode" type="com:typeGeneralCode">
<xsd:annotation>
<xsd:documentation>
The code of the company in which you attempted to retrieve the presenter master.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="Code" type="com:typeGeneralCode">
<xsd:annotation>
<xsd:documentation>
The code of the presenter master that you attempted to retrieve.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="Presenter" minOccurs="0" type="pre:Presenter">
<xsd:annotation>
<xsd:documentation>
Contains the presenter master you have retrieved from the database.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="OptionsResponse">
<xsd:complexType>
<xsd:attribute name="transactioncoordinator" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="ListResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Filter" type="pre:PresenterListFilter">
<xsd:annotation>
<xsd:documentation>
The filter that was used to select the presenter masters to be listed.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="Keys" minOccurs="0" type="com:KeyData">
<xsd:annotation>
<xsd:documentation>
Contains the key information for the listed presenter masters.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="DeleteResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="CmpCode" type="com:typeGeneralCode">
<xsd:annotation>
<xsd:documentation>
The code of the company in which you attempted to delete the presenter master.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="Code" type="com:typeGeneralCode">
<xsd:annotation>
<xsd:documentation>
The code of the presenter master that you attempted to delete.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="UpdateResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="MultiCompany" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Companies" type="com:Companies"/>
<xsd:element name="Warning" type="com:Reason"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="CmpCode" type="com:typeGeneralCode">
<xsd:annotation>
<xsd:documentation>
The code for the company in which you attempted to update the presenter master.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="Code" type="com:typeGeneralCode">
<xsd:annotation>
<xsd:documentation>
The code of the presenter master that you attempted to update.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="TimeStamp" type="com:typeWord">
<xsd:annotation>
<xsd:documentation>
The TimeStamp value for this presenter master in the database.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="AddResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="MultiCompany" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Companies" type="com:Companies"/>
<xsd:element name="Warning" type="com:Reason"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="CmpCode" type="com:typeGeneralCode">
<xsd:annotation>
<xsd:documentation>
The code of the company in which you attempted to create the presenter master.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="Code" type="com:typeGeneralCode">
<xsd:annotation>
<xsd:documentation>
The code of the presenter master that you attempted to create.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="TimeStamp" type="com:typeWord">
<xsd:annotation>
<xsd:documentation>
The TimeStamp value for this presenter master in the database.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="UpdateRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Companies" minOccurs="0" type="com:Companies"/>
<xsd:element name="Presenter" type="pre:Presenter">
<xsd:annotation>
<xsd:documentation>
Contains the information for the presenter master you want to update.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Options">
<xsd:complexType>
<xsd:attribute name="bulkload" type="xsd:boolean"/>
<xsd:attribute name="logtitle" type="com:typeLogTitle"/>
<xsd:attribute name="attachments" type="com:typeAttachments" default="none"/>
<xsd:attribute name="locale" type="com:typeLocale"/>
<xsd:attribute name="origin" type="xsd:string"/>
<xsd:attribute name="user" type="com:typeGeneralCode"/>
<xsd:attribute name="company" type="com:typeGeneralCode"/>
<xsd:attribute name="session" type="xsd:string"/>
<xsd:attribute name="slot" type="xsd:nonNegativeInteger"/>
<xsd:attribute name="transactionid" type="xsd:string"/>
<xsd:attribute name="txtimeout" type="xsd:int"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="DeleteRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Key" type="com:Key">
<xsd:annotation>
<xsd:documentation>
Contains the key identifying the presenter master you want to delete.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="GetRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Key" type="com:Key">
<xsd:annotation>
<xsd:documentation>
Contains the key identifying the presenter masters you want to retrieve from the database.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</types>
<message name="UpdateResponse">
<part name="UpdateResponse" element="prews:UpdateResponse"/>
</message>
<message name="GetRequest">
<part name="GetRequest" element="prews:GetRequest"/>
</message>
<message name="Options">
<part name="Options" element="prews:Options"/>
</message>
<message name="AddResponse">
<part name="AddResponse" element="prews:AddResponse"/>
</message>
<message name="GetResponse">
<part name="GetResponse" element="prews:GetResponse"/>
</message>
<message name="DeleteResponse">
<part name="DeleteResponse" element="prews:DeleteResponse"/>
</message>
<message name="DeleteRequest">
<part name="DeleteRequest" element="prews:DeleteRequest"/>
</message>
<message name="AddRequest">
<part name="AddRequest" element="prews:AddRequest"/>
</message>
<message name="ListResponse">
<part name="ListResponse" element="prews:ListResponse"/>
</message>
<message name="ListRequest">
<part name="ListRequest" element="prews:ListRequest"/>
</message>
<message name="OptionsResponse">
<part name="OptionsResponse" element="prews:OptionsResponse"/>
</message>
<message name="UpdateRequest">
<part name="UpdateRequest" element="prews:UpdateRequest"/>
</message>
<portType name="PresenterServicePortTypes">
<operation name="Update">
<input message="prews:UpdateRequest"/>
<output message="prews:UpdateResponse"/>
</operation>
<operation name="Add">
<input message="prews:AddRequest"/>
<output message="prews:AddResponse"/>
</operation>
<operation name="Get">
<input message="prews:GetRequest"/>
<output message="prews:GetResponse"/>
</operation>
<operation name="Delete">
<input message="prews:DeleteRequest"/>
<output message="prews:DeleteResponse"/>
</operation>
<operation name="List">
<input message="prews:ListRequest"/>
<output message="prews:ListResponse"/>
</operation>
</portType>
<binding name="PresenterServiceSOAPBinding" type="prews:PresenterServicePortTypes">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="Update">
<documentation>
Updates presenter masters in the database using the information you provide.
</documentation>
<soap:operation soapAction="uri-coda-webservice/11.300.0491/finance/Presenter/Update" style="document"/>
<input>
<soap:header message="prews:Options" part="Options" use="literal"></soap:header>
<soap:body use="literal"/>
</input>
<output>
<soap:header message="prews:OptionsResponse" part="OptionsResponse" use="literal"></soap:header>
<soap:body use="literal"/>
</output>
</operation>
<operation name="Add">
<documentation>
Creates new presenter masters in the database using the information you provide.
</documentation>
<soap:operation soapAction="uri-coda-webservice/11.300.0491/finance/Presenter/Add" style="document"/>
<input>
<soap:header message="prews:Options" part="Options" use="literal"></soap:header>
<soap:body use="literal"/>
</input>
<output>
<soap:header message="prews:OptionsResponse" part="OptionsResponse" use="literal"></soap:header>
<soap:body use="literal"/>
</output>
</operation>
<operation name="Get">
<documentation>
Retrieves the specified presenter masters from the database.
</documentation>
<soap:operation soapAction="uri-coda-webservice/11.300.0491/finance/Presenter/Get" style="document"/>
<input>
<soap:header message="prews:Options" part="Options" use="literal"></soap:header>
<soap:body use="literal"/>
</input>
<output>
<soap:header message="prews:OptionsResponse" part="OptionsResponse" use="literal"></soap:header>
<soap:body use="literal"/>
</output>
</operation>
<operation name="Delete">
<documentation>
Deletes the specified presenter master from the database.
</documentation>
<soap:operation soapAction="uri-coda-webservice/11.300.0491/finance/Presenter/Delete" style="document"/>
<input>
<soap:header message="prews:Options" part="Options" use="literal"></soap:header>
<soap:body use="literal"/>
</input>
<output>
<soap:header message="prews:OptionsResponse" part="OptionsResponse" use="literal"></soap:header>
<soap:body use="literal"/>
</output>
</operation>
<operation name="List">
<documentation>
Retrieves key information for the specified presenter masters from the database.
</documentation>
<soap:operation soapAction="uri-coda-webservice/11.300.0491/finance/Presenter/List" style="document"/>
<input>
<soap:header message="prews:Options" part="Options" use="literal"></soap:header>
<soap:body use="literal"/>
</input>
<output>
<soap:header message="prews:OptionsResponse" part="OptionsResponse" use="literal"></soap:header>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="PresenterService">
<port name="PresenterServicePort" binding="prews:PresenterServiceSOAPBinding">
<soap:address location="http://sfdcoda1/coda/services/finance/presenter/presenter-11.1"/>
</port>
</service>
</definitions>
Try removing the order attribute from the DataContract attributes. Then when you use Service Reference, it should not add the order attribute there also.
You must be doing something like:
[DataContract]
public class DerivedType : BaseType
{
[DataMember(Order = 0)]
public string bird;
[DataMember(Order = 1)]
public string parrot;
}
Just remove the Order attributes in your contracts.

I'm validating XML against XSD in Windows Forms using C# .NET and it's giving me the error "Please Suggest the fix"

I'm validating XML against XSD in Windows Forms using C# .NET and it's giving me the error "Please Suggest the fix"
Here is my code
namespace XMLValidation
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
// Validation Error Count
static int ErrorsCount = 0;
// Validation Error Message
static string ErrorMessage = "";
public static void ValidationHandler(object sender,
ValidationEventArgs args)
{
ErrorMessage = ErrorMessage + args.Message + "\r\n";
ErrorsCount++;
}
private void button1_Click(object sender, EventArgs e)
{
XDocument doc1 = XDocument.Load("C:\\Hit.xml");
Validate(doc1.ToString());
}
public void Validate(string strXMLDoc)
{
try
{
// Declare local objects
XmlTextReader tr = null;
XmlSchemaCollection xsc = null;
XmlValidatingReader vr = null;
// Text reader object
tr = new XmlTextReader("C:\\ScreeningReport.xsd");
xsc = new XmlSchemaCollection();
xsc.Add(null, tr);
// XML validator object
vr = new XmlValidatingReader(strXMLDoc,
XmlNodeType.Document, null);
vr.Schemas.Add(xsc);
// Add validation event handler
vr.ValidationType = ValidationType.Schema;
vr.ValidationEventHandler +=
new ValidationEventHandler(ValidationHandler);
// Validate XML data
while (vr.Read()) ;
vr.Close();
// Raise exception, if XML validation fails
if (ErrorsCount > 0)
{
throw new Exception(ErrorMessage);
}
// XML Validation succeeded
MessageBox.Show("XML validation succeeded.\r\n");
}
catch (Exception error)
{
// XML Validation failed
MessageBox.Show("XML validation failed." + "\r\n" +
"Error Message: " + error.Message);
}
}
}
}
My XML file
<ScreeningReport xmlns="http://www.sterlingtesting.com/hrxml/1.0">
<DocumentIDGroup>
<DocumentID schemeID="CorrelationID" schemeAgencyID="TRACKER">5500209_1</DocumentID>
</DocumentIDGroup>
<ScreeningPackageResult>
<ScreeningSubjectPersonDetails>
<PersonLegalID schemeAgencyName="" schemeAgencyID="AG" schemeName="SSN" schemeID="">346455645</PersonLegalID>
<PersonName>
<GivenName>Testfn</GivenName>
<FamilyName>Testln</FamilyName>
</PersonName>
<BirthDateDetails>
<YearMonthDate>1980-01-01</YearMonthDate>
</BirthDateDetails>
</ScreeningSubjectPersonDetails>
<ScreeningUserDetails>
<UserID>CRIMT</UserID>
</ScreeningUserDetails>
<ScreeningResult>
<IDGroup>
<ID schemeID="CorrelationID" schemeAgencyID="TRACKER">5500209_1</ID>
<ID schemeID="OrderID" schemeAgencyID="TRACKER">5500209</ID>
<ID schemeID="ScreeningID" schemeAgencyID="TRACKER">5911635</ID>
</IDGroup>
<ScreeningStatusDetails>
<ScreeningOrderStatusCode>Hit</ScreeningOrderStatusCode>
<Score>ExactMatch</Score>
</ScreeningStatusDetails>
<Ordered>true</Ordered>
<Count>1</Count>
<CriminalReport>
<CriminalCase>
<IDGroup>
<ID schemeID="Case" schemeAgencyID="AG">57675</ID>
</IDGroup>
<JurisdictionType>County</JurisdictionType>
<CountryCode>US</CountryCode>
<CountrySubdivisionCode>AK</CountrySubdivisionCode>
<CountyName>DENALI</CountyName>
<ScreeningSubjectPersonDetails>
<PersonLegalID schemeAgencyID="AG" schemeName="SSN">346455645</PersonLegalID>
<PersonName>
<GivenName>Testfn</GivenName>
<FamilyName>Testln</FamilyName>
</PersonName>
<BirthDateDetails>
<YearMonthDate>1980-01-01</YearMonthDate>
</BirthDateDetails>
</ScreeningSubjectPersonDetails>
<Charge>
<IDGroup>
<ID schemeID="Charge" schemeAgencyID="AG">7546</ID>
<ID schemeID="ConvictedOffenseCode" schemeAgencyID="AG" />
<ID schemeID="StatuteNumber" schemeAgencyID="AG" />
</IDGroup>
<ChargeOrComplaint>test charge</ChargeOrComplaint>
<Disposition>disp1</Disposition>
<AdditionalItems qualifier="Parsed">
<UserArea>
<ChargeInfo>
<ChargeType>Conviction</ChargeType>
<ChargeLevel>Felony</ChargeLevel>
<Sentences />
</ChargeInfo>
<SterlingFields>
<Field name="Convicted Offense Description">test charge</Field>
</SterlingFields>
</UserArea>
</AdditionalItems>
<AdditionalItems qualifier="ParsedSentence">
<UserArea>
<SterlingFields>
<Field name="Enhanced Firearm Penalty">test charge</Field>
</SterlingFields>
</UserArea>
</AdditionalItems>
<AdditionalItems qualifier="ParsedCharge">
<UserArea>
<SterlingFields>
<Field name="ChargeCHARGE_LEVEL_ID">Felony</Field>
</SterlingFields>
</UserArea>
</AdditionalItems>
</Charge>
<AdditionalItems qualifier="Parsed">
<UserArea>
<CaseInfo>
<CaseArrestDate>
<YearMonthDate>2011-02-08</YearMonthDate>
</CaseArrestDate>
<CaseDispositionDate>
<YearMonthDate>2011-02-02</YearMonthDate>
</CaseDispositionDate>
<CaseStatus>Closed Case</CaseStatus>
<ReportingDecision>DO_NOT_REPORT</ReportingDecision>
<Sentences>
<Sentence>
<Type>Costs</Type>
<Suspended>false</Suspended>
<FineAmount>123</FineAmount>
<OtherInfo>suspended fine=123</OtherInfo>
</Sentence>
</Sentences>
<CaseType>Conviction</CaseType>
<CaseLevel>Felony</CaseLevel>
</CaseInfo>
</UserArea>
</AdditionalItems>
<AdditionalItems qualifier="ParsedCriminalCase">
<UserArea>
<SterlingFields>
<Field name="CriminalCaseAdditionalInfo">additional ionfo text</Field>
<Field name="CriminalCaseGovernmentID">346455645</Field>
<Field name="CriminalCaseReportDecision">DO NOT REPORT</Field>
<Field name="CriminalCasePossibleRecord">false</Field>
</SterlingFields>
</UserArea>
</AdditionalItems>
</CriminalCase>
</CriminalReport>
<AdditionalItems qualifier="FulfillmentType">
<UserArea>
<Text>MANUAL</Text>
</UserArea>
</AdditionalItems>
<AdditionalItems qualifier="ResearcherType">
<UserArea>
<Text>Internal</Text>
</UserArea>
</AdditionalItems>
<AdditionalItems qualifier="TrackerUserId">
<UserArea>
<Text>ed</Text>
</UserArea>
</AdditionalItems>
</ScreeningResult>
</ScreeningPackageResult>
</ScreeningReport>
My XSD
<xsd:schema xmlns="http://www.sterlingtesting.com/hrxml/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.sterlingtesting.com/hrxml/1.0" elementFormDefault="qualified" attributeFormDefault="unqualified">
<!-- top level screening result definition -->
<xsd:element name="ScreeningReport" type="ScreeningReportType"/>
<xsd:complexType name="ScreeningReportType">
<xsd:sequence>
<xsd:element name="DocumentIDGroup" type="DocumentIDGroupType"/>
<xsd:element name="ScreeningPackageResult" type="ScreeningPackageResultType"/>
<xsd:element name="ScreeningException" type="ScreeningExceptionType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<!-- document ID according to the new hrxml/oagis specifications -->
<xsd:complexType name="DocumentIDGroupType">
<xsd:sequence>
<xsd:element name="DocumentID" type="DocumentIDType" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<!-- single document id specification, according to the hrxml/oagis specification -->
<xsd:complexType name="DocumentIDType">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="schemeAgencyID" type="xsd:string" use="required"/>
<xsd:attribute name="schemeID" type="xsd:string" use="required"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<!--
top level package container for screenings
(or batch in IFN terminology)
-->
<xsd:complexType name="ScreeningPackageResultType">
<xsd:sequence>
<xsd:element name="ScreeningSubjectPersonDetails" type="ScreeningSubjectPersonDetailsType" minOccurs="0"/>
<xsd:element name="ScreeningUserDetails" type="ScreeningUserDetailsType" minOccurs="0"/>
<xsd:element name="CompletionDate" type="CompletionDateType" minOccurs="0"/>
<xsd:element name="ScreeningOptionCode" type="ScreeningOptionCodeType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="ScreeningResult" type="ScreeningResultType" maxOccurs="unbounded"/>
<xsd:element name="ScreeningException" type="ScreeningExceptionType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<!-- optional codes to tweak the screening request -->
<xsd:complexType name="ScreeningOptionCodeType">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="name" type="xsd:string" use="required"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<!-- details for the screening client -->
<xsd:complexType name="ScreeningUserDetailsType">
<xsd:sequence>
<xsd:element name="UserID" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<!-- details for the completion date -->
<xsd:complexType name="CompletionDateType">
<xsd:sequence>
<xsd:element name="YearMonthDate" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<!-- the individual screening (or result in IFN terminology) -->
<xsd:complexType name="ScreeningResultType">
<xsd:sequence>
<xsd:element name="IDGroup" type="IDGroupType"/>
<xsd:element name="ScreeningException" type="ScreeningExceptionType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="ScreeningStatusDetails" type="ScreeningStatusDetailsType" minOccurs="0"/>
<xsd:element name="Ordered" type="xsd:boolean" minOccurs="0"/>
<xsd:element name="Count" type="xsd:int" minOccurs="0"/>
<xsd:choice minOccurs="0">
<xsd:element name="CriminalReport" type="CriminalReportType"/>
<xsd:element name="SanctionReport" type="SanctionReportType"/>
</xsd:choice>
<xsd:element name="AdditionalItems" type="AdditionalItemsType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<!-- sanction report -->
<xsd:complexType name="SanctionReportType">
<xsd:sequence>
<xsd:element name="SubjectConfirmationMethodCode" type="xsd:string" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<!-- an exception on the individual result -->
<xsd:complexType name="ScreeningExceptionType">
<xsd:sequence>
<xsd:element name="ExceptionIdentifier" type="xsd:string"/>
<xsd:element name="ExceptionSeverity" type="xsd:string"/>
<xsd:element name="ExceptionMessage" type="xsd:string"/>
<xsd:element name="ExceptionPath" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<!-- status type -->
<xsd:complexType name="ScreeningStatusDetailsType">
<xsd:sequence>
<xsd:element name="ScreeningOrderStatusCode" type="xsd:string" minOccurs="0"/>
<xsd:element name="ScreeningResultCode" type="xsd:string" minOccurs="0"/>
<xsd:element name="Score" type="xsd:string" minOccurs="0"/>
<xsd:element name="StatusDate" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<!-- grouping of IDs according to the new hrxml/oagis specifications -->
<xsd:complexType name="IDGroupType">
<xsd:sequence>
<xsd:element name="ID" type="IDType" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<!-- single id specification, according to the hrxml/oagis specification -->
<xsd:complexType name="IDType">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="schemeAgencyID" type="xsd:string" use="required"/>
<xsd:attribute name="schemeID" type="xsd:string" use="required"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<!-- criminal report type definition -->
<xsd:complexType name="CriminalReportType">
<xsd:sequence>
<xsd:element name="CriminalCase" type="CriminalCaseType" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CriminalCaseType">
<xsd:sequence>
<xsd:element name="IDGroup" type="IDGroupType"/>
<xsd:element name="ArrestingAgency" type="xsd:string" minOccurs="0"/>
<xsd:element name="JurisdictionType" type="JurisdictionTypeEnumType"/>
<xsd:element name="CourtName" type="xsd:string" minOccurs="0"/>
<xsd:element name="CourtType" type="xsd:string" minOccurs="0"/>
<xsd:element name="CourtJurisdiction" type="xsd:string" minOccurs="0"/>
<xsd:element name="CountryCode" type="xsd:string" minOccurs="0"/>
<xsd:element name="CountrySubdivisionCode" type="xsd:string" minOccurs="0"/>
<xsd:element name="CountyName" type="xsd:string" minOccurs="0"/>
<xsd:element name="CityName" type="xsd:string" minOccurs="0"/>
<xsd:element name="ChargeTypeClassification" type="xsd:string"/>
<xsd:element name="CaseFileDate" type="CaseFileDateType" minOccurs="0"/>
<xsd:element name="SubjectConfirmation" type="SubjectConfirmationType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="ScreeningSubjectPersonDetails" type="ScreeningSubjectPersonDetailsType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="Charge" type="ChargeType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="AdditionalItems" type="AdditionalItemsType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<!-- details for the Subject Confirmation -->
<xsd:complexType name="SubjectConfirmationType">
<xsd:sequence>
<xsd:element name="ConfirmByFamilyName" type="xsd:string" minOccurs="0"/>
<xsd:element name="ConfirmByGivenName" type="xsd:string" minOccurs="0"/>
<xsd:element name="ConfirmByMiddleName" type="xsd:string" minOccurs="0"/>
<xsd:element name="ConfirmByDateOfBirth" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<!-- details for the charge date -->
<xsd:complexType name="ChargeType">
<xsd:sequence>
<xsd:element name="IDGroup" type="IDGroupType"/>
<xsd:element name="ChargeOrComplaint" type="xsd:string"/>
<xsd:element name="ChargeTypeClassification" type="xsd:string"/>
<xsd:element name="ChargeClassification" type="xsd:string"/>
<xsd:element name="ArrestDate" type="ArrestDateType"/>
<xsd:element name="ChargeDate" type="ChargeDateType"/>
<xsd:element name="OffenseDate" type="OffenseDateType"/>
<xsd:element name="Sentence" type="xsd:string"/>
<xsd:element name="SentenceDate" type="SentenceDateType"/>
<xsd:element name="Disposition" type="xsd:string"/>
<xsd:element name="DispositionDate" type="DispositionDateType"/>
<xsd:element name="ProbationStatus" type="xsd:string"/>
<xsd:element name="AdditionalItems" type="AdditionalItemsType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<!-- details for the disposition date -->
<xsd:complexType name="DispositionDateType">
<xsd:sequence>
<xsd:element name="YearMonthDate" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<!-- details for the arrest date -->
<xsd:complexType name="ArrestDateType">
<xsd:sequence>
<xsd:element name="YearMonthDate" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<!-- details for the charge date -->
<xsd:complexType name="ChargeDateType">
<xsd:sequence>
<xsd:element name="YearMonthDate" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<!-- details for the case file date -->
<xsd:complexType name="CaseFileDateType">
<xsd:sequence>
<xsd:element name="YearMonthDate" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<!-- details for the offense date -->
<xsd:complexType name="OffenseDateType">
<xsd:sequence>
<xsd:element name="YearMonthDate" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<!-- details for the sentence date -->
<xsd:complexType name="SentenceDateType">
<xsd:sequence>
<xsd:element name="YearMonthDate" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<!-- *********************** REFACTOR **************************** -->
<!-- details about the subject for the screening -->
<xsd:complexType name="ScreeningSubjectPersonDetailsType">
<xsd:sequence>
<xsd:element name="ScreeningSubjectDetailsTypeCode" type="xsd:string" minOccurs="0"/>
<xsd:element name="PersonLegalID" type="PersonIDType" minOccurs="0"/>
<xsd:element name="PersonName" type="PersonNameType" minOccurs="0"/>
<xsd:element name="PostalAddress" type="PostalAddressType" minOccurs="0"/>
<xsd:element name="GenderCode" type="GenderCodeEnumType" minOccurs="0"/>
<xsd:element name="BirthDateDetails" type="BirthDateDetailsType" minOccurs="0"/>
<xsd:element name="RaceCode" type="xsd:string" minOccurs="0"/>
<xsd:element name="EyeColor" type="xsd:string" minOccurs="0"/>
<xsd:element name="HairColor" type="xsd:string" minOccurs="0"/>
<xsd:element name="Height" type="xsd:string" minOccurs="0"/>
<xsd:element name="Weight" type="xsd:string" minOccurs="0"/>
<xsd:element name="Age" type="xsd:string" minOccurs="0"/>
<xsd:element name="Licenses" type="LicensesType" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="Type" type="xsd:string" use="optional"/>
</xsd:complexType>
<!-- licenses -->
<xsd:complexType name="LicensesType">
<xsd:sequence>
<xsd:element name="License" type="LicenseType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="LicenseType">
<xsd:sequence>
<xsd:element name="LicenseName" type="xsd:string"/>
<xsd:element name="IssuingAuthority" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<!-- postal address -->
<xsd:complexType name="PostalAddressType">
<xsd:sequence>
<xsd:element name="AddressLine" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="CityName" type="xsd:string" minOccurs="0"/>
<xsd:element name="CountrySubDivisionCode" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
<!-- state/province ISO code -->
<xsd:element name="CountryCode" type="xsd:string" minOccurs="0"/>
<xsd:element name="PostalCode" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<!-- details for the personal legal id -->
<xsd:complexType name="PersonIDType">
<xsd:simpleContent>
<xsd:extension base="xsd:normalizedString">
<xsd:attribute name="schemeID" type="xsd:normalizedString" use="optional"/>
<xsd:attribute name="schemeName" type="xsd:string" use="optional"/>
<xsd:attribute name="schemeAgencyID" type="xsd:normalizedString" use="optional"/>
<xsd:attribute name="schemeAgencyName" type="xsd:string" use="optional"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<!--
gender enumeration from the hrxml-3.0 spec
http://ns.hr-xml.org/3.0/documentation/components/GenderCode-element.php
-->
<xsd:simpleType name="GenderCodeEnumType">
<xsd:restriction base="xsd:integer">
<xsd:enumeration value="0"/>
<xsd:enumeration value="1"/>
<xsd:enumeration value="2"/>
<xsd:enumeration value="9"/>
<!-- not known -->
<!-- male -->
<!-- female -->
<!-- not specified -->
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="JurisdictionTypeEnumType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="National"/>
<xsd:enumeration value="State"/>
<xsd:enumeration value="County"/>
<xsd:enumeration value="Federal District"/>
<xsd:enumeration value="Local District"/>
</xsd:restriction>
</xsd:simpleType>
<!-- generic name reference -->
<xsd:complexType name="PersonNameType">
<xsd:sequence>
<xsd:choice>
<xsd:element name="FormattedName" type="xsd:string"/>
<xsd:sequence>
<xsd:element name="GivenName" type="xsd:string"/>
<xsd:element name="MiddleName" type="xsd:string" minOccurs="0"/>
<xsd:element name="FamilyName" type="xsd:string"/>
</xsd:sequence>
</xsd:choice>
</xsd:sequence>
</xsd:complexType>
<!-- details for the birth date -->
<xsd:complexType name="BirthDateDetailsType">
<xsd:sequence>
<xsd:element name="YearMonthDate" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<!-- additional details -->
<xsd:complexType name="AdditionalItemsType">
<xsd:sequence>
<xsd:element name="Text" type="xsd:string" minOccurs="0"/>
<xsd:element name="UserArea" type="UserAreaType" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="vendor" type="xsd:string" use="optional"/>
<xsd:attribute name="type" type="xsd:string" use="optional"/>
<xsd:attribute name="qualifier" type="xsd:string" use="optional"/>
</xsd:complexType>
<!-- user area definition -->
<!--
<xsd:complexType name="UserAreaType" block="restriction">
<xsd:sequence>
<xsd:choice/>
<xsd:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
-->
<xsd:complexType name="UserAreaType" block="restriction">
<xsd:sequence>
<xsd:element name="ChargeInfo" type="ChargeInfoType" minOccurs="0"/>
<xsd:element name="CaseInfo" type="CaseInfoType" minOccurs="0"/>
<xsd:element name="UserInfo" type="UserInfoType" minOccurs="0"/>
<xsd:element name="SterlingFields" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Field" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="name" type="xsd:string" use="required"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Text" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ChargeInfoType">
<xsd:sequence>
<xsd:element name="ChargeType" type="xsd:string" minOccurs="0"/>
<xsd:element name="ChargeLevel" type="xsd:string" minOccurs="0"/>
<xsd:element name="Sentences" type="SentencesType" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="SentencesType">
<xsd:sequence>
<xsd:element name="Sentence" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Consecutive" type="xsd:boolean" minOccurs="0"/>
<xsd:element name="LengthMonths" type="xsd:string" minOccurs="0"/>
<xsd:element name="LengthDays" type="xsd:string" minOccurs="0"/>
<xsd:element name="LengthHours" type="xsd:string" minOccurs="0"/>
<xsd:element name="LengthYears" type="xsd:string" minOccurs="0"/>
<xsd:element name="LengthWeeks" type="xsd:string" minOccurs="0"/>
<xsd:element name="Type" type="xsd:string" minOccurs="0"/>
<xsd:element name="MappedSentenceType" type="xsd:string" minOccurs="0"/>
<xsd:element name="Suspended" type="xsd:boolean" minOccurs="0"/>
<xsd:element name="FineAmount" type="xsd:string" minOccurs="0"/>
<xsd:element name="OtherInfo" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CaseInfoType">
<xsd:sequence>
<xsd:element name="CaseArrestDate" type="CaseArrestDateType" minOccurs="0"/>
<xsd:element name="CaseDispositionDate" type="CaseDispositionDateType" minOccurs="0"/>
<xsd:element name="CaseDisposition" type="xsd:string" minOccurs="0"/>
<xsd:element name="CaseStatus" type="xsd:string" minOccurs="0"/>
<xsd:element name="ReportingDecision" type="ReportingDecisionEnumType" minOccurs="0"/>
<xsd:element name="ReportingDecisionRule" type="xsd:string" minOccurs="0"/>
<xsd:element name="ReportingDecisionRuleBlurb" type="xsd:string" minOccurs="0"/>
<xsd:element name="Sentences" type="SentencesType" minOccurs="0"/>
<xsd:element name="CaseType" type="xsd:string" minOccurs="0"/>
<xsd:element name="CaseLevel" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CaseArrestDateType">
<xsd:sequence>
<xsd:element name="YearMonthDate" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CaseDispositionDateType">
<xsd:sequence>
<xsd:element name="YearMonthDate" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="ReportingDecisionEnumType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="REPORT"/>
<xsd:enumeration value="DO_NOT_REPORT"/>
<xsd:enumeration value="CONTACT_CLIENT_UNORDERED_HIT"/>
<xsd:enumeration value="CONTACT_CLIENT_NO_SALARY"/>
<xsd:enumeration value="DATA_ERROR"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="UserInfoType">
<xsd:sequence>
<xsd:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
The error is:
The element 'CriminalCase' in namespace 'http://www.sterlingtesting.com/hrxml/1.0' has invalid child element 'ScreeningSubjectPersonDetails' in namespace 'http://www.sterlingtesting.com/hrxml/1.0'. List of possible elements expected: 'http://www.sterlingtesting.com/hrxml/1.0:CityName http://www.sterlingtesting.com/hrxml/1.0:ChargeTypeClassification'.
ScreeningSubjectPersonDetails is the child element. Why is it showing INVALID CHILD?
Do you really believe anyone is going to read through this HUGE pile of code?
Anyway, the error message simply says that your XML file doesn't conform to the XSD...

Categories

Resources