I need to import some data from XML file using a SSIS package to SQL Server but when I generate xsd file (from SSIS) some necessary data into XML file are not mapped as a column to output:
Here is a very similar model of xml file i'm using:
xml format model
It's required to import the data in line 2 (DocumentID, ExportID, JobID, RunID,CreationTime, StartTime, EndTime).
Here's how the XSD file is being generated from SSIS:
<?xml version="1.0"?>
<xs:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="urn:com:ssn:schema:export:SSNExportFormat.xsd">
<xsd:element name="SSNExportDocument">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" name="MeterData">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" name="RegisterData">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" name="RegisterRead">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" name="Tier">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="unbounded" name="Register">
<xsd:complexType>
<xsd:attribute name="Number" type="xsd:unsignedShort" use="optional" />
<xsd:attribute name="Summation" type="xsd:decimal" use="optional" />
<xsd:attribute name="SummationUOM" type="xsd:string" use="optional" />
<xsd:attribute name="CumulativeDemand" type="xsd:decimal" use="optional" />
<xsd:attribute name="MaximumDemand" type="xsd:decimal" use="optional" />
<xsd:attribute name="MaximumDemandTime" type="xsd:dateTime" use="optional" />
<xsd:attribute name="DemandUOM" type="xsd:string" use="optional" />
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="Number" type="xsd:unsignedByte" use="optional" />
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="ReadTime" type="xsd:dateTime" use="optional" />
<xsd:attribute name="GatewayCollectedTime" type="xsd:dateTime" use="optional" />
<xsd:attribute name="RegisterReadSource" type="xsd:string" use="optional" />
<xsd:attribute name="Season" type="xsd:unsignedByte" use="optional" />
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="StartTime" type="xsd:dateTime" use="optional" />
<xsd:attribute name="EndTime" type="xsd:dateTime" use="optional" />
<xsd:attribute name="NumberReads" type="xsd:unsignedByte" use="optional" />
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="MeterName" type="xsd:unsignedInt" use="optional" />
<xsd:attribute name="UtilDeviceID" type="xsd:string" use="optional" />
<xsd:attribute name="MacID" type="xsd:string" use="optional" />
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="Version" type="xsd:decimal" use="optional" />
<xsd:attribute name="DocumentID" type="xsd:string" use="optional" />
<xsd:attribute name="ExportID" type="xsd:string" use="optional" />
<xsd:attribute name="JobID" type="xsd:unsignedByte" use="optional" />
<xsd:attribute name="RunID" type="xsd:unsignedByte" use="optional" />
<xsd:attribute name="CreationTime" type="xsd:dateTime" use="optional" />
<xsd:attribute name="StartTime" type="xsd:dateTime" use="optional" />
<xsd:attribute name="EndTime" type="xsd:dateTime" use="optional" />
</xsd:complexType>
</xsd:element>
</xs:schema>
I'm new with SSIS and XML tasks and I would be grateful with any help! Tks...
I don't think you can achieve this using an XML Source component, you have to add a Script Component (as a Source), open the script component editor, add the output columns you need (DocumentID, ExportID, JobID, RunID,CreationTime, StartTime, EndTime).
Then open the script editor and write the following code (i used VB.NET):
You have to replace "C:\MyPath\xmlfile.xml" with the xml file path, also you have to add System.Xml.Linq dll as reference
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
Imports System.Xml
Imports System.Xml.Linq
<Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute>
<CLSCompliant(False)>
Public Class ScriptMain
Inherits UserComponent
Public Overrides Sub CreateNewOutputRows()
Dim strFilePath As String = "C:\MyPath\xmlfile.GetXmlNamespace"
Dim xml As XDocument = XDocument.Load(strFilePath)
Output0Buffer.AddRow()
With Output0Buffer
.DocumentID = If(xml.Root.Attribute("DocumentID") Is Nothing, "", xml.Root.Attribute("DocumentID").Value.ToString)
.ExportID = If(xml.Root.Attribute("ExportID") Is Nothing, "", xml.Root.Attribute("ExportID").Value.ToString)
.JobID = If(xml.Root.Attribute("JobID") Is Nothing, "", xml.Root.Attribute("JobID").Value.ToString)
.RunID = If(xml.Root.Attribute("RunID") Is Nothing, "", xml.Root.Attribute("RunID").Value.ToString)
.CreationTime = If(xml.Root.Attribute("CreationTime") Is Nothing, "", xml.Root.Attribute("CreationTime").Value.ToString)
.StartTime = If(xml.Root.Attribute("StartTime") Is Nothing, "", xml.Root.Attribute("StartTime").Value.ToString)
.EndTime = If(xml.Root.Attribute("EndTime") Is Nothing, "", xml.Root.Attribute("EndTime").Value.ToString)
End With
End Sub
End Class
Related
I am using visual basic .net. I want to operate on wsdl service. I'm having a problem with something. I need to insert data into the service. I have no problem connecting to the service. but I could not run the function by using the objects defined in the wsdl file. I'm waiting for your help.
wsdl file
<wsdl:definitions xmlns:rfc="urn:sap-com:document:sap:rfc:functions" xmlns:p1="http://xxxxxxx.com/Retail/MAYA/TDMStokHareket" 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/" name="SI_TDMStokHareket_OB" targetNamespace="http://xxxxxx">
<wsdl:documentation/>
<wsp:UsingPolicy wsdl:required="false"/>
<wsp:Policy wsu:Id="OP_SI_TDMStokHareket_OB"/>
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:sap-com:document:sap:rfc:functions" targetNamespace="urn:sap-com:document:sap:rfc:functions">
<xsd:element name="ZRT_TDM_STOK_HAREKET">
<xsd:complexType>
<xsd:all>
<xsd:element name="ET_RETURN" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="item" type="ZRS_TDM_STOK_HAREKET_RES" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="IT_DATA" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="item" type="ZRS_TDM_STOK_HAREKET" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element name="ZRT_TDM_STOK_HAREKET.Response">
<xsd:complexType>
<xsd:all>
<xsd:element name="EV_STATU" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="1"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="ET_RETURN" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="item" type="ZRS_TDM_STOK_HAREKET_RES" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="IT_DATA" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="item" type="ZRS_TDM_STOK_HAREKET" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="ZRS_TDM_STOK_HAREKET_RES">
<xsd:sequence>
<xsd:element name="MESSAGE" minOccurs="0">
<xsd:annotation>
<xsd:documentation>Message Text</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="220"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ZRS_TDM_STOK_HAREKET">
<xsd:sequence>
<xsd:element name="TDM_KODU" minOccurs="0">
<xsd:annotation>
<xsd:documentation>Search Term 1</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="20"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="DSN_KODU" minOccurs="0">
<xsd:annotation>
<xsd:documentation>Search Term 1</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="20"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="DSN_ALT_BAYI" minOccurs="0">
<xsd:annotation>
<xsd:documentation>Search Term 1</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="20"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="DSN_ALT_BAYI_ADI" minOccurs="0">
<xsd:annotation>
<xsd:documentation>Name</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="30"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="MATNR" minOccurs="0">
<xsd:annotation>
<xsd:documentation>Material Number</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="18"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="SERGE" minOccurs="0">
<xsd:annotation>
<xsd:documentation>Manufacturer serial number</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="30"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="MENGE" minOccurs="0">
<xsd:annotation>
<xsd:documentation>Quantity</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:decimal">
<xsd:totalDigits value="13"/>
<xsd:fractionDigits value="3"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="rfc.ZRT_TDM_STOK_HAREKET.Input">
<wsdl:documentation/>
<wsdl:part name="parameters" element="rfc:ZRT_TDM_STOK_HAREKET"/>
</wsdl:message>
<wsdl:message name="rfc.ZRT_TDM_STOK_HAREKET.Output">
<wsdl:documentation/>
<wsdl:part name="parameters" element="rfc:ZRT_TDM_STOK_HAREKET.Response"/>
</wsdl:message>
<wsdl:portType name="SI_TDMStokHareket_OB">
<wsdl:documentation/>
<wsdl:operation name="SI_TDMStokHareket_OB">
<wsdl:documentation/>
<wsp:Policy>
<wsp:PolicyReference URI="#OP_SI_TDMStokHareket_OB"/>
</wsp:Policy>
<wsdl:input message="p1:rfc.ZRT_TDM_STOK_HAREKET.Input"/>
<wsdl:output message="p1:rfc.ZRT_TDM_STOK_HAREKET.Output"/>
</wsdl:operation>
</wsdl:portType>
vb code
client.SI_TDMStokHareket_OB(response.ET_RETURN, request.IT_DATA)
MsgBox(response.ET_RETURN(0).MESSAGE)
I can't send data to the function. Can you help with objects and arrays? thanks
I solved the problem of sending the values to the function as follows
ReDim request.IT_DATA(0)
request.IT_DATA(0) = New ZRS_TDM_STOK_HAREKET
request.IT_DATA(0).TDM_KODU = "70031.42002"
request.IT_DATA(0).DSN_KODU = "70031.42002"
request.IT_DATA(0).DSN_ALT_BAYI = "00000.12345"
request.IT_DATA(0).DSN_ALT_BAYI_ADI = "CAGLAR DSN ALT BAYISI"
request.IT_DATA(0).MATNR = "100000000000001287"
request.IT_DATA(0).SERGE = "445313311000213"
request.IT_DATA(0).MENGESpecified = True
request.IT_DATA(0).MENGE = 1
client.SI_TDMStokHareket_OB(response.ET_RETURN, request.IT_DATA)
MsgBox(response.ET_RETURN(0).MESSAGE)
I am trying to learn how to load an XML (XML source) into SSIS 2010 , the data will then go to an SQL Server 2012 Table.
The issue I am having, Is I am trying to follow a tutorial, and I am getting the same error:
The XML Source was unable to read the XML data. Data at the root level is invalid. Line 1, position 1.
This when downloading any of the tables - the one I have chosen is region.
Here is the script - this is in an XSD file
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="countries">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="country">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="iso2Code" type="xs:string" />
<xs:element minOccurs="0" name="name" type="xs:string" />
<xs:element minOccurs="0" name="region">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="id" type="xs:string" use="optional" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" name="adminregion">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="id" type="xs:string" use="optional" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" name="incomeLevel">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="id" type="xs:string" use="optional" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" name="lendingType">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="id" type="xs:string" use="optional" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" name="capitalCity" type="xs:string" />
<xs:element minOccurs="0" name="longitude" type="xs:string" />
<xs:element minOccurs="0" name="latitude" type="xs:string" />
</xs:sequence>
<xs:attribute name="id" type="xs:string" use="optional" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="page" type="xs:unsignedByte" use="optional" />
<xs:attribute name="pages" type="xs:unsignedByte" use="optional" />
<xs:attribute name="per_page" type="xs:unsignedByte" use="optional" />
<xs:attribute name="total" type="xs:unsignedByte" use="optional" />
</xs:complexType>
</xs:element>
</xs:schema>
The trail site is http://api.worldbank.org/countries
I have tried changing the top line
<?xml version="1.0" encoding="UTF-8" ?>
with no success. Please help
I have an error regarding connecting to my database while querying "employee" from browser using this query string:
EmployeeController.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MVCDemo.Models;
using System.Net;
namespace MVCDemo.Controllers
{
public class EmployeeController : Controller
{
// GET: Employee
public ActionResult Details(int id)
{
EmployeeContext employeeContext = new EmployeeContext();
Employee employee = employeeContext.Employees.Single(emp => emp.EmployeeId == id);
return View(employee);
}
}
}
Screenshots from my machine for the error:
https://ibb.co/tPGwSGW
https://ibb.co/DbKZgVQ
Web.config:
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
https://go.microsoft.com/fwlink/?LinkId=301880
-->
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<trace enabled="true" pageOutput="false" />
<compilation debug="true" targetFramework="4.6.1" />
<httpRuntime targetFramework="4.6.1" />
<httpModules>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
</httpModules>
</system.web>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules>
<remove name="ApplicationInsightsWebTracking" />
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
</modules>
</system.webServer>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" />
</compilers>
</system.codedom>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<connectionStrings>
<add name="EmployeeContext" connectionString="server=.; database=Sample; integrated security=SSPI"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
and from SQL Server Management Studio. I am using SSMS 18.0 (GA)
I connect to SSMS with Server name: .\sqlexpress
I tried different connection strings and enabling TCP/IP using SQL Server Configuration Manager yet the same error do exists.
I have tried to generate a wsdl, but when importing it into soap UI the request template is empty - there is no warning or anything else that indicates a problem.
this is the result
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body/>
</soapenv:Envelope>
The wsdl i have made looks like this (removed some for clarity)
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://localhost/powershell/" targetNamespace="http://localhost/powershell/" name="powershell">
<wsdl:types>
<xs:schema targetNamespace="http://localhost/powershell/" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="GetProcessRequest">
<xs:complexType name="GetProcessRequestType">
<xs:sequence>
<xs:element name="field1" minOccurs="0" type="xs:string" nillable="false" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetProcessResponse">
<xs:complexType name="GetProcessResponseType">
<xs:sequence>
<xs:element name="o1" minOccurs="0" type="xs:string" nillable="false" />
<xs:element name="o2" minOccurs="0" type="xs:string" nillable="false" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="ListGetProcessResponse">
<xs:complexType name="ListGetProcessResponseType">
<xs:complexContent mixed="false">
<xs:restriction base="soapenc:Array">
<xs:attribute ref="soapenc:arrayType" wsdl:arrayType="GetProcessResponseType[]" />
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element name="GetItemsRequest">
<xs:complexType name="GetItemsRequestType">
<xs:sequence>
<xs:element name="field1" minOccurs="0" type="xs:string" nillable="false" />
<xs:element name="field2" minOccurs="0" type="xs:string" nillable="false" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetItemsResponse">
<xs:complexType name="GetItemsResponseType">
<xs:sequence>
<xs:element name="o1" minOccurs="0" type="xs:string" nillable="false" />
<xs:element name="o2" minOccurs="0" type="xs:string" nillable="false" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="ListGetItemsResponse">
<xs:complexType name="ListGetItemsResponseType">
<xs:complexContent mixed="false">
<xs:restriction base="soapenc:Array">
<xs:attribute ref="soapenc:arrayType" wsdl:arrayType="GetItemsResponseType[]" />
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
<wsdl:portType name="powershell">
<wsdl:operation name="GetProcess">
<wsdl:input message="tns:GetProcessRequestMessage" />
<wsdl:output message="tns:GetProcessResponseMessage" />
</wsdl:operation>
<wsdl:operation name="GetItems">
<wsdl:input message="tns:GetItemsRequestMessage" />
<wsdl:output message="tns:GetItemsResponseMessage" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="powershellBinding" type="tns:powershell">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="GetProcess">
<soap:operation soapAction="http://localhost/powershell.svc/GetProcess" style="document">
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</soap:operation>
</wsdl:operation>
<wsdl:operation name="GetItems">
<soap:operation soapAction="http://localhost/powershell.svc/GetItems" style="document">
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</soap:operation>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="powershell">
<wsdl:port binding="tns:powershellBinding" name="powershellBinding">
<soap:address location="http://localhost/powershell.svc" />
</wsdl:port>
</wsdl:service>
<wsdl:message name="GetProcessRequestMessage">
<wsdl:part name="parameters" element="tns:GetProcessRequest" />
</wsdl:message>
<wsdl:message name="GetProcessResponseMessage">
<wsdl:part name="parameters" element="tns:ListGetProcessResponse" />
</wsdl:message>
<wsdl:message name="GetItemsRequestMessage">
<wsdl:part name="parameters" element="tns:GetItemsRequest" />
</wsdl:message>
<wsdl:message name="GetItemsResponseMessage">
<wsdl:part name="parameters" element="tns:GetItemsResponse" />
</wsdl:message>
</wsdl:definitions>
As far as i can tell, everything should be linked correctly, but obviously im missing something somewhere, i just cannot find it.
Your WSDL is not valid. The definition of soap:operation element does not allow any content. You need to close the element soap:operation straight away, without any subelements:
<soap:operation soapAction="http://localhost/powershell.svc/GetItems" style="document" />
You need to do the following change:
<wsdl:operation name="GetItems">
<soap:operation soapAction="http://localhost/powershell.svc/GetItems" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
Similarly for other operations.
I have 2 Xml files. 1st file we can call master as its having all nodes and in 2nd files only few information is there.
How can i creat a single xsd supporting both files.
File1:
<Information ID="08" >
<description>office information</description>
<officeName>SBV</officeName>
<A id="234">
<name>xyz</name>
< age>23</age>
<dept>SE</dept>
</A>
<B id="244">
<name>lkj</name>
< age>27</age>
<dept>Sales</dept>
</B>
<C id="264">
<name>opi</name>
< age>34</age>
<dept>Manufacture</dept>
</C>
<D id="774">
<name>yui</name>
< age>25</age>
<dept>Production</dept>
</D>
</Information>
File2:
<Information >
<description>Worker information</description>
<A id="234">
<name>xyz</name>
< age>23</age>
<dept>WP</dept>
</A>
<B id="244">
<name>lkj</name>
< age>27</age>
<dept>WP</dept>
</B>
</Information>
This is a possible schema - which should be considered as a starting point.
<?xml version="1.0" encoding="utf-8"?>
<!--XML Schema generated by QTAssistant/XML Schema Refactoring (XSR) Module (http://www.paschidev.com)-->
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Information">
<xs:complexType>
<xs:sequence>
<xs:element name="description" type="xs:string" />
<xs:element minOccurs="0" name="officeName" type="xs:string" />
<xs:element name="A">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string" />
<xs:element name="age" type="xs:unsignedByte" />
<xs:element name="dept" type="xs:string" />
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedByte" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="B">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string" />
<xs:element name="age" type="xs:unsignedByte" />
<xs:element name="dept" type="xs:string" />
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedByte" use="required" />
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" name="C">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string" />
<xs:element name="age" type="xs:unsignedByte" />
<xs:element name="dept" type="xs:string" />
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedShort" use="required" />
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" name="D">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string" />
<xs:element name="age" type="xs:unsignedByte" />
<xs:element name="dept" type="xs:string" />
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedShort" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="ID" type="xs:unsignedByte" use="optional" />
</xs:complexType>
</xs:element>
</xs:schema>
In my case, I've used QTAssistant (I am associated with it) to create the XSD automatically, by pointing it to the two XML documents you've posted.
This is what I've got (it validates both):
The next steps should then be to "rationalize" the generated XSD. For example, if you look at the content models of elements A, B, C and D, all share the same; if indeed this is the case, then you could have a global type declaration, basically reused. Or, it could be that C and D must appear in a "both or none" combination, in which case additional tweaking may achieve exactly that. Below is a manually amended schema, based on the above comments, to give you an idea on what it would look like. Keep in mind that both XSDs validate your XMLs.
<?xml version="1.0" encoding="utf-8"?>
<!--XML Schema generated by QTAssistant/XML Schema Refactoring (XSR) Module (http://www.paschidev.com)-->
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Information">
<xs:complexType>
<xs:sequence>
<xs:element name="description" type="xs:string"/>
<xs:element minOccurs="0" name="officeName" type="xs:string"/>
<xs:element name="A" type="atype"/>
<xs:element name="B" type="atype"/>
<xs:sequence minOccurs="0">
<xs:element name="C" type="atype"/>
<xs:element name="D" type="atype"/>
</xs:sequence>
</xs:sequence>
<xs:attribute name="ID" type="xs:unsignedByte" use="optional"/>
</xs:complexType>
</xs:element>
<xs:complexType name="atype">
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="age" type="xs:unsignedByte"/>
<xs:element name="dept" type="xs:string"/>
</xs:sequence>
<xs:attribute name="id" type="xs:int" use="required"/>
</xs:complexType>
</xs:schema>
By now, one can see that the latter is more compact in terms of "source". The content models though are quite similar.