I have this XML
<?xml version="1.0" encoding="utf-8"?>
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Nieuws" xml:space="preserve">
<value>News</value>
</data>
<data name="Pagina's" xml:space="preserve">
<value>Pages</value>
</data>
<data name="searchreasults" xml:space="preserve">
<value>There were no matches found</value>
</data>
</root>
And I also have this method, where I take two files and take some values from them, and then I merge all the values into an object in the second query:
Public Shared Function RetrieveTranslation(ByVal filefrom As String, ByVal fileto As String) As List(Of clsTranslation)
Dim valuefrom = (From l In XElement.Load(fileto).Elements("data") Select l.Element("value").Value).FirstOrDefault
Dim valuetrans = From vl In XElement.Load(filefrom).Elements("data") Select (New clsTranslation With {.Filename = filefrom, .Value = vl.Element("value").Value, .Valueto = valuefrom.ToString, .TranslationId = vl.Attribute("name").Value})
Return valuetrans.ToList
End Function
So, the problem is that when I run the code, there is an "Sequence contains no elements" error in the first query(valuefrom). I debugged and it says that there is nothing in the query, but I don't understand why, 'cos I did similar things and never had a problem like this one.
Any hints?
Thanks in advance,
Alf.
P.S: Oh! And by the way, I'm curious to know if it is well done to do something like I did, create an object from two queries, putting the first value in the second query. Thanks!
SOLVED! My problem was not with the code, but with other XML files that were empty... Thanks for the help!
Related
I'm trying to setup this project on a CI platform, and whenever it tries to build, it returns this one error: Invalid Resx file. No valid icon entry were found. The icon is there but there's no reference to the actual file location in the .resx for the form (where the error is coming from). It's on line 270 apparently.
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAAAAAAAEACADqIQAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAH0AAAB9AgGAAAAy9bfigAAIABJ
REFUeJzt3XmUZnV95/HPsy/VtfS+0zvdjSLN1tgNHKOgMZoMT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0AAAMIOgAABhA0AEAMICgAwBgAEEH
AMAAgg4AgAEEHQAAAwg6AAAGEHQAAAwg6AAAGEDQAQAwgKADAGAAQQcAwACCDgCAAQQdAAADCDoAAAYQ
dAAADCDoAAAYQNABADCAoAMAYABBBwDAAIIOAIABBB0AAAMdckDOAAABpUlEQVQIOgAABhB0AAAMIOgA
ABhA0AEAMICgAwBgAEEHAMAAgg4AgAEEHQAAAwg6AAAGEHQAAAwg6AAAGEDQAQAwgKADAGAAQQcAwACC
DgCAAQQdAAADCDoAAAYQdAAADCDoAAAYQNABADCAoAMAYABBBwDAAIIOAIABBB0AAAMIOgAABhB0AAAM
IOgAABhA0AEAMICgAwBgAEEHAMAAgg4AgAEEHQAAAwg6AAAGEHQAAAwg6AAAGEDQAQAwgKADAGAAQQcA
wACCDgCAAQQdAAADCDoAAAYQdAAADCDoAAAYQNABADCAoAMAYABBBwDAAIIOAIABBB0AAAMIOgAABhB0
AAAMIOgAABhA0AEAMICgAwBgAEEHAMAAgg4AgAEEHQAAAwg6AAAGEHQAAAwg6AAAGEDQAQAwgKADAGAA
QQcAwACCDgCAAQQdAAADCDoAAAYQdAAADCDoAAAYQNABADCAoAMAYABBBwDAAIIOAIABBB0AAAMIOgAA
BhB0AAAMIOgAABhA0AEAMICgAwBgAEEHAMAAgg4AgAEEHQAAAwg6AAAG/H/Gcfz/ut42LAAAAABJRU5E
rkJggg==
</value>
</data>
</root>
I'm expecting this to build fine - it builds fine on my local machine.
It throws this error: /home/travis/build/inventor02/BMICalculator/BMICalculator/MainForm.resx(270,5): error MSB3103: Invalid Resx file. No valid icon entry were found. Line 270, position 5. [/home/travis/build/inventor02/BMICalculator/BMICalculator/BMICalculator.vbproj]
I have created the following Schema:
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema id="InventorAssembly"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:sql="urn:schemas-microsoft-com:mapping-schema"
>
<xsd:annotation>
<xsd:appinfo>
<sql:relationship name="InventorDocuments"
parent="Customer.Projects"
parent-key="Customer.ProjectID"
child="Projects.Documents"
child-key="DocumentID"
/>
<sql:relationship name="Properties"
parent="InventorDocuments"
parent-key="DocumentID"
child="InventorDocuments.Properties"
child-key="DocumentID"
/>
</xsd:appinfo>
</xsd:annotation>
<xsd:element name="root" type="InventorDocumentType" sql:relationship="InventorDocuments" />
<xsd:complexType name="ReferencedDocumentsList">
<xsd:sequence>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="document" type="InventorDocumentType" minOccurs="0" maxOccurs="unbounded"/>
<!--<xsd:element name="assembly" type="InventorAssemblyType" minOccurs="0" maxOccurs="unbounded"/>-->
</xsd:choice>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="InventorDocumentType">
<xsd:sequence>
<!-- added the following to see if we can nest the resultant XML under the properties and components headings. -->
<xsd:element name="Properties" sql:is-constant="1">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="property"
type="InventorPropertyType"
minOccurs="0"
maxOccurs="unbounded"
sql:relationship="Properties"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ReferencedDocuments" type="ReferencedDocumentsList" sql:is-constant="1" />
</xsd:sequence>
<xsd:attribute type="xsd:string" name="ID" use="required" sql:field="DocumentID"/>
<xsd:attribute type="xsd:string" name="DocumentType" use="required" sql:field="DocumentType"/>
<xsd:attribute type="xsd:string" name="Filename" use="required" sql:field="FileName"/>
<xsd:attribute type="xsd:string" name="ReferencingDocument" use="optional" sql:field="ReferencingDocument"/>
<xsd:attribute type="xsd:string" name="ParameterCount" use="optional" sql:field="ParameterCount"/>
<xsd:attribute type="xsd:string" name="FeatureCount" use="optional" sql:field="FeatureCount"/>
<xsd:attribute type="xsd:string" name="ConstraintCount" use="optional" sql:field="ConstraintCount"/>
<xsd:attribute type="xsd:string" name="OccurrenceCount" use="optional" sql:field="OccurrenceCount"/>
</xsd:complexType>
<xsd:complexType name="InventorPropertyType">
<xsd:attribute type="xsd:string" name="ParentDocumentID" sql:field="DocumentID"/>
<xsd:attribute type="xsd:string" name="Name" sql:field="PropertyName"/>
<xsd:attribute type="xsd:string" name="Value" sql:field="PropertyValue"/>
<xsd:attribute type="xsd:string" name="Type" sql:field="PropertyType"/>
<xsd:attribute type="xsd:integer" name="PropertyID" sql:field="PropertyID"/>
</xsd:complexType>
</xsd:schema>
Which lets me create this kind of structured XML file:
<?xml version="1.0" encoding="utf-8"?>
<root xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ID="1" DocumentType="kAssemblyDocumentObject" Filename="C:\GDR518.iam" ReferencingDocument="Top Level Assembly" ParameterCount="63" FeatureCount="0" ConstraintCount="38" OccurrenceCount="276">
<Properties>
<property ParentDocumentID="1" Name="Description" Value="" PropertyID="ac262fc9-edaf-4570-9b98-42fcb8e1cee9" />
<property ParentDocumentID="1" Name="Part Number" Value="GDR518" Type="String" PropertyID="7b0a8ec2-0b69-40bc-8ae5-d63304ca9378" />
</Properties>
<ReferencedDocuments>
<document ID="4" DocumentType="kAssemblyDocumentObject" Filename="C:\WLD-HF-004.iam" ReferencingDocument="C:\GDR518.iam" ParameterCount="0" FeatureCount="0" ConstraintCount="0" OccurrenceCount="0">
<Properties>
<property ParentDocumentID="4" Name="Description" Value="" PropertyID="846183dd-cc3f-4e24-8e86-dc785fbbab28" />
</Properties>
<ReferencedDocuments />
</document>
<document ID="12" DocumentType="kAssemblyDocumentObject" Filename="C:\GDR520.iam" ReferencingDocument="C:\GDR518.iam" ParameterCount="59" FeatureCount="0" ConstraintCount="42" OccurrenceCount="146">
<Properties>
<property ParentDocumentID="12" Name="Description" Value="" PropertyID="7f6c2de8-dcb6-471c-aa90-8d69b02e61f1" />
</Properties>
<ReferencedDocuments>
<document ID="13" DocumentType="kAssemblyDocumentObject" Filename="C:\WLD-HF-009.iam" ReferencingDocument="C:\GDR520.iam" ParameterCount="0" FeatureCount="0" ConstraintCount="0" OccurrenceCount="0">
<Properties>
<property ParentDocumentID="13" Name="Description" Value="" PropertyID="436ba462-6d54-433c-a435-197bdd4089d8" />
</Properties>
<ReferencedDocuments />
</document>
<Properties>
<property ParentDocumentID="18" Name="Description" Value="" PropertyID="5ced04aa-ec51-4060-a8eb-d23905e694ed" />
</Properties>
</document>
</ReferencedDocuments>
</document>
</ReferencedDocuments>
</root>
which all works just fine, but I am getting the following error when I attempt to use SQLXMLBulkLoad.Execute to pull the XML data above into my empty database:
Schema: the parent/child table of the relationship on 'property' does
not match.
I have tried every variation I can think of to get this working but to no avail.
Can anyone offer any pointers?
Thanks in advance,
Alex.
I'm having a problem getting the soap 1.1 fault detail element using a .NET 4.5 WCF client for UPS RateWS service.
The issue is that while the faultcode and faultstring elements are coming back fine as .Code and .Message properties on the exception. The detail object is not being deserialized correctly and is always an empty array.
I'm generating the WCF client by unpacking the wsdl and xsds from the UPS Rating developer kit Rates_Pkg_Gnd.zip file SCHEMA-WSDLs directory and pointing Visual Studio 2013s Add Service Reference dialog at the RateWS.wsdl on my file system.
An actual wire soap fault message looks like this:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header />
<soapenv:Body>
<soapenv:Fault>
<faultcode>Client</faultcode>
<faultstring>An exception has been raised as a result of client data.</faultstring>
<detail>
<err:Errors xmlns:err="http://www.ups.com/XMLSchema/XOLTWS/Error/v1.1">
<err:ErrorDetail>
<err:Severity>Hard</err:Severity>
<err:PrimaryErrorCode>
<err:Code>111285</err:Code>
<err:Description>The postal code 21740 is invalid for AB Canada.</err:Description>
</err:PrimaryErrorCode>
</err:ErrorDetail>
</err:Errors>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
I have tried catching System.ServiceModel.FaultException<UPS.RateService.ErrorDetailType[]> but the Detail property is always an array of UPS.RateService.ErrorDetailType[0] -- zero size.
Similarly catching a FaultException and calling .CreateMessageFault() to access .GetDetail<XmlElement>() yields an XML object containing an ArrayOfErrorDetailType element with nothing in it. The alternate approach of using .GetReaderAtDetailContents() to get an XmlReader yields the same bogus structure.
This is the error message xsd:
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:error="http://www.ups.com/XMLSchema/XOLTWS/Error/v1.1" elementFormDefault="qualified" targetNamespace="http://www.ups.com/XMLSchema/XOLTWS/Error/v1.1" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="Errors">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" name="ErrorDetail" type="error:ErrorDetailType" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="ErrorDetailType">
<xsd:sequence>
<xsd:element name="Severity" type="xsd:string" />
<xsd:element name="PrimaryErrorCode" type="error:CodeType" />
<xsd:element minOccurs="0" name="MinimumRetrySeconds" type="xsd:string" />
<xsd:element minOccurs="0" name="Location" type="error:LocationType" />
<xsd:element minOccurs="0" maxOccurs="unbounded" name="SubErrorCode" type="error:CodeType" />
<xsd:element minOccurs="0" maxOccurs="unbounded" name="AdditionalInformation" type="error:AdditionalInfoType" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CodeType">
<xsd:sequence>
<xsd:element name="Code" type="xsd:string" />
<xsd:element name="Description" type="xsd:string" />
<xsd:element minOccurs="0" name="Digest" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="AdditionalInfoType">
<xsd:sequence>
<xsd:element name="Type" type="xsd:string" />
<xsd:element maxOccurs="unbounded" name="Value" type="error:AdditionalCodeDescType" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="AdditionalCodeDescType">
<xsd:sequence>
<xsd:element name="Code" type="xsd:string" />
<xsd:element minOccurs="0" name="Description" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="LocationType">
<xsd:sequence>
<xsd:element minOccurs="0" name="LocationElementName" type="xsd:string" />
<xsd:element minOccurs="0" name="XPathOfElement" type="xsd:string" />
<xsd:element minOccurs="0" name="OriginalValue" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
I realise this is an old Q, but I found the solution on another question - FaultException.Detail coming back empty
Renaming the generated class from ErrorDetailType to ErrorDetail meant I could iterate the errors.
To get this to work I added a dummy element inside the sequence:
<xsd:element name="Errors">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ErrorDetail" type="error:ErrorDetailType" maxOccurs="unbounded"/>
<xsd:element name="TestElement" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
For some reason that allows WCF to serialize the fault correctly. This forces WCF to generate a new class "Errors" that is passed in the fault contract. You could then catch the FaultException<Errors> exception and have access to the ErrorDetailType[].
Ultimately the solution I found was modify the WSDL so that the contents of the <detail /> element are not defined and use svcutil to generate the proxy classes. When I do this, I get access to the raw <err:Errors /> XML element:
var fault = ex.CreateMessageFault();
var faultXml = fault.GetDetail<XmlElement>();
This allows me to use XPath to get at the contents of the err:Description element. With the original WSDL, I get nothing.
I have a SQL table with a XML column defined as follows:
ID int
FooType nvarchar(255)
FooXML xml(CONTENT dbo.FooXMLSchemaCollection)
The schema (FooXMLSchemaCollection) is defined as:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:t="http://schemas.microsoft.com/sqlserver/2004/07/dbInstance/FooXMLSchema"
targetNamespace="http://schemas.microsoft.com/sqlserver/2004/07/dbInstance/FooXMLSchema"
elementFormDefault="qualified">
<xsd:element name="item">
<xsd:complexType>
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<xsd:sequence>
<xsd:element name="key">
<xsd:complexType>
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<xsd:sequence>
<xsd:element name="string" type="xsd:string" />
</xsd:sequence>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="value">
<xsd:complexType>
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<xsd:sequence>
<xsd:element name="ArrayOfString">
<xsd:complexType>
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<xsd:sequence>
<xsd:element name="string" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
I'm trying to insert some test data into the table.
The XML I'm trying to insert looks like this:
<item>
<key>
<string>Attributes</string>
</key>
<value>
<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<string>fieldName1</string>
<string>fieldName2</string>
<string>fieldName3</string>
<string>fieldName4</string>
<string>fieldName5</string>
<string>fieldName6</string>
</ArrayOfString>
</value>
</item>}
I'm trying to the following into the database through SSMS:
INSERT INTO tblLabelInfo
([ID] ,[FooType],[FooXML])
VALUES
(1, 'SampleInstance',
N'<?xml version="1.0" encoding="utf-16"?><item><key><string>Attributes</string></key><value><ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><string>fieldName1</string><string>fieldName2</string><string>fieldName3</string><string>fieldName4</string><string>fieldName5</string><string>fieldName6</string></ArrayOfString></value></item>')
I get the following error message in SSMS:
Msg 6913, Level 16, State 1, Line 1
XML Validation: Declaration not found for element 'item'. Location: /*:item[1]
What am I missing/doing wrong here?
Thanks,
JohnB
I found that if I included the namespace within the XMl and referenced elements from
the XSd using the namespace, I was able to insert:
INSERT INTO tblFooInfo
([FooType] , [FooXML])
VALUES
('Package3'
N'<?xml version="1.0" encoding="utf-16"?>
<t:item xmlns:t="http://schemas.microsoft.com/sqlserver/2004/07/dbInstance/FooXMLSchema">
<t:key>
<t:string>Attributes</t:string>
</t:key>
<t:value>
<t:ArrayOfString >
<t:string>fieldName1</t:string>
<t:string>fieldName2</t:string>
<t:string>fieldName3</t:string>
<t:string>fieldName4</t:string>
<t:string>fieldName5</t:string>
<t:string>fieldName6</t:string>
</t:ArrayOfString>
</t:value>
</t:item>')
Question, how would I accomplish this if I'm attempting it through a .Net application using the
XmlWriter class to create the xml string?
I am trying to create a custom module that extends magento V2 soap calls. Most of my sources came from this post
How to setup custom api for Magento with SOAP V2?
This is the steps I've done to try to get it to work so far.
/app/etc/modules/Namespace_ImportExport.xml
<?xml version="1.0"?>
<config>
<modules>
<Namespace_ImportExport>
<active>true</active>
<codePool>local</codePool>
<depends>
<Mage_Core />
</depends>
</Namespace_ImportExport>
</modules>
</config>
/app/code/local/Namespace/ImportExport/etc/api.xml
<?xml version="1.0"?>
<config>
<api>
<resources>
<importexport>
<model>namespace_importexport/api</model>
<title>api test</title>
<methods>
<foo translate="title" module="importexport">
<title>Foo Test</title>
<method>foo</method>
</foo>
</methods>
</importexport>
</resources>
<v2>
<resources_function_prefix>
<importexport>importexport</importexport>
</resources_function_prefix>
</v2>
</api>
</config>
/app/code/local/Namespace/ImportExport/etc/config.xml
<config>
<modules>
<Namespace_ImportExport>
<version>0.0.1</version>
</Namespace_ImportExport>
</modules>
<global>
<models>
<importexport><class>Namespace_ImportExport_Model</class></importexport>
</models>
<models>
<catalog>
<rewrite>
<product_api_v2>Namespace_ImportExport_Model_Product_Api_V2</product_api_v2>
</rewrite>
</catalog>
</models>
</global>
</config>
/app/code/local/Namespace/ImportExport/etc/wsdl.xml
Here I over wrote some existing modules declarations but you will find my custom module declarations at the bottom
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:typens="urn:{{var wsdl.name}}" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/"
name="{{var wsdl.name}}" targetNamespace="urn:{{var wsdl.name}}">
<types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Magento">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/" />
<complexType name="catalogProductCreateEntity">
<all>
<element name="categories" type="typens:ArrayOfString" minOccurs="0" />
<element name="websites" type="typens:ArrayOfString" minOccurs="0" />
<element name="associated" type="typens:ArrayOfString" minOccurs="0" />
<element name="name" type="xsd:string" minOccurs="0" />
<element name="description" type="xsd:string" minOccurs="0" />
<element name="short_description" type="xsd:string" minOccurs="0" />
<element name="weight" type="xsd:string" minOccurs="0" />
<element name="status" type="xsd:string" minOccurs="0" />
<element name="url_key" type="xsd:string" minOccurs="0" />
<element name="url_path" type="xsd:string" minOccurs="0" />
<element name="visibility" type="xsd:string" minOccurs="0" />
<element name="category_ids" type="typens:ArrayOfString" minOccurs="0" />
<element name="website_ids" type="typens:ArrayOfString" minOccurs="0" />
<element name="has_options" type="xsd:string" minOccurs="0" />
<element name="gift_message_available" type="xsd:string" minOccurs="0" />
<element name="price" type="xsd:string" minOccurs="0" />
<element name="special_price" type="xsd:string" minOccurs="0" />
<element name="special_from_date" type="xsd:string" minOccurs="0" />
<element name="special_to_date" type="xsd:string" minOccurs="0" />
<element name="tax_class_id" type="xsd:string" minOccurs="0" />
<element name="tier_price" type="typens:ArrayOfString" minOccurs="0" />
<element name="meta_title" type="xsd:string" minOccurs="0" />
<element name="meta_keyword" type="xsd:string" minOccurs="0" />
<element name="meta_description" type="xsd:string" minOccurs="0" />
<element name="custom_design" type="xsd:string" minOccurs="0" />
<element name="custom_layout_update" type="xsd:string" minOccurs="0" />
<element name="options_container" type="xsd:string" minOccurs="0" />
<element name="additional_attributes" type="typens:associativeArray" minOccurs="0" />
</all>
</complexType>
<complexType name="catalogProductReturnEntity">
<all>
<element name="product_id" type="xsd:string" minOccurs="0" />
<element name="sku" type="xsd:string" minOccurs="0" />
<element name="set" type="xsd:string" minOccurs="0" />
<element name="type" type="xsd:string" minOccurs="0" />
<element name="categories" type="typens:ArrayOfString" minOccurs="0" />
<element name="websites" type="typens:ArrayOfString" minOccurs="0" />
<element name="associated" type="typens:ArrayOfString" minOccurs="0" />
<element name="created_at" type="xsd:string" minOccurs="0" />
<element name="updated_at" type="xsd:string" minOccurs="0" />
<element name="type_id" type="xsd:string" minOccurs="0" />
<element name="name" type="xsd:string" minOccurs="0" />
<element name="description" type="xsd:string" minOccurs="0" />
<element name="short_description" type="xsd:string" minOccurs="0" />
<element name="weight" type="xsd:string" minOccurs="0" />
<element name="status" type="xsd:string" minOccurs="0" />
<element name="url_key" type="xsd:string" minOccurs="0" />
<element name="url_path" type="xsd:string" minOccurs="0" />
<element name="visibility" type="xsd:string" minOccurs="0" />
<element name="category_ids" type="typens:ArrayOfString" minOccurs="0" />
<element name="website_ids" type="typens:ArrayOfString" minOccurs="0" />
<element name="has_options" type="xsd:string" minOccurs="0" />
<element name="gift_message_available" type="xsd:string" minOccurs="0" />
<element name="price" type="xsd:string" minOccurs="0" />
<element name="special_price" type="xsd:string" minOccurs="0" />
<element name="special_from_date" type="xsd:string" minOccurs="0" />
<element name="special_to_date" type="xsd:string" minOccurs="0" />
<element name="tax_class_id" type="xsd:string" minOccurs="0" />
<element name="tier_price" type="typens:ArrayOfString" minOccurs="0" />
<element name="meta_title" type="xsd:string" minOccurs="0" />
<element name="meta_keyword" type="xsd:string" minOccurs="0" />
<element name="meta_description" type="xsd:string" minOccurs="0" />
<element name="custom_design" type="xsd:string" minOccurs="0" />
<element name="custom_layout_update" type="xsd:string" minOccurs="0" />
<element name="options_container" type="xsd:string" minOccurs="0" />
<element name="additional_attributes" type="typens:associativeArray" minOccurs="0" />
</all>
</complexType>
</schema>
</types>
<message name="importexportFooRequest">
<part name="sessionId" type="xsd:string" />
</message>
<message name="importexportFooResponse">
<part name="result" type="typens:boolean" />
</message>
<portType name="{{var wsdl.handler}}PortType">
<operation name="importexportFoo">
<documentation>ImportExport Foo</documentation>
<input message="typens:importexportFooRequest" />
<output message="typens:importexportFooResponse" />
</operation>
</portType>
<binding name="{{var wsdl.handler}}Binding" type="typens:{{var wsdl.handler}}PortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="importexportFoo">
<soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
<input>
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output>
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
</operation>
</binding>
</definitions>
/app/code/local/Namespace/ImportExport/Model/Api.php
<?php
class Namespace_ImportExport_Model_Api extends Mage_Api_Model_Resource_Abstract
{
/**
* Returns version of the installed magento
* #return String
*/
public function foo() {
return true;
}
}
?>
/app/code/local/Namespace/ImportExport/Model/API/V2.php
<?php
class Namespace_ImportExport_Model_Api_V2 extends Namespace_ImportExport_Model_Api
{
public function foo() {
return true;
}
}
?>
And I make the call, like so...
$fclient = new SoapClient($config['from']['soap_url']);
$fsession = $fclient->login($config['from']['username'], $config['from']['api_key']);
var_dump($fclient->importexportFoo($fsession));
This to my knowledge is the bare necessities to get my custom api V2 module working. So what could I possibly be doing wrong ?
I am getting this for an error
Function ("importexportFoo") is not a valid method for this service
I've just had this kind of issue.
Check the value of $config['from']['soap_url'] when making the API call. If the value looks like http://example.com/api/soap?wsdlthen you are still making a call to V1. Update it to look like this http://example.com/api/v2_soap/?wsdl.