We have been given a .wsdl file (listing below) which we will be using to generate c# code for use in our app. When I load the file into xmlspy I get the following error
attribute 'type' in message part 'organisation' (message 'getOrganisationResponse') refers to type 'organisation' which is not defined within the WSDL file!
It says it can't find the type but this is defined in the section at the top of the file, so I'm not sure why it does not find it.
Any help would be appreciated
Cheers
Richard
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns:tns="http://www.xxxx.com/epp/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:ns1="http://xml.apache.org/xml-soap/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
name="Heiq"
targetNamespace="http://www.xxxx.com/epp/">
<types>
<!-- Organisation object -->
<xsd:element name="organisation">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="id" type="xsd:string" minOccurs="0"/>
<xsd:element name="componentID" type="xsd:string" minOccurs="0"/>
<xsd:element name="name" type="xsd:string" minOccurs="0"/>
<xsd:element name="suburb" type="xsd:string" minOccurs="0"/>
<xsd:element name="address1" type="xsd:string" minOccurs="0"/>
<xsd:element name="address2" type="xsd:string" minOccurs="0"/>
<xsd:element name="postcode" type="xsd:string"/>
<xsd:element name="phone" type="xsd:string"/>
<xsd:element name="fax" type="xsd:string"/>
<xsd:element name="emailAddress" type="xsd:string"/>
<xsd:element name="website" type="xsd:string"/>
<xsd:element name="contactPersonName" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</types>
<message name="getOrganisationRequest">
<part name="token" type="xsd:string"/>
<part name="organisationID" type="xsd:string"/>
</message>
<message name="getOrganisationResponse">
<part name="organisation" type="organisation"/>
</message>
<portType name="xxxxPortType">
<!-- Get organisation function -->
<operation name="getOrganisation">
<input message="tns:getOrganisationRequest"/>
<output message="tns:getOrganisationResponse"/>
</operation>
</portType>
<binding name="xxxxBinding" type="tns:xxxxPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<!-- Get organisation function -->
<operation name="getOrganisation">
<input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="xxxxService">
<port name="xxxxPort" binding="tns:xxxxBinding">
<soap:address location="http://www.xxxx.com/xxxx/application/soap.php"/>
</port>
</service>
</definitions>
Your type declarations underneath <types> need to be given their own namespace. I'm guessing that the supplier of your wsdl either used an extremely lax parser when testing the WSDL they wrote or relied on some code first WSDL generation tool to create this WSDL. In either case, the onus is on them to get you a properly conforming WSDL and xsd.
Here is an example of what the relevant parts of that WSDL should look like - change the namespaces here as you wish:
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns:tns="http://www.xxxx.com/epp/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:ns1="http://xml.apache.org/xml-soap/"
xmlns:types="http://www.xxxx.com/types/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
name="Heiq"
targetNamespace="http://www.xxxx.com/epp/">
<types>
<xsd:schema targetNamespace="http://www.xxxx.com/types/"
xmlns="http://www.w3.org/2001/XMLSchema">
<xsd:complexType name="organisation">
<xsd:sequence>
<xsd:element name="id" type="xsd:string" minOccurs="0"/>
<xsd:element name="componentID" type="xsd:string" minOccurs="0"/>
<xsd:element name="name" type="xsd:string" minOccurs="0"/>
<xsd:element name="suburb" type="xsd:string" minOccurs="0"/>
<xsd:element name="address1" type="xsd:string" minOccurs="0"/>
<xsd:element name="address2" type="xsd:string" minOccurs="0"/>
<xsd:element name="postcode" type="xsd:string"/>
<xsd:element name="phone" type="xsd:string"/>
<xsd:element name="fax" type="xsd:string"/>
<xsd:element name="emailAddress" type="xsd:string"/>
<xsd:element name="website" type="xsd:string"/>
<xsd:element name="contactPersonName" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</types>
<message name="getOrganisationRequest">
<part name="token" type="xsd:string"/>
<part name="organisationID" type="xsd:string"/>
</message>
<message name="getOrganisationResponse">
<part name="organisation" type="types:organisation"/>
</message>
...
Related
How can i validate these xml and xsd file with xmlvalidate task with Ant . i have tried but didn't get solution for it .can i get a solution
<property name="doc.xsd" location="${basedir}/test.xsd" />
<target name="FindDesc" >
<xmlvalidate file="ab.xml" lenient="yes" failonerror="yes" warn="yes">
<fileset dir="${basedir}" includes="ab.xsl" />
<attribute name="http://xml.org/sax/features/validation" value="true"/>
<attribute name="http://apache.org/xml/features/validation/schema" value="true"/>
<attribute name="http://xml.org/sax/features/namespaces" value="true"/>
<property name="http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation" value="${doc.xsd}" />
</xmlvalidate>
</target>
ab.xml file
<?xml version="1.0"?>
<books xmlns="http://www.example.org/Test" xmlns:xsi="http://www.w3.org/2001/XMLSchema" xsi:noNamespaceSchemaLocation="test.xsd">
<book id="bk001">
<author>Writer</author>
<title>The First Book</title>
<genre>Fiction</genre>
<price>44.95</price>
<pub_date>2000-10-01</pub_date>
<review>An amazing story of nothing.</review>
</book>
<book id="bk002">
<author>Poet</author>
<title>The Poet's First Poem</title>
<genre>Poem</genre>
<price>24.95</price>
<review>Least poetic poems.</review>
</book>
</books>
test.xsd
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" targetNamespace="http://www.example.org/Test"
>
<xsd:element name="books" >
<xsd:complexType >
<xsd:sequence>
<xsd:element name="book" maxOccurs="unbounded" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="author" type="xsd:string"/>
<xsd:element name="title" type="xsd:string"/>
<xsd:element name="genre" type="xsd:string"/>
<xsd:element name="price" type="xsd:float" />
<xsd:element name="pub_date" type="xsd:date" />
<xsd:element name="review" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>
i have tried to test xml with xsd schema with Ant Script i get its not working as mine i get error like this
cvc-elt.1: Cannot find the declaration of element 'books'.
and with these
TargetNamespace.2: Expecting no namespace, but the schema document has a target namespace of 'http://www.example.org/Test'.
xml with no namespace but i want to try to validate with namespace through ant script ..
what can i do if there is any error please give suggestion to test these xml and xsd file with ant script i have gone through xml validation and schema validation
we can use SchemaValidation its easy and fast way to validate the xml with xsd file
If there is one file we can go through this
<schemavalidate>
<schema namespace="<schema_nameSpace>">
file="abc.xml"/>
</schemavalidate>
If multiple file is there we can use fileset
<schemavalidate warn="true" failonerror="true" fullchecking="true">
<fileset dir="<Src_dir_for_Xml>">
<include name="*.xml" />
</fileset>
<schema namespace="<Your schema name space>" file="<schema_src_dir_For_schema" />
</schemavalidate>
I was wondering if is there some way to convert an old RPC WSDL file to a JAX-WS WSDL file. Tried my best to make sure I did my homework but I'm kind of lost here.
From what I've read, I should remove all the 'encodingstyle' ocurrences and switch use="encoded" to use="literal". I can't run any tests by now since the service is currently unavailable. Does anyone know if that should be enough? Any insight will be extremely appreciated.
This is my WSDL file:
<?xml version="1.0" encoding="iso-8859-1"?>
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:wsScrc.XML" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:wsScrc.XML">
<types>
<xsd:schema targetNamespace="urn:wsScrc.XML">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
</xsd:schema>
</types>
<message name="XMLRequest">
<part name="parmA" type="xsd:string" />
<part name="parmB" type="xsd:string" />
<part name="parmC" type="xsd:string" />
<part name="parmD" type="xsd:string" />
<part name="parmE" type="xsd:string" />
<part name="parmF" type="xsd:string" />
<part name="parmG" type="xsd:string" />
</message>
<message name="XMLResponse">
<part name="respA" type="xsd:string" />
<part name="respB" type="xsd:string" />
<part name="respC" type="xsd:string" />
<part name="respD" type="xsd:string" />
<part name="respE" type="xsd:string" />
</message>
<message name="monitorRequest"></message>
<message name="monitorResponse">
<part name="ipServidor" type="xsd:string" />
</message>
<portType name="wsScrc.XMLPortType">
<operation name="XML">
<documentation>Retorna o xml</documentation>
<input message="tns:XMLRequest"/>
<output message="tns:XMLResponse"/>
</operation>
<operation name="monitor">
<documentation>Retorna uma mensagem de ok</documentation>
<input message="tns:monitorRequest"/>
<output message="tns:monitorResponse"/>
</operation>
</portType>
<binding name="wsScrc.XMLBinding" type="tns:wsScrc.XMLPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="XML">
<soap:operation soapAction="urn:wsScrc.XML#XML" style="rpc"/>
<input>
<soap:body use="encoded" namespace="urn:wsScrc.XML" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:wsScrc.XML" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="monitor">
<soap:operation soapAction="urn:wsScrc.monitor#monitor" style="rpc"/>
<input>
<soap:body use="encoded" namespace="urn:wsScrc.monitor" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:wsScrc.monitor" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="wsScrc.XML">
<port name="wsScrc.XMLPort" binding="tns:wsScrc.XMLBinding">
<soap:address location="http://thisismyaddress/webservicePHP/ws.php"/>
</port>
</service>
</definitions>
Thanks in advance.
We were able to do the same by altering the WSDL in that way.
The only issue is that we had to use SAAJ in order to generate the right request and to process the response.
In another WS we used it was just not possible because the XML in the body is generated by Castor. Finally we did not succeed as we did not know what the server expect.
In conclusion I would say: it depends how the server was implemented.
I'm using this wsdl-file to describe my webservice:
<?xml version="1.0" encoding="UTF-8" ?>
<wsdl:definitions targetNamespace="http://www.myapproach.de/knowledgebase" name="Knowledgebase"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:tns="http://www.myapproach.de/knowledgebase"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:rq="http://www.myapproach.de/knowledgebase">
<wsdl:types>
<xsd:schema>
<xsd:import namespace="http://www.myapproach.de/knowledgebase" schemaLocation="GetValueRequest.xsd"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="getValueForKey">
<wsdl:part name="parameters" element="rq:getValueForKey" />
</wsdl:message>
<wsdl:message name="getValueForKeyResponse">
<wsdl:part name="parameters" element="rq:getValueForKeyResponse" />
</wsdl:message>
<wsdl:portType name="KnowledgebasePortType">
<wsdl:operation name="getValueForKey">
<wsdl:input message="tns:getValueForKey" />
<wsdl:output message="tns:getValueForKeyResponse" />
</wsdl:operation>
</wsdl:portType>
<wsp:Policy wsu:Id="KnowledgebasePortBinding_WSAM_Addressing_Policy">
<wsam:Addressing wsp:Optional="true">
<wsp:Policy />
</wsam:Addressing>
</wsp:Policy>
<wsdl:binding name="KnowledgebasePortBinding" type="tns:KnowledgebasePortType">
<wsaw:UsingAddressing />
<wsp:PolicyReference URI="#KnowledgebasePortBinding_WSAM_Addressing_Policy" />
<!-- http://www.w3.org/2003/05/soap/bindings/HTTP/ -->
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc" />
<wsdl:operation name="getValueForKey">
<soap:operation soapAction="http://www.myapproach.de/knowledgebase/getValueForKey" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Knowledgebase">
<wsdl:port name="KnowledgebasePortType" binding="tns:KnowledgebasePortBinding">
<soap:address location="http://www.myapproach.de/knowledgebase" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
GetValueRequest.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.myapproach.de/knowledgebase" xmlns:tns="http://www.myapproach.de/knowledgebase">
<xsd:element name="getValueForKey" type="tns:getValueForKey" />
<xsd:complexType name="getValueForKey">
<xsd:sequence>
<xsd:element name="arg0" type="xsd:string" minOccurs="0" />
<xsd:element name="arg1" type="xsd:string" minOccurs="0" />
<xsd:element name="arg2" type="xsd:double"></xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="getValueForKeyResponse" type="tns:getValueForKeyResponse" />
<xsd:complexType name="getValueForKeyResponse">
<xsd:sequence>
<xsd:element name="return" type="xsd:string" minOccurs="0" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
Everytime I run wsimport, I get this error:
[wsimport] parsing WSDL...
[wsimport] [ERROR] Invalid wsdl:operation "getValueForKey": its a rpc-literal operation, message part must refer to a schema type declaration
[wsimport] line 27 of file:/path/MyFile.wsdl
I have exported the getValueForKey type to the xsd-schemafile, so I don't understand this error... I'm trying this sh*** the whole day grml
Shortly after posting the question I found the answer :-)
Instead of
<wsdl:message name="getValueForKey">
<wsdl:part name="parameters" element="rq:getValueForKey" />
</wsdl:message>
use this
<wsdl:message name="getValueForKey">
<wsdl:part name="parameters" type="rq:getValueForKey" />
</wsdl:message>
the attribute "type" must be used instead of "element".
Additionally the soap:body element has to have a namespace
<wsdl:input>
<soap:body use="literal" namespace="YourNormalNamespace" />
</wsdl:input>
In short, wsdl part has to have type in case of RPC style of webservices else it has to be document style.
How do you define a list of complex type items in WSDL?
I have a rather simple WSDL with 2 complex types
<xsd:complexType name="itemProperty">
<xsd:all>
<xsd:element name="name" type="xsd:string" />
<xsd:element name="value" type="xsd:string" />
<xsd:element name="type" type="xsd:string" />
</xsd:all>
</xsd:complexType>
Then i'm trying to make a list of this complexType like this:
<xsd:complexType name="itemPropertyList">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:sequence>
<xsd:element name="item" type="tns:itemProperty"
maxOccurs="unbounded" minOccurs="0" />
</xsd:sequence>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
I intend to use this list
<message name="getListRequest"></message>
<message name="getListResponse">
<part name="return" type="tns:itemPropertyList" />
</message>
<operation name="getList">
<documentation>Returns an array.</documentation>
<input message="tns:getListRequest" />
<output message="tns:getListResponse" />
</operation>
Instead of a list of elements of type itemProperty, I get this reply, no matter what variations i've tryed (including replacing the base item with the explicit string elements)
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:getListResponse>
<return SOAP-ENC:arrayType="ns2:Map[1]" xsi:type="SOAP-ENC:Array">
<item xsi:type="ns2:Map">
<item>
<key xsi:type="xsd:string">name</key>
<value xsi:type="xsd:string">name_4c3b38b0b77ae</value>
</item>
<item>
<key xsi:type="xsd:string">value</key>
<value xsi:type="xsd:string">name_4c3b38b0b77ee</value>
</item>
<item>
<key xsi:type="xsd:string">type</key>
<value xsi:type="xsd:string">name_4c3b38b0b782b</value>
</item>
</item>
</return>
</ns1:getListResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Any ideas? What is this ns2:Map thing? It's been haunting me for over a week!
Solved.
I used the AXIS model for delivering lists. This involved extending the namespaces attributes to include some extra encodings. I don't know which did the trick, I just added as many as possible while resolving conflicts with the help of eclipse's WSDL editor.
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tns="urn:mynamespace"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="urn:mynamespace"
xmlns:ns1="http://org.apache.axis2/xsd"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:ax21="http://example.org/xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
Also I added 2 extra attributes to declare qualified-form attributes and elements within the schema
<xsd:schema targetNamespace="urn:mynamespace" attributeFormDefault="qualified" elementFormDefault="qualified">
...
</xsd:schema>
Instead of relying on the ComplexType declaration to make a "nillable" unbounded sequence of a complex type within my schema, I switched to declare an element like this:
<xsd:element name="getListResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="tns:itemProperty" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
Then, when defining the message part for the operation I used
<message name="getListResponse">
<part name="parameters" element="tns:getListResponse" />
</message>
instead of
<message name="getListResponse">
<part name="return" type="tns:itemPropertyList" />
</message>
This resulted in a correct enveloper returned:
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:mynamespace" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:getListResponse>
<parameters xsi:type="ns1:getListResponse">
<return xsi:type="ns1:itemProperty">
<name xsi:type="xsd:string">name4c4417b644a8e</name>
<value xsi:type="xsd:string">value4c4417b644aaa</value>
<type xsi:type="xsd:string">type4c4417b644ae8</type>
</return>
<return xsi:type="ns1:itemProperty">
<name xsi:type="xsd:string">name4c4417b644b26</name>
<value xsi:type="xsd:string">value4c4417b644b64</value>
<type xsi:type="xsd:string">type4c4417b644ba1</type>
</return>
<return xsi:type="ns1:itemProperty">
<name xsi:type="xsd:string">name4c4417b644bdf</name>
<value xsi:type="xsd:string">value4c4417b644c1c</value>
<type xsi:type="xsd:string">type4c4417b644c59</type>
</return>
</parameters>
</ns1:getListResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Can I use .resx files in F# 2.0 projects?
If so, how do I go about adding, and then using these resources.
Thanks in advance.
You can Add existing item a .resx file to an F# project, it should automatically get a BuildAction of EmbeddedResource and work. The VS tooling here isn't as good as the other languages yet, but MSBuild does all the heavy lifting, so it's just a matter of getting the right snippet of XML into the .fsproj file.
I'm using a .resx in an F# 2.0 project. Feel free to take a look at it and I hope it helps you. No great shakes but here it is for what it's worth.
http://github.com/OnorioCatenacci/ExtendedSearch
EDIT: For what it's worth, here's the relevant portion of the fsproj file
<ItemGroup>
<Compile Include="assemblyinfo.ExtendedSearch.exe.fs" />
<Compile Include="ExtendedSearch.fs" />
<EmbeddedResource Include="ExtendedSearch.resx" />
</ItemGroup>
And here's ExtendedSearch.resx:
<?xml version="1.0" encoding="utf-8"?>
<root>
<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, ...</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, ...</value>
</resheader>
<!--
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>
<data name = "AppDisplayName">
<value>Extended Search</value>
</data>
<data name="FilePathSpecLabel">
<value>Base File Path:</value>
</data>
<data name="FilePathSpecDefault">
<value>C:\</value>
</data>
<data name ="SelectDirButtonLabel">
<value>. . .</value>
</data>
<data name="FileNameSpecLabel">
<value>File Name Spec:</value>
</data>
<data name="FileNameSpecDefault">
<value>*.dll</value>
</data>
<data name="RecurseIntoSubdirsLabel">
<value>Recurse Into Subdirectories</value>
</data>
<data name ="MajorVerDefault">
<value>1</value>
</data>
<data name="MinorVerDefault">
<value>0</value>
</data>
<data name="RevisionVerDefault">
<value>0</value>
</data>
<data name="BuildVerDefault">
<value>0</value>
</data>
<data name="VersionLabel">
<value>File &Version:</value>
</data>
<data name="SearchButtonCaption">
<value>&Search</value>
</data>
<data name="CancelButtonCaption">
<value>&Cancel</value>
</data>
</root>
I hope this removes any future issues with people not being able to find this on GitHub.
Here is another way. Though I know it's too late for the original question, I hope it helps others.
Create a clean text file with a name=value format, one key/value pair per line. In a file named "strings.txt", write
name1=hello
name2=world
Create a resource file using ResGen.exe acting on your text file from Step 1. You can learn about ResGen at http://msdn.microsoft.com/en-us/library/ccec7sz1%28v=vs.80%29.aspx. ResGen will create a CLR binary file named "strings.resources". Put this resource file where your compiler can find it.
Add "--resource:strings.resources" as a compiler option. I did this from the "Other flags" textbox in the Build properties. You can find more info at http://msdn.microsoft.com/en-us/library/dd233171.aspx
Write the following in your F# project
open System.Resources
let res = ResourceManager("strings", System.Reflection.Assembly.GetExecutingAssembly())
res.GetString("name1") + res.GetString("name2") |> printfn "%s"
To add a resource to an existing F# project, per #"Onorio Catenacci" GitHub Linke above...
Create a text file and fill it with the content below then save and close it.
Rename this text file extension to .resx (XML resource file)
Update the Build Action to EmbeddedResource
The file should now open correctly in the VS resource editor allowing you to edit it's contents.
.resx file template:
<root>
<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, ...</value></resheader>
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, ...</value></resheader>
<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>
</root>